summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBryan Kearney <bkearney@redhat.com>2009-02-13 08:21:36 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-02-14 00:45:10 +1100
commit2a855510a3cca7d475c31495ccb502af606528dc (patch)
treeb9bc49f9f1daf542e0fdb5266c7c1d0e0dbd104b /lib
parent2218611f7fa10b59945f65c80b05cbd8ebe137ef (diff)
downloadpuppet-2a855510a3cca7d475c31495ccb502af606528dc.tar.gz
puppet-2a855510a3cca7d475c31495ccb502af606528dc.tar.xz
puppet-2a855510a3cca7d475c31495ccb502af606528dc.zip
Bug 1948: Add logic and testing for the command parsing logic
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/augeas/augeas.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb
index fd47da389..8d4f6d55a 100644
--- a/lib/puppet/provider/augeas/augeas.rb
+++ b/lib/puppet/provider/augeas/augeas.rb
@@ -52,7 +52,6 @@ Puppet::Type.type(:augeas).provide(:augeas) do
commands.concat(parse_commands(datum))
end
end
-
return commands
end
@@ -179,18 +178,20 @@ Puppet::Type.type(:augeas).provide(:augeas) do
debug("sending command '#{command}' with params #{cmd_array.inspect}")
aug.clear(cmd_array[0])
when "insert", "ins"
- if cmd_array.size < 3
+
+ ext_array = cmd_array[1].split(" ") ;
+ if cmd_array.size < 2 or ext_array.size < 2
fail("ins requires 3 parameters")
end
label = cmd_array[0]
- where = cmd_array[1]
- path = File.join(context, cmd_array[2])
+ where = ext_array[0]
+ path = File.join(context, ext_array[1])
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]}")
+ debug("sending command '#{command}' with params #{[label, where, path].inspect()}")
aug.insert(path, label, before)
else fail("Command '#{command}' is not supported")
end