On 2019-08-16 16:31, Matt Zagrabelny wrote:
Hello,

I'm running puppet 5.5 OSE.

I've got a class foo:

class foo {
     $bar = 'hi'
}

class foo::configure {
     file { '/tmp/foo.conf':
         content => template('foo/foo.conf.erb'),
     }
}

and then in the template:

<%= scope['foo::bar'] %>

but suppose I want to access an out of class variable:

<%= scope['baz::qux'] %>

That does not seem to work. Is there any way to access out of class variables in a template?


That should work as long as `baz::qux` has been evaluated before
you evaluate this template.

Can also highly recommend switching to EPP (templates in Puppet Language) instead of ERB (tempaltes in Ruby).

Your template would then be:

<%= $foo::bar %>

Best
- henrik

--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/qj6oa7%24mq6%241%40blaine.gmane.org.

Reply via email to