diff options
author | Bryan Kearney <bkearney@redhat.com> | 2009-02-18 12:46:17 -0500 |
---|---|---|
committer | Bryan Kearney <bkearney@redhat.com> | 2009-03-04 16:51:08 -0500 |
commit | cedeb7982b051e00173822c8d14a794e4fb10ae7 (patch) | |
tree | 1de584e184bad8b10f78abd41f8004f911100da6 /lib/puppet | |
parent | cf48ec0aba120e6e83e48b3499df9029b5302767 (diff) | |
download | puppet-cedeb7982b051e00173822c8d14a794e4fb10ae7.tar.gz puppet-cedeb7982b051e00173822c8d14a794e4fb10ae7.tar.xz puppet-cedeb7982b051e00173822c8d14a794e4fb10ae7.zip |
Backport the fix for #1835
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/provider/augeas/augeas.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 5fa5ab409..e9471b1be 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -42,10 +42,27 @@ Puppet::Type.type(:augeas).provide(:augeas) do if data.is_a?(String) data.each_line do |line| cmd_array = Array.new() - tokens = line.split(" ") - cmd = tokens.shift() - file = tokens.shift() - other = tokens.join(" ") + single = line.index("'") + double = line.index('"') + tokens = nil + delim = " " + if ((single != nil) or (double != nil)) + single = 99999 if single == nil + double = 99999 if double == nil + delim = '"' if double < single + delim = "'" if single < double + end + tokens = line.split(delim) + # If the length of tokens is 2, thn that means the pattern was + # command file "some text", therefore we need to re-split + # the first line + if tokens.length == 2 + tokens = (tokens[0].split(" ")) << tokens[1] + end + cmd = tokens.shift().strip() + delim = "" if delim == " " + file = tokens.shift().strip() + other = tokens.join(" ").strip() cmd_array << cmd if !cmd.nil? cmd_array << file if !file.nil? cmd_array << other if other != "" @@ -59,6 +76,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do return commands end + def open_augeas if (@aug.nil?) flags = 0 |