[augeas-devel] [PATCH] Hosts: handle comments at the end of a host entry

David Lutterkort dlutter at redhat.com
Wed Aug 13 00:58:31 UTC 2008


2 files changed, 6 insertions(+), 1 deletion(-)
lenses/hosts.aug            |    2 +-
lenses/tests/test_hosts.aug |    5 +++++


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1218589084 25200
# Node ID 311a5cee52239fc27a496e8e42f761b8c1741d87
# Parent  b76874a306e98a939258133b865f75df39845678
Hosts: handle comments at the end of a host entry

Comments are put into the tree as part of that host node, i.e. will live as
long as the host entry.

Based on an initial patch by Kjetil Torgrim Homme <kjetilho at linpro.no>

diff -r b76874a306e9 -r 311a5cee5223 lenses/hosts.aug
--- a/lenses/hosts.aug	Tue Aug 12 18:41:18 2008 +0200
+++ b/lenses/hosts.aug	Tue Aug 12 17:58:04 2008 -0700
@@ -17,7 +17,7 @@
                               [ label "ipaddr" . store  word ] . sep_tab .
                               [ label "canonical" . store word ] .
                               [ label "alias" . sep_spc . store word ]*
-                 . eol ]
+                 . (comment|eol) ]
 
   let lns = ( empty | comment | record ) *
 
diff -r b76874a306e9 -r 311a5cee5223 lenses/tests/test_hosts.aug
--- a/lenses/tests/test_hosts.aug	Tue Aug 12 18:41:18 2008 +0200
+++ b/lenses/tests/test_hosts.aug	Tue Aug 12 17:58:04 2008 -0700
@@ -51,6 +51,11 @@
           { "canonical" = "etch.example.com" } 
           { "alias" = "etch" } }
 
+  (* Comment at the end of a line *)
+  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" } }
 
 (* Local Variables: *)
 (* mode: caml *)




More information about the augeas-devel mailing list