[augeas-devel] [PATCH] Add lens and test for dnsmasq.conf
Free Ekanayaka
free at 64studio.com
Thu Sep 4 10:44:43 UTC 2008
# HG changeset patch
# User Free Ekanayaka <free at 64studio.com>
# Date 1220525059 -7200
# Node ID 6ce32e4097f9c1acb12387d066e2bb30e9d28c72
# Parent 77cf07dd59dc3e62c02549f677bd422344ba4268
Add lens and test for dnsmasq.conf
diff -r 77cf07dd59dc -r 6ce32e4097f9 lenses/dnsmasq.aug
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/dnsmasq.aug Thu Sep 04 12:44:19 2008 +0200
@@ -0,0 +1,44 @@
+(* Dnsmasq module for Augeas
+ Author: Free Ekanayaka <free at 64studio.com>
+
+ Reference: man dnsmasq (8)
+
+ "Format is one option per line, legal options are the same
+ as the long options legal on the command line. See
+ "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details."
+
+*)
+
+module Dnsmasq =
+
+ autoload xfm
+
+(************************************************************************
+ * USEFUL PRIMITIVES
+ *************************************************************************)
+
+let eol = Util.eol
+let spc = Util.del_ws_spc
+let comment = Util.comment
+let empty = Util.empty
+
+let sep_eq = del /=/ "="
+let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
+
+(************************************************************************
+ * ENTRIES
+ *************************************************************************)
+
+let entry_re = /[A-Za-z0-9\._-]+/
+let entry = [ key entry_re . (sep_eq . sto_to_eol)? . eol ]
+
+(************************************************************************
+ * LENS
+ *************************************************************************)
+
+let lns = (comment|empty|entry) *
+
+let filter = incl "/etc/dnsmasq.conf"
+ . Util.stdexcl
+
+let xfm = transform lns filter
diff -r 77cf07dd59dc -r 6ce32e4097f9 lenses/tests/test_dnsmasq.aug
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/tests/test_dnsmasq.aug Thu Sep 04 12:44:19 2008 +0200
@@ -0,0 +1,17 @@
+module Test_dnsmasq =
+
+let conf = "# Configuration file for dnsmasq.
+#
+#bogus-priv
+
+conf-dir=/etc/dnsmasq.d
+selfmx
+"
+
+test Dnsmasq.lns get conf =
+ { "#comment" = "Configuration file for dnsmasq." }
+ {}
+ { "#comment" = "bogus-priv" }
+ {}
+ { "conf-dir" = "/etc/dnsmasq.d" }
+ { "selfmx" }
More information about the augeas-devel
mailing list