[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Dominic Cleal
dcleal at redhat.com
Tue May 10 08:05:24 UTC 2011
The following commit has been merged in the experimental branch:
commit 67ed16031c6f1695a5b9933169b1f8ec1a4cce53
Author: Dominic Cleal <dcleal at redhat.com>
Date: Fri Feb 25 22:13:33 2011 +0000
(#6494) Add defnode command to Augeas provider
Uses Augeas' defnode command which creates a variable pointing to a node,
creating it with 'set' if it doesn't already exist.
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb
index 89f08ac..59513e3 100644
--- a/lib/puppet/provider/augeas/augeas.rb
+++ b/lib/puppet/provider/augeas/augeas.rb
@@ -37,6 +37,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
"insert" => [ :string, :string, :path ],
"get" => [ :path, :comparator, :string ],
"defvar" => [ :string, :path ],
+ "defnode" => [ :string, :path, :string ],
"match" => [ :path, :glob ],
"size" => [:comparator, :int],
"include" => [:string],
@@ -359,6 +360,10 @@ Puppet::Type.type(:augeas).provide(:augeas) do
debug("sending command '#{command}' with params #{cmd_array.inspect}")
rv = aug.defvar(cmd_array[0], cmd_array[1])
fail("Error sending command '#{command}' with params #{cmd_array.inspect}") if (!rv)
+ when "defnode"
+ debug("sending command '#{command}' with params #{cmd_array.inspect}")
+ rv = aug.defnode(cmd_array[0], cmd_array[1], cmd_array[2])
+ fail("Error sending command '#{command}' with params #{cmd_array.inspect}") if (!rv)
else fail("Command '#{command}' is not supported")
end
rescue SystemExit,NoMemoryError
diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb
index a65af99..3d53286 100644
--- a/spec/unit/provider/augeas/augeas_spec.rb
+++ b/spec/unit/provider/augeas/augeas_spec.rb
@@ -444,7 +444,7 @@ describe provider_class do
@provider.execute_changes.should == :executed
end
- it "should pass through augeas defvar variables without context" do
+ it "should pass through augeas variables without context" do
command = ["defvar myjar Jar/Jar","set $myjar/Binks 1"]
context = "/foo/"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
@@ -456,5 +456,14 @@ describe provider_class do
@provider.execute_changes.should == :executed
end
+ it "should handle defnode commands" do
+ command = "defnode newjar Jar/Jar[last()+1] Binks"
+ context = "/foo/"
+ @resource.expects(:[]).times(2).returns(command).then.returns(context)
+ @augeas.expects(:defnode).with("newjar", "/foo/Jar/Jar[last()+1]", "Binks").returns(true)
+ @augeas.expects(:save).returns(true)
+ @augeas.expects(:close)
+ @provider.execute_changes.should == :executed
+ end
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list