On 2015-15-01 15:53, jcbollinger wrote:


On Wednesday, January 14, 2015 at 8:08:25 PM UTC-6, Felix.Frank wrote:

    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.



Perhaps not.


    $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.



Are you sure that quoting vs. not quoting doesn't make a difference?  At
least with the future parser, the unquoted version ought to be a bona
fide class reference in any context, and I didn't think that was new.
Or are you suggesting that the reference gets stringified upon
assignment to a variable?  I've never done much along these lines, but
that sounds surprising and a bit inconsistent to me.


The 3x catalog/resource API requires that type references are indeed stringified. Internally that string is then turned into a Resource instance where only type and title are filled in.

So, yeah, atm, there is no difference between a quoted reference and a real resource type reference. There will be when we in a later version of puppet improve the catalog and compiler (although the string type will most likely still be supported, it will be more efficient to use a type).

- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/m9bf1n%24uut%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to