diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-06-12 23:24:36 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-08-01 11:15:28 +1000 |
commit | 201ae59eacaff289a8a5bb45f7d301c1a490a119 (patch) | |
tree | 344cb9a1d52fb5c4a825b4a73f2dd3f90ca88c54 /lib | |
parent | f357a9192647fc5d436d4c934b1912f59996389f (diff) | |
download | puppet-201ae59eacaff289a8a5bb45f7d301c1a490a119.tar.gz puppet-201ae59eacaff289a8a5bb45f7d301c1a490a119.tar.xz puppet-201ae59eacaff289a8a5bb45f7d301c1a490a119.zip |
Allow variable $0 to $9 to be interpolated, if ephemeral
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/scope.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 5b3c6d04a..71b9be27c 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -331,12 +331,17 @@ class Puppet::Parser::Scope ss = StringScanner.new(string) out = "" while not ss.eos? - if ss.scan(/^\$\{((\w*::)*\w+)\}|^\$((\w*::)*\w+)/) + if ss.scan(/^\$\{((\w*::)*\w+|[0-9]+)\}|^\$([0-9])|^\$((\w*::)*\w+)/) # If it matches the backslash, then just retun the dollar sign. if ss.matched == '\\$' out << '$' else # look the variable up - out << lookupvar(ss[1] || ss[3]).to_s || "" + # make sure $0-$9 are lookupable only if ephemeral + var = ss[1] || ss[3] || ss[4] + if var and var =~ /^[0-9]+$/ and not ephemeral?(var) + next + end + out << lookupvar(var).to_s || "" end elsif ss.scan(/^\\(.)/) # Puppet.debug("Got escape: pos:%d; m:%s" % [ss.pos, ss.matched]) |