[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.7-1-98-gf19c0e5
James Turnbull
james at lovedthanlost.net
Wed Apr 8 21:48:08 UTC 2009
The following commit has been merged in the master branch:
commit cc4d6586d420f4beea1eeef85cfe7a28f8e493ac
Author: Bryan Kearney <bkearney at redhat.com>
Date: Thu Feb 12 09:32:01 2009 -0500
Bug #1948: Added patch by jab to support the correct ins syntax. Updated the test cases as well
diff --git a/CHANGELOG b/CHANGELOG
index 1eb84a0..329e700 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
0.24.8
+ Fixing #1948 and #1953 - augeas ins bug: wrong number of arguments (1 for 3)
+
Fixing #944 - changing error message from warning to info - connection recycled
Fixed #961 - puppetd creating too many/not closing TCP connections
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb
index 0ffddeb..fd47da3 100644
--- a/lib/puppet/provider/augeas/augeas.rb
+++ b/lib/puppet/provider/augeas/augeas.rb
@@ -164,14 +164,34 @@ Puppet::Type.type(:augeas).provide(:augeas) do
fail("invalid command #{cmd_array.join[" "]}") if cmd_array.length < 2
command = cmd_array[0]
cmd_array.shift()
- cmd_array[0]=File.join(context, cmd_array[0])
- debug("sending command '#{command}' with params #{cmd_array.inspect}")
begin
case command
- when "set": aug.set(cmd_array[0], cmd_array[1])
- when "rm", "remove": aug.rm(cmd_array[0])
- when "clear": aug.clear(cmd_array[0])
- when "insert", "ins": aug.insert(cmd_array[0])
+ when "set":
+ cmd_array[0]=File.join(context, cmd_array[0])
+ debug("sending command '#{command}' with params #{cmd_array.inspect}")
+ aug.set(cmd_array[0], cmd_array[1])
+ when "rm", "remove":
+ cmd_array[0]=File.join(context, cmd_array[0])
+ debug("sending command '#{command}' with params #{cmd_array.inspect}")
+ aug.rm(cmd_array[0])
+ when "clear":
+ cmd_array[0]=File.join(context, cmd_array[0])
+ debug("sending command '#{command}' with params #{cmd_array.inspect}")
+ aug.clear(cmd_array[0])
+ when "insert", "ins"
+ if cmd_array.size < 3
+ fail("ins requires 3 parameters")
+ end
+ label = cmd_array[0]
+ where = cmd_array[1]
+ path = File.join(context, cmd_array[2])
+ case where
+ when "before": before = true
+ when "after": before = false
+ else fail("Invalid value '#{where}' for where param")
+ end
+ debug("sending command '#{command}' with params #{[label, where, path]}")
+ aug.insert(path, label, before)
else fail("Command '#{command}' is not supported")
end
rescue Exception => e
diff --git a/spec/unit/provider/augeas/augeas.rb b/spec/unit/provider/augeas/augeas.rb
index 1bbf18f..4bc1814 100644
--- a/spec/unit/provider/augeas/augeas.rb
+++ b/spec/unit/provider/augeas/augeas.rb
@@ -206,30 +206,31 @@ describe provider_class do
@augeas.expects(:save).returns(true)
@provider.execute_changes.should == :executed
end
-
- it "should handle insert commands" do
- command = [["insert", "/Jar/Jar"]]
+
+
+ it "should handle ins commands with before" do
+ command = [["ins", "Binks", "before", "/Jar/Jar"]]
context = "/foo"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
- @augeas.expects(:insert).with("/foo/Jar/Jar")
+ @augeas.expects(:insert).with("/foo/Jar/Jar", "Binks", true)
@augeas.expects(:save).returns(true)
@provider.execute_changes.should == :executed
- end
-
- it "should handle ins commands" do
- command = [["ins", "/Jar/Jar"]]
+ end
+
+ it "should handle ins commands with before" do
+ command = [["ins", "Binks", "after", "/Jar/Jar"]]
context = "/foo"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
- @augeas.expects(:insert).with("/foo/Jar/Jar")
+ @augeas.expects(:insert).with("/foo/Jar/Jar", "Binks", false)
@augeas.expects(:save).returns(true)
@provider.execute_changes.should == :executed
- end
+ end
it "should handle multiple commands" do
- command = [["ins", "/Jar/Jar"], ["clear", "/Jar/Jar"]]
+ command = [["ins", "Binks", "after", "/Jar/Jar"], ["clear", "/Jar/Jar"]]
context = "/foo"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
- @augeas.expects(:insert).with("/foo/Jar/Jar")
+ @augeas.expects(:insert).with("/foo/Jar/Jar", "Binks", false)
@augeas.expects(:clear).with("/foo/Jar/Jar")
@augeas.expects(:save).returns(true)
@provider.execute_changes.should == :executed
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list