summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2011-07-15 11:54:33 -0700
committerLuke Kanies <luke@puppetlabs.com>2011-07-15 11:54:33 -0700
commitd69bf48ecae71ff01679bb38cdeebc8f4a8b8b15 (patch)
tree6f6b25251f0a581c878b833a90e5b3bab0ac5d11 /lib/puppet/parser/functions
parent4ad404ee7e7244d94ff4d87effc1a041d65b3f73 (diff)
parentbdc0f8716ae8ccb2b2657dfab591afe9589d8902 (diff)
downloadpuppet-d69bf48ecae71ff01679bb38cdeebc8f4a8b8b15.tar.gz
puppet-d69bf48ecae71ff01679bb38cdeebc8f4a8b8b15.tar.xz
puppet-d69bf48ecae71ff01679bb38cdeebc8f4a8b8b15.zip
Merge branch 'refactor/master/8232-array_indexers_on_scope'
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/extlookup.rb12
-rw-r--r--lib/puppet/parser/functions/fqdn_rand.rb2
-rw-r--r--lib/puppet/parser/functions/versioncmp.rb6
3 files changed, 9 insertions, 11 deletions
diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb
index 5fbf26cec..9ffca59a7 100644
--- a/lib/puppet/parser/functions/extlookup.rb
+++ b/lib/puppet/parser/functions/extlookup.rb
@@ -91,9 +91,9 @@ This is for back compatibility to interpolate variables with %. % interpolation
raise Puppet::ParseError, ("extlookup(): wrong number of arguments (#{args.length}; must be <= 3)") if args.length > 3
- extlookup_datadir = undef_as('',lookupvar('::extlookup_datadir'))
+ extlookup_datadir = undef_as('',self['::extlookup_datadir'])
- extlookup_precedence = undef_as([],lookupvar('::extlookup_precedence')).collect { |var| var.gsub(/%\{(.+?)\}/) { lookupvar("::#{$1}") } }
+ extlookup_precedence = undef_as([],self['::extlookup_precedence']).collect { |var| var.gsub(/%\{(.+?)\}/) { self["::#{$1}"] } }
datafiles = Array.new
@@ -121,9 +121,9 @@ This is for back compatibility to interpolate variables with %. % interpolation
if result[0].length == 2
val = result[0][1].to_s
- # parse %{}'s in the CSV into local variables using lookupvar()
+ # parse %{}'s in the CSV into local variables using the current scope
while val =~ /%\{(.+?)\}/
- val.gsub!(/%\{#{$1}\}/, lookupvar($1))
+ val.gsub!(/%\{#{$1}\}/, self[$1])
end
desired = val
@@ -134,9 +134,9 @@ This is for back compatibility to interpolate variables with %. % interpolation
# Individual cells in a CSV result are a weird data type and throws
# puppets yaml parsing, so just map it all to plain old strings
desired = cells.map do |c|
- # parse %{}'s in the CSV into local variables using lookupvar()
+ # parse %{}'s in the CSV into local variables using the current scope
while c =~ /%\{(.+?)\}/
- c.gsub!(/%\{#{$1}\}/, lookupvar($1))
+ c.gsub!(/%\{#{$1}\}/, self[$1])
end
c.to_s
diff --git a/lib/puppet/parser/functions/fqdn_rand.rb b/lib/puppet/parser/functions/fqdn_rand.rb
index 93ab98bcd..668802e73 100644
--- a/lib/puppet/parser/functions/fqdn_rand.rb
+++ b/lib/puppet/parser/functions/fqdn_rand.rb
@@ -7,6 +7,6 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
$random_number_seed = fqdn_rand(30,30)") do |args|
require 'digest/md5'
max = args.shift
- srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),args].join(':')).hex)
+ srand(Digest::MD5.hexdigest([self['::fqdn'],args].join(':')).hex)
rand(max).to_s
end
diff --git a/lib/puppet/parser/functions/versioncmp.rb b/lib/puppet/parser/functions/versioncmp.rb
index 6091e0923..e4edb151e 100644
--- a/lib/puppet/parser/functions/versioncmp.rb
+++ b/lib/puppet/parser/functions/versioncmp.rb
@@ -1,10 +1,8 @@
require 'puppet/util/package'
- Puppet::Parser::Functions::newfunction(
- :versioncmp, :type => :rvalue,
-
- :doc => "Compares two versions
+Puppet::Parser::Functions::newfunction( :versioncmp, :type => :rvalue,
+:doc => "Compares two versions
Prototype: