Hello,

I have developed a simple lens that adds the option modifiers to the
dhclient lens. I have tested this with CentOS and it works great. I am
not sure how it will work with other distros, (my search showed that
the format might vary but haven't tested it). I have written it in
such a way that it could be directly added to the original dhclient
lns or just used separately. The files are attached but here is the
lens:

(* Extended dhclient module for Augeas
        Author: [email protected]
        
        This module reuses the distributed Dhclient module
        and adds the ability to use the option modifiers.
        
        Also adds the /etc/dhclient*.conf to the filter of valid files

*)

module Extdhclient =
        autoload xfm

(***************************************************************************
*                           OPTION MODIFING STATEMENTS
****************************************************************************)

        let stmt_opt_mod_re   = "default" | "supersede" | "append" | "prepend"

        let stmt_opt_mod    = [ key stmt_opt_mod_re
                                                        . Dhclient.sep_spc
                                                        . [ key Dhclient.word . 
Dhclient.sep_spc . Dhclient.sto_to_spc ]
                                                        . Dhclient.sep_scl
                                                        . 
Dhclient.comment_or_eol ]
                                                
        
        let statement =  (Dhclient.statement | stmt_opt_mod)
        
        let lns = (Dhclient.empty | Dhclient.comment | statement) *

        let filter = Dhclient.filter . incl "/etc/dhclient*.conf"

        let xfm = transform lns filter
        


Hope this is helpful.

Nathaniel Cook

Attachment: extdhclient.aug
Description: Binary data

Attachment: test_extdhclient.aug
Description: Binary data

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to