Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Workaround 'can't convert (nil|Symbol) to String' errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vinzent committed Dec 20, 2016
1 parent 088a7f8 commit 604ccbe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/puppet/util/extlookup.rb
Expand Up @@ -40,17 +40,17 @@ def parse_data_contents(data, store)
tdata = data.clone

while tdata =~ /%\{(.+?)\}/
var = $1
var = $1.to_s

# if running in puppet we should make best use of the
# scope variable by using lookupvar, else maybe someone
# sent us a Hash from within the ENC where we wont be getting
# a Puppet scope. Would have been handy if scope had a []
# alias to lookupvar really
if store.respond_to?(:lookupvar)
tdata.gsub!(/%\{#{var}\}/, store.lookupvar(var))
tdata.gsub!(/%\{#{var}\}/, store.lookupvar(var).to_s)
elsif store.respond_to?("[]")
tdata.gsub!(/%\{#{var}\}/, store[var])
tdata.gsub!(/%\{#{var}\}/, store[var].to_s)
else
raise("Don't know how to extract data from a store of type #{store.class}")
end
Expand Down

0 comments on commit 604ccbe

Please sign in to comment.