[augeas-devel] exception: overlapping lenses in tree union.put

Bernhard Bock mailinglists at bock.nu
Wed Jun 17 11:12:02 UTC 2009


Hello,

I’m trying to write a lens for keepalived.conf. Attached is an stripped
down example for the config file and my lens for this file.

augtool can parse the file and get variables. Setting variables does not
work – I guess for the same reason as augparse doesn’t like my lens:

It says “exception: optional expression matches the empty tree but does
not consume a value” for all occurrences of spc?.

When I remove the indentation from the config file as well as from the
lens, I get another error from augparse: “exception: overlapping lenses
in tree union.put” for ‘entry’ and ‘subsubsubsection’.

How can I fix the second error and ideally keep the indentation?

best regards
Bernhard


===============keepalived.conf===============
global_defs {
        router_id lb0
}

vrrp_instance VI_1 {
        interface eth0
        authentication {
                auth_type PASS
                auth_pass mypassword
        }
        priority 150
}

vrrp_instance VI_2 {
        interface eth1
        priority 150
}

virtual_server fwmark 1 {
        delay_loop 1
        real_server 10.0.0.120 80 {
            weight 10
            HTTP_GET {
                  url {
                        path alive.cgi
                        digest 280578934790543798437893472394f4
                  }
                  connect_timeout 4
            }
        }
}


===============keepalived.aug===============

module Keepalived =
   autoload xfm

   let eol = Util.del_str "\n"
   let spc = Util.del_ws_spc
   let anystring = /[A-Za-z0-9]([ A-Za-z0-9\._\-]*[A-Za-z0-9])?/
   let word = /[a-zA-Z0-9_-]+/

   let begin_sec = spc . Util.del_str "{\n"
   let end_sec = spc? . Util.del_str "}\n"

   let empty   = [ del /[ \t]*\n/ "\n" ]
   let comment = [ spc? . del /\! .*/ "! " ]

   let entry = [ spc? . key word . spc . store anysring . eol ]
   let item = (entry|comment)

   let subsubsubsection = [ spc? . key anystring . begin_sec . (item)* .
end_sec ]
   let subsubsection =    [ spc? . key anystring . begin_sec .
(item|subsubsubsection)* . end_sec ]
   let subsection =       [ spc? . key anystring . begin_sec .
(item|subsubsection)* . end_sec ]
   let section =          [ spc? . key anystring . begin_sec .
(item|subsection)* . end_sec ]

   let lns = (empty | section | comment)*

   let filter = incl "/etc/keepalived/keepalived.conf"
   let xfm = transform lns filter






More information about the augeas-devel mailing list