summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Kearney <bkearney@redhat.com>2010-02-01 15:02:24 -0500
committerBryan Kearney <bkearney@redhat.com>2010-02-01 15:02:24 -0500
commit8a3a2056c82c7d0313a052fef00d3a8f039fe0db (patch)
tree1fc67f984473f57189e0e628e1b4c5c199029eaa
parent2ae7516d77c57c2c26c7afca1e8b825f307887c1 (diff)
downloadpuppet-8a3a2056c82c7d0313a052fef00d3a8f039fe0db.tar.gz
puppet-8a3a2056c82c7d0313a052fef00d3a8f039fe0db.tar.xz
puppet-8a3a2056c82c7d0313a052fef00d3a8f039fe0db.zip
Fix for #2327, check the return types from augeas and fail where appropriate
-rw-r--r--lib/puppet/provider/augeas/augeas.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb
index ac11bbf28..d586fc1e1 100644
--- a/lib/puppet/provider/augeas/augeas.rb
+++ b/lib/puppet/provider/augeas/augeas.rb
@@ -197,6 +197,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
#Get the values from augeas
result = @aug.match(path) || []
+ fail("Error trying to match path '#{path}'") if (result == -1)
+
# Now do the work
case verb
when "size"
@@ -321,13 +323,16 @@ Puppet::Type.type(:augeas).provide(:augeas) do
case command
when "set"
debug("sending command '#{command}' with params #{cmd_array.inspect}")
- aug.set(cmd_array[0], cmd_array[1])
+ rv = aug.set(cmd_array[0], cmd_array[1])
+ fail("Error sending command '#{command}' with params #{cmd_array.inspect}/#{e.message}") if (rv)
when "rm", "remove"
debug("sending command '#{command}' with params #{cmd_array.inspect}")
- aug.rm(cmd_array[0])
+ rv = aug.rm(cmd_array[0])
+ fail("Error sending command '#{command}' with params #{cmd_array.inspect}/#{e.message}") if (rv)
when "clear"
debug("sending command '#{command}' with params #{cmd_array.inspect}")
- @aug.clear(cmd_array[0])
+ rv = aug.clear(cmd_array[0])
+ fail("Error sending command '#{command}' with params #{cmd_array.inspect}/#{e.message}") if (rv == -1)
when "insert", "ins"
label = cmd_array[0]
where = cmd_array[1]
@@ -338,7 +343,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
else fail("Invalid value '#{where}' for where param")
end
debug("sending command '#{command}' with params #{[label, where, path].inspect}")
- aug.insert(path, label, before)
+ rv = aug.insert(path, label, before)
+ fail("Error sending command '#{command}' with params #{cmd_array.inspect}/#{e.message}") if (rv == -1)
else fail("Command '#{command}' is not supported")
end
rescue SystemExit,NoMemoryError