On Tuesday, April 8, 2014 9:18:30 AM UTC-5, Baptiste wrote: > > > > Le mardi 8 avril 2014 15:27:13 UTC+2, jcbollinger a écrit : > >> >> 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. >> > > OK, so there is something that I should do wrong. I did some tests prior > to post this message as it was causing me troubles while trying to do a > nodeless setup using hiera, with classes, defines and resources assigned > using hiera. > > I have a vagrant-based public project of a "node-less" project you can > check/test to see how it behaves, and from what I can see, in the graph > generated using the agent, the dependency is present in the > relationship.dot: > https://github.com/gnubila-france/puppet-vagrant-playground . (before > generating the graph I removed the classes declaration from the > hieradata/common.yaml file to simplify the graph output) > > Here is the png of the generated relationships.dot for the client VM: > https://files.bapt.name/relationships.png . It contains the relationship > between mysql service and package. > > Am I mis-interpreting this code and graph? > >
Other reports suggest so, but there are other possibilities, such as the graph not going with the version of the manifests and/or data presented. I am not inclined to set up a test environment for your code, but all past reports -- of which there have been several -- are consistent that resource references cannot be expressed in Hiera data. And that's perfectly sensible. 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/1f840776-8363-4367-8e89-1bc393ea9667%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
