On 01/14/2015 03:47 PM, Jason Wever wrote:
> Hi All,
>
> I having a problem in where I'm defining a File Type and setting the
> requires parameter to use a variable name (e.g. requires => $foo).
> However, when I do this, the Puppet run doesn't act like it's
> translating the variable into what it should be set to.  $foo should
> resolve to either Class['a'] or Class['b'] depending on a particular
> fact, but the File Type is being processed by Puppet before Class['a']
> or Class['b'] has been processed.
>
> Is it possible to use a variable as the value for the requires
> parameter in a File Type?
>
> I've tried this with Puppet versions 3.5.1 and 3.6.1 but no change in
> behavior.  Haven't tried a 3.7.x.
>
> Thanks,

Hi,

this is not an ordering issue.

$foo = 'Class["a"]'

The above string is not blessed into a class reference when used as the
value for an ensure parameter (apparently). Not quoting it makes no
difference.

This should work:

$foo = "a"

File["/path/to/file"] { require => Class[$foo] }

HTH,
Felix

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/54B6F51E.3070804%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to