summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-07-26 19:34:27 -0700
committermarkus <markus@AVA-351181.(none)>2010-08-03 15:19:42 -0700
commitbe2b1f360fc15596098280265e6aa76e8043eb92 (patch)
treee1102cd9fabc6fc089825d5b76f57407575d0a71 /lib/puppet/parser/ast
parent03808fdc05c4660c1559cf8a09be80664096e0ad (diff)
downloadpuppet-be2b1f360fc15596098280265e6aa76e8043eb92.tar.gz
puppet-be2b1f360fc15596098280265e6aa76e8043eb92.tar.xz
puppet-be2b1f360fc15596098280265e6aa76e8043eb92.zip
[#4370] Fixes extlookup precedence getting overwritten between runs
We found the gsub! in extlookup was actually modifying the value for extlookup_precedence, so the next node to call it just got the interpolated value from the first run. We did two things in the code to prevent this: 1. We returned a dup of the ast string object so that modifying it wouldn’t change puppet’s state. We didn’t do this for all possible return values because we depend on using the original ast array object to do array concatenation 2. We fixed extlookup to not do a destructive gsub Reviewed by: Jesse Wolfe
Diffstat (limited to 'lib/puppet/parser/ast')
-rw-r--r--lib/puppet/parser/ast/function.rb1
-rw-r--r--lib/puppet/parser/ast/leaf.rb2
2 files changed, 1 insertions, 2 deletions
diff --git a/lib/puppet/parser/ast/function.rb b/lib/puppet/parser/ast/function.rb
index 602016c75..74023f631 100644
--- a/lib/puppet/parser/ast/function.rb
+++ b/lib/puppet/parser/ast/function.rb
@@ -11,7 +11,6 @@ class Puppet::Parser::AST
@settor = true
def evaluate(scope)
-
# Make sure it's a defined function
raise Puppet::ParseError, "Unknown function #{@name}" unless Puppet::Parser::Functions.function(@name)
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index 49cde63ca..090d75c4e 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -42,7 +42,7 @@ class Puppet::Parser::AST
# The base string class.
class String < AST::Leaf
def evaluate(scope)
- @value
+ @value.dup
end
def to_s