[augeas-devel] [PATCH 1/2] Change the label for comment nodes to '#comment'

David Lutterkort lutter at redhat.com
Wed Mar 4 17:17:43 UTC 2009


---
 lenses/bbhosts.aug              |    2 +-
 lenses/hosts.aug                |    8 +-------
 lenses/logrotate.aug            |    2 +-
 lenses/sudoers.aug              |    2 +-
 lenses/tests/test_bbhosts.aug   |    6 +++---
 lenses/tests/test_exports.aug   |    2 +-
 lenses/tests/test_hosts.aug     |    4 ++--
 lenses/tests/test_logrotate.aug |   20 ++++++++++----------
 lenses/tests/test_sudoers.aug   |    8 ++++----
 9 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/lenses/bbhosts.aug b/lenses/bbhosts.aug
index 0d9a6cb..6515d03 100644
--- a/lenses/bbhosts.aug
+++ b/lenses/bbhosts.aug
@@ -20,7 +20,7 @@ module BBhosts =
     let url   = store /https?:[^;,# \n\t]+/
 
     (* Define comments and empty lines *)
-    let comment = [ label "comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . eol_no_spc ]
+    let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . eol_no_spc ]
     let empty   = [ del /[ \t]*\n/ "\n" ]
 
 
diff --git a/lenses/hosts.aug b/lenses/hosts.aug
index 572c3b3..7f3c01d 100644
--- a/lenses/hosts.aug
+++ b/lenses/hosts.aug
@@ -9,7 +9,7 @@ module Hosts =
   let eol = del /[ \t]*\n/ "\n"
   let indent = del /[ \t]*/ ""
 
-  let comment = [ indent . label "comment" . del /#[ \t]*/ "# " . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ]
+  let comment = Util.comment
   let empty   = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
 
   let word = /[^# \n\t]+/
@@ -22,9 +22,3 @@ module Hosts =
   let lns = ( empty | comment | record ) *
 
   let xfm = transform lns (incl "/etc/hosts")
-
-(* Local Variables: *)
-(* mode: caml *)
-(* End: *)
-
-
diff --git a/lenses/logrotate.aug b/lenses/logrotate.aug
index fad8aa6..809e92e 100644
--- a/lenses/logrotate.aug
+++ b/lenses/logrotate.aug
@@ -21,7 +21,7 @@ module Logrotate =
    
 
    (* define comments and empty lines *)
-   let comment (indent:string) = [ label "comment" . del /[ \t]*/ indent . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . eol ]
+   let comment (indent:string) = [ label "#comment" . del /[ \t]*/ indent . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . eol ]
    let empty   = [ del /[ \t]*\n/ "\n" ]
 
 
diff --git a/lenses/sudoers.aug b/lenses/sudoers.aug
index 65cc983..400a5b9 100644
--- a/lenses/sudoers.aug
+++ b/lenses/sudoers.aug
@@ -104,7 +104,7 @@ let sto_to_spc = store /[^() \t\n\\\\]+/
 Map comments in "#comment" nodes *)
 let comment =
   let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ in
-  [ label "comment" . del /[ \t]*#[ \t]*/ "# " . sto_to_eol . eol ]
+  [ label "#comment" . del /[ \t]*#[ \t]*/ "# " . sto_to_eol . eol ]
 
 (* View: empty
 Map empty lines *)
diff --git a/lenses/tests/test_bbhosts.aug b/lenses/tests/test_bbhosts.aug
index 66d5e18..b76f775 100644
--- a/lenses/tests/test_bbhosts.aug
+++ b/lenses/tests/test_bbhosts.aug
@@ -26,7 +26,7 @@ group-compress My test
 
    test BBhosts.lns get conf = 
       {}
-      { "comment" = "A comment" }
+      { "#comment" = "A comment" }
       {}
       { "page" = "firstpage"
          { "title"          = "My first page" }
@@ -66,13 +66,13 @@ group-compress My test
 		   { "ssh" = "!" }
 		   { "dns" = ""
 		      { "url" = "mydnstocheck" } } } }
-	     { "comment" = "a comment in a group" }
+	     { "#comment" = "a comment in a group" }
 	     {}
 	     {} } }
        { "page" = "anotherpage"
           { "title" = "A new page" }
 	  {}
-	  { "comment" = "a comment in a page" }
+	  { "#comment" = "a comment in a page" }
 	  {}
 	  { "group-compress" = "My test"
 	     { "host"
diff --git a/lenses/tests/test_exports.aug b/lenses/tests/test_exports.aug
index cb14e2d..680c46d 100644
--- a/lenses/tests/test_exports.aug
+++ b/lenses/tests/test_exports.aug
@@ -20,7 +20,7 @@ module Test_exports =
         { "client" = "@netgroup"
             { "option" = "rw" } }
         { "client" = "*.example.com" } }
-    { "comment" = "Yes, we export /tmp" }
+    { "#comment" = "Yes, we export /tmp" }
     { "dir" = "/tmp"
         { "client" = "172.31.0.0/16"
             { "option" = "rw" }
diff --git a/lenses/tests/test_hosts.aug b/lenses/tests/test_hosts.aug
index c9b976b..3792008 100644
--- a/lenses/tests/test_hosts.aug
+++ b/lenses/tests/test_hosts.aug
@@ -16,7 +16,7 @@ module Test_hosts =
           { "canonical" = "foo" }
           { "alias" = "foo.example.com" }
     }
-    { "comment" = "comment" }
+    { "#comment" = "comment" }
     { "2" { "ipaddr" = "192.168.0.1" }
           { "canonical" = "pigiron.example.com" }
           { "alias" = "pigiron" }
@@ -55,7 +55,7 @@ module Test_hosts =
   test Hosts.lns get "127.0.0.1 localhost # must always be there \n" =
     { "1" { "ipaddr" = "127.0.0.1" }
           { "canonical" = "localhost" } 
-          { "comment" = "must always be there" } }
+          { "#comment" = "must always be there" } }
 
 (* Local Variables: *)
 (* mode: caml *)
diff --git a/lenses/tests/test_logrotate.aug b/lenses/tests/test_logrotate.aug
index b416862..406a717 100644
--- a/lenses/tests/test_logrotate.aug
+++ b/lenses/tests/test_logrotate.aug
@@ -61,25 +61,25 @@ include /etc/logrotate.d
 "
 
    test Logrotate.lns get conf = 
-      { "comment" = "see man logrotate for details" }
-      { "comment" = "rotate log files weekly" }
+      { "#comment" = "see man logrotate for details" }
+      { "#comment" = "rotate log files weekly" }
       { "schedule" = "weekly" }
       {}
-      { "comment" = "keep 4 weeks worth of backlogs" }
+      { "#comment" = "keep 4 weeks worth of backlogs" }
       { "rotate"   = "4" }
       {}
-      { "comment" = "create new (empty) log files after rotating old ones" }
+      { "#comment" = "create new (empty) log files after rotating old ones" }
       { "create" }
       {}
-      { "comment" = "uncomment this if you want your log files compressed" }
-      { "comment" = "compress" }
+      { "#comment" = "uncomment this if you want your log files compressed" }
+      { "#comment" = "compress" }
       {}
       { "tabooext" = "+"  { ".old" } { ".orig" } { ".ignore" } }
       {}
-      { "comment" = "packages drop log rotation information into this directory" }
+      { "#comment" = "packages drop log rotation information into this directory" }
       { "include" = "/etc/logrotate.d" }
       {}
-      { "comment" = "no packages own wtmp, or btmp -- we'll rotate them here" }
+      { "#comment" = "no packages own wtmp, or btmp -- we'll rotate them here" }
       { "rule"
            { "file"      = "/var/log/wtmp" }
            { "missingok" = "missingok" }
@@ -94,7 +94,7 @@ include /etc/logrotate.d
            { "file"      = "/var/log/btmp" }
 	   { "file"      = "/var/log/btmp*" }
            { "missingok" = "missingok" }
-	   { "comment"   = "ftpd doesn't handle SIGHUP properly" }
+	   { "#comment"   = "ftpd doesn't handle SIGHUP properly" }
            { "schedule"  = "monthly" }
            { "create"
                 { "mode"  = "0664" }
@@ -103,7 +103,7 @@ include /etc/logrotate.d
            { "rotate" = "1" } }
       { "rule"
            { "file"      = "/var/log/vsftpd.log" }
-           { "comment"   = "ftpd doesn't handle SIGHUP properly" }
+           { "#comment"   = "ftpd doesn't handle SIGHUP properly" }
            { "compress"  = "nocompress" }
            { "missingok" = "missingok" }
            { "ifempty"   = "notifempty" }
diff --git a/lenses/tests/test_sudoers.aug b/lenses/tests/test_sudoers.aug
index 7e41fc8..904be5c 100644
--- a/lenses/tests/test_sudoers.aug
+++ b/lenses/tests/test_sudoers.aug
@@ -44,9 +44,9 @@ www-data +biglab=(rpinson)NOEXEC: ICAL \
               { "host" = "192.168.0.0/24" }
               { "host" = "localhost" } } }
       {}
-      { "comment" = "User alias specification" }
+      { "#comment" = "User alias specification" }
       {}
-      { "comment" = "Cmnd alias specification" }
+      { "#comment" = "Cmnd alias specification" }
       {}
       { "Cmnd_Alias"
           { "alias"
@@ -75,7 +75,7 @@ www-data +biglab=(rpinson)NOEXEC: ICAL \
           { "type"      = ":buildd" }
 	  { "parameter" = "env_keep+=\"APT_CONFIG DEBIAN_FRONTEND SHELL\"" } }
       {}
-      { "comment" = "User privilege specification" }
+      { "#comment" = "User privilege specification" }
       { "spec"
           { "user" = "root" }
           { "host_group"
@@ -83,7 +83,7 @@ www-data +biglab=(rpinson)NOEXEC: ICAL \
 	      { "command" = "ALL"
 	          { "runas_user"  = "ALL" } } } }
       {}
-      { "comment" = "Members of the admin group may gain root privileges" }
+      { "#comment" = "Members of the admin group may gain root privileges" }
       { "spec"
           { "user"    = "%admin" }
 	  { "host_group"
-- 
1.6.0.6




More information about the augeas-devel mailing list