[augeas-devel] [PATCH 1 of 2] Add puppet.aug and associated test

Raphael Pinson raphink at gmail.com
Wed Aug 13 16:54:22 UTC 2008


# HG changeset patch
# User Raphael Pinson <raphink at gmail.com>
# Date 1218646423 -7200
# Node ID 6f492eaaa453856246c5ffa79ffd1c8e06939261
# Parent  98e1bdd4af843caab45a32d0120c6c5497260f2d
Add puppet.aug and associated test

diff -r 98e1bdd4af84 -r 6f492eaaa453 lenses/puppet.aug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/puppet.aug	Wed Aug 13 18:53:43 2008 +0200
@@ -0,0 +1,18 @@
+(* Puppet module for Augeas
+ Author: Raphael Pinson <raphink at gmail.com>
+
+ puppet.conf is a standard INI File.
+*)
+
+
+module Puppet =
+  autoload xfm
+
+let comment = IniFile.comment_generic "#" "#"
+let entry   = IniFile.entry_nocolon_setcomment /[a-z][a-z0-9\._-]+/ comment
+let record  = IniFile.record_setcomment "section" entry comment
+let lns     = IniFile.lns_setcomment record comment
+
+let filter = (incl "/etc/puppet/puppet.conf")
+
+let xfm = transform lns filter
diff -r 98e1bdd4af84 -r 6f492eaaa453 lenses/tests/test_puppet.aug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/tests/test_puppet.aug	Wed Aug 13 18:53:43 2008 +0200
@@ -0,0 +1,31 @@
+module Test_puppet =
+
+   let conf = "
+[main]
+logdir=/var/log/puppet
+
+[puppetd]
+server=misspiggy.network.com
+"
+
+   test Puppet.lns get conf =
+      {}
+      { "section" = "main"
+         { "logdir" = "/var/log/puppet" }
+         {} }
+      { "section" = "puppetd"
+         { "server" = "misspiggy.network.com" } }
+
+    test Puppet.lns put conf after
+       set "section[1]/vardir" "/var/lib/puppet";
+       set "section[1]/rundir" "/var/run/puppet"
+    = "
+[main]
+logdir=/var/log/puppet
+
+vardir=/var/lib/puppet
+rundir=/var/run/puppet
+[puppetd]
+server=misspiggy.network.com
+"
+




More information about the augeas-devel mailing list