diff options
| author | Bryan Kearney <bkearney@redhat.com> | 2010-03-22 08:36:07 -0400 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2010-03-24 09:32:01 +1100 |
| commit | 7ec50a74f81264591208fb55e01567ee795ab6b8 (patch) | |
| tree | e1e374a3553d4738c223489ba9155db646b2a21a /lib | |
| parent | d561a988c53d521d0fecf06c4f4d8a65267ac005 (diff) | |
| download | puppet-7ec50a74f81264591208fb55e01567ee795ab6b8.tar.gz puppet-7ec50a74f81264591208fb55e01567ee795ab6b8.tar.xz puppet-7ec50a74f81264591208fb55e01567ee795ab6b8.zip | |
Fixes #3387 - Handle path elements with ticks and spaces
Unit tests for path changes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/provider/augeas/augeas.rb | 12 | ||||
| -rw-r--r-- | lib/puppet/type/augeas.rb | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 5b9133a92..6e471b8e8 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -82,18 +82,24 @@ Puppet::Type.type(:augeas).provide(:augeas) do if f == :path start = sc.pos nbracket = 0 + inSingleTick = false + inDoubleTick = false begin - sc.skip(/([^\]\[\s\\]|\\.)+/) + sc.skip(/([^\]\[\s\\'"]|\\.)+/) ch = sc.getch nbracket += 1 if ch == "[" nbracket -= 1 if ch == "]" + inSingleTick = !inSingleTick if ch == "'" + inDoubleTick = !inDoubleTick if ch == "\"" fail("unmatched [") if nbracket < 0 - end until nbracket == 0 && (sc.eos? || ch =~ /\s/) + end until ((nbracket == 0 && !inSingleTick && !inDoubleTick && (ch =~ /\s/)) || sc.eos?) len = sc.pos - start len -= 1 unless sc.eos? unless p = sc.string[start, len] fail("missing path argument #{narg} for #{cmd}") end + # Rip off any ticks if they are there. + p = p[1, (p.size - 2)] if p[0,1] == "'" || p[0,1] == "\"" p.chomp!("/") if p[0,1] != "$" && p[0,1] != "/" argline << context + p @@ -278,7 +284,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do save_result = @aug.save saved_files = @aug.match("/augeas/events/saved") if save_result and not files_changed? - debug("Skipping becuase no files were changed") + debug("Skipping because no files were changed") return_value = false else debug("Files changed, should execute") diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb index cfd1da55b..49d6d5f07 100644 --- a/lib/puppet/type/augeas.rb +++ b/lib/puppet/type/augeas.rb @@ -145,7 +145,7 @@ Puppet::Type.newtype(:augeas) do end # if the onlyif resource is provided, then the value is parsed. - # a return value of 0 will stop exection becuase it matches the + # a return value of 0 will stop exection because it matches the # default value. def retrieve if @resource.provider.need_to_run?() |
