On Monday, April 7, 2014 11:53:39 AM UTC-5, Baptiste wrote:
>
> Hi,
>
> Le mercredi 26 mars 2014 16:03:05 UTC+1, Jose Luis Ledesma a écrit :
>>
>>
>> About using the "require" I think the problem is the parser doesn't found 
>> the File['/local_area'] beacuse it's created in the "create_resources", 
>> although IMHO it should work (although I don't know the complexity of make 
>> this possible)
>>
>
> It seems that it is just a matter of correctly writing the dependency. The 
> following two forms should work equally:
>
> require "File[/local_area]"
>
> require: File[/local_area]
>
> See 
> https://ask.puppetlabs.com/question/3130/trying-to-set-dependencies-with-hiera-and-create_resources/?answer=4362#post-id-4362
>  
>


No, that's very mixed up.

There are three different, but related, things that are being commingled 
there: the 'require' statement/function of Puppet DSL, a hash key 'require' 
in the hiera data describing a resource, and, by context and implication, 
the 'require' metaparameter that all resource types have.

The first form given, "require <quoted string>", can only be a use of the 
'require' function (
http://docs.puppetlabs.com/references/3.stable/function.html#require).  
That function is for declaring classes (and simultaneously declaring a 
relationship to declared classes), therefore its argument must be a class 
name or an array of them.  It does not accept resource references, so that 
form will not work.

In this context, the second form given, "require: <resource reference 
string>" can be only a key/value pair appearing in an Hiera data file.  It 
may be valid YAML, but to YAML the value is just a string.  Notwithstanding 
one claim in one (wrong) answer to that ask.puppetlabs.com question, all 
reports from the field -- including this very thread -- are consistent that 
that approach does not work.  Hiera does not automagically coerce the 
string value to a resource reference.

Not only will *neither* of those work, but it is misleading to compare them 
as if they were direct alternatives.  One is a function call that (if it 
worked) would need to appear in an appropriate place in a Puppet manifest 
file, whereas the other is a YAML fragment that could make sense only in an 
Hiera data file.  They are not different forms of the same thing.


John

-- 
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/55ec5e5e-aaed-4a86-bc19-d3b8ae84a98a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to