From 8a3a2056c82c7d0313a052fef00d3a8f039fe0db Mon Sep 17 00:00:00 2001 From: Bryan Kearney Date: Mon, 1 Feb 2010 15:02:24 -0500 Subject: Fix for #2327, check the return types from augeas and fail where appropriate --- lib/puppet/provider/augeas/augeas.rb | 14 ++++++++++---- 1 file 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 -- cgit