[augeas-devel] [PATCH] Map service names in node values instead of node names to prevent variable node names.

Raphael Pinson raphink at gmail.com
Fri Oct 29 03:27:51 UTC 2010


This patch maps service names in xinetd.aug as node values instead of node names to prevent variable node names in the tree and comply with the new inetd.aug tree.

As this is done, there is no need to exclude /include|includedir|defaults/ from the service regexp anymore.

---
 lenses/tests/test_xinetd.aug |    7 ++++---
 lenses/xinetd.aug            |    4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lenses/tests/test_xinetd.aug b/lenses/tests/test_xinetd.aug
index c49496b..d728d73 100644
--- a/lenses/tests/test_xinetd.aug
+++ b/lenses/tests/test_xinetd.aug
@@ -45,7 +45,7 @@ test Xinetd.lns get cvs =
   { "#comment" = "files. CVS stores all the versions of a file in a single" }
   { "#comment" = "file in a clever way that only stores the differences" }
   { "#comment" = "between versions." }
-  { "cvspserver"
+  { "service" = "cvspserver"
       { "disable" = "yes" }
       { "port" = "2401" }
       { "socket_type" = "stream" }
@@ -63,11 +63,12 @@ test Xinetd.lns get cvs =
       { "log_on_failure" { "add" } { "value" = "HOST" } } }
 
 (* Switch the '+=' to a simple '=' *)
-test Xinetd.lns put lst_add after rm "/svc_add/log_on_failure/add" =
+test Xinetd.lns put lst_add after rm "/service/log_on_failure/add" =
   "service svc_add\n{\n   log_on_failure = HOST\n}\n"
 
 test Xinetd.lns put "" after
-  set "/svc/instances" "UNLIMITED" = "service svc
+  set "/service" "svc";
+  set "/service/instances" "UNLIMITED" = "service svc
 {
 \tinstances = UNLIMITED
 }
diff --git a/lenses/xinetd.aug b/lenses/xinetd.aug
index f0a7f2c..07748f8 100644
--- a/lenses/xinetd.aug
+++ b/lenses/xinetd.aug
@@ -102,8 +102,8 @@ module Xinetd =
                      . Util.del_ws_spc . store /[^ \t\n]+/ . eol ]
 
   let service =
-     let key_re = /[^# \t\n\/]+/ - /include|includedir|defaults/ in
-     [ del /service[ \t]+/ "service " . key key_re . body service_attr ]
+     let sto_re = /[^# \t\n\/]+/ in
+     [ key "service" . Sep.space . store sto_re . body service_attr ]
 
   let defaults = [ key "defaults" . del /[ \t]*/ "" . body default_attr ]
 
-- 
1.7.0.4




More information about the augeas-devel mailing list