diff options
author | Bryan Kearney <bkearney@redhat.com> | 2009-02-12 09:32:01 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-13 02:08:49 +1100 |
commit | cc4d6586d420f4beea1eeef85cfe7a28f8e493ac (patch) | |
tree | 213a5b3d4b7234cc0fc9b8ecfff5d9f03d65cf8a /lib | |
parent | 5e35166f1b7219d470916d1ee7a4e6852afaf1f9 (diff) | |
download | puppet-cc4d6586d420f4beea1eeef85cfe7a28f8e493ac.tar.gz puppet-cc4d6586d420f4beea1eeef85cfe7a28f8e493ac.tar.xz puppet-cc4d6586d420f4beea1eeef85cfe7a28f8e493ac.zip |
Bug #1948: Added patch by jab to support the correct ins syntax. Updated the test cases as well
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/augeas/augeas.rb | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 0ffddebb0..fd47da389 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 |