I'm trying to reference a global hash from a Puppet DSL manifest, but scope.lookupvar
is failing to find it.
My declaration is in rubydefs.pp
and is of the form
$my_hash = JSON.parse(`...some stuff that spits out JSON...`)
I use this hash in my templates with no trouble.
In my DSL file mymodule.rb
I try to reference the hash like this:
foo = scope.lookupvar('::my_hash')
foo.keys.each do |i|
...
but foo
always ends up undefined. I've tried just 'my_hash'
(without the ::
) with the same result. This is the error message from the puppet agent:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `keys' for :undefined:Symbol ....
I'm definitely including the files in the right order; my site.pp
looks like
import "rubydefs.pp"
...
node mynode {
include mymodule
}
How can I reference this hash from a Puppet DSL file?
0 Answers