[augeas-devel] augeas: master - Dhclient: add rfc code parsing

David Lutterkort lutter at fedoraproject.org
Wed Feb 24 01:47:19 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=cb509b442f26f3b808c7156bc0efcb5b7a9af426
Commit:        cb509b442f26f3b808c7156bc0efcb5b7a9af426
Parent:        703746800a83b816b88bbbb910df86c415acc607
Author:        Raphael Pinson <raphink at gmail.com>
AuthorDate:    Tue Feb 23 16:57:01 2010 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Tue Feb 23 16:57:01 2010 -0800

Dhclient: add rfc code parsing

Fixes bug #107
---
 lenses/dhclient.aug            |    7 ++++++-
 lenses/tests/test_dhclient.aug |    7 +++++++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/lenses/dhclient.aug b/lenses/dhclient.aug
index b58f0b6..af46b28 100644
--- a/lenses/dhclient.aug
+++ b/lenses/dhclient.aug
@@ -33,6 +33,7 @@ let sep_cbr           = del /[ \t\n]*\}/ " }"
 let sep_com           = del /[ \t\n]*,[ \t\n]*/ ","
 let sep_slh           = del "\/" "/"
 let sep_col           = del ":" ":"
+let sep_eq            = del /[ \t]*=[ \t]*/ "="
 
 (* Define basic types *)
 let word              = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/
@@ -41,6 +42,10 @@ let word              = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/
 
 (* TODO: there could be a " " in the middle of a value ... *)
 let sto_to_spc        = store /[^\\#,;\{\}" \t\n]+|"[^\\#"\n]+"/
+let sto_to_scl        = store /[^ \t][^;\n]+[^ \t]|[^ \t;\n]+/
+let rfc_code          = [ key "code" . sep_spc . store word ]
+                      . sep_eq
+                      . [ label "value" . sto_to_scl ]
 let sto_number        = store /[0-9][0-9]*/
 
 (************************************************************************
@@ -88,7 +93,7 @@ let stmt_hash_re      = "send"
 
 let stmt_hash         = [ key stmt_hash_re
                         . sep_spc
-                        . [ key word . sep_spc . sto_to_spc ]
+                        . [ key word . sep_spc . (sto_to_spc|rfc_code) ]
                         . sep_scl
                         . (eol|comment) ]
 
diff --git a/lenses/tests/test_dhclient.aug b/lenses/tests/test_dhclient.aug
index d914128..3fa481d 100644
--- a/lenses/tests/test_dhclient.aug
+++ b/lenses/tests/test_dhclient.aug
@@ -15,6 +15,8 @@ send
 	fqdn.fqdn
 	  \"grosse.fugue.com.\";
 
+option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
+
 interface ep0 {
    script /sbin/dhclient-script;
    send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
@@ -61,6 +63,11 @@ lease {
         { "send"
            { "fqdn.fqdn" = "\"grosse.fugue.com.\"" } }
         {}
+        { "option"
+           { "rfc3442-classless-static-routes"
+               { "code"  = "121" }
+               { "value" = "array of unsigned integer 8" } } }
+        {}
         { "interface" = "ep0"
            { "script" = "/sbin/dhclient-script" }
            { "send"




More information about the augeas-devel mailing list