2 Parse the /etc/cobbler/settings file which is in
5 The lens can handle the following contructs
9 * key: [value1, value2]
20 This file is licensed under the LGPL v2+, like the rest of Augeas.
22 module CobblerSettings =
25 let kw = /[a-zA-Z0-9_]+/
26 (* TODO Would be better if this stripped off the "" and '' chracters *)
27 let kv = /([^]['", \t\n#:@-]+|"[^"\n]*"|'[^'\n]*')/
29 let lbr = del /\[/ "["
30 let rbr = del /\]/ "]"
31 let colon = del /[ \t]*:[ \t]*/ ": "
32 let dash = del /-[ \t]*/ "- "
33 (* let comma = del /,[ \t]*(\n[ \t]+)?/ ", " *)
34 let comma = del /[ \t]*,[ \t]*/ ", "
36 let eol_only = del /\n/ "\n"
38 (* TODO Would be better to make items a child of a document *)
39 let docmarker = /-{3}/
42 let comment = Util.comment
43 let empty = Util.empty
44 let indent = del /[ \t]+/ "\t"
45 let ws = del /[ \t]*/ " "
47 let value_list = Build.opt_list [label "item" . store kv] comma
48 let setting = [key kw . colon . store kv] . eol
49 let simple_setting_suffix = store kv . eol
50 let setting_list_suffix = [label "sequence" . lbr . ws . (value_list . ws)? . rbr ] . eol
51 let indendented_setting_list_suffix = eol_only . (indent . setting)+
52 let indented_list_suffix = [label "list" . eol_only . ([ label "value" . indent . dash . store kv] . eol)+]
54 (* Break out setting because of a current bug in augeas *)
55 let nested_setting = [key kw . colon . (
56 (* simple_setting_suffix | *)
58 indendented_setting_list_suffix |
63 let document = [label "---" . store docmarker] . eol
65 let lns = (document | comment | empty | setting | nested_setting )*
67 let xfm = transform lns (incl "/etc/cobbler/settings")
70 (* Local Variables: *)