[augeas-devel] Improved dhclient lens
Nathaniel Cook
nvcook42 at gmail.com
Mon Aug 22 14:31:30 UTC 2011
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: nathanielc at qualtrics.com
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extdhclient.aug
Type: application/octet-stream
Size: 995 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110822/f421547a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_extdhclient.aug
Type: application/octet-stream
Size: 3896 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110822/f421547a/attachment-0001.obj>
More information about the augeas-devel
mailing list