Dmitry Nilsen
2012-Oct-26 10:26 UTC
[Puppet Users] serialized call for defines by naming them with array (ordering for the output )
Hi.. I have following issue: If calling a define with an array as names, then it applyes defines in parallel way (which is logical by puppet structure) example: # define a function define func(){ exec{"/bin/echo $name >> /tmp/file"} } # call it func{["a","b","c","d"]: } then my file would have an ordering like: # cat /tmp/file b a d c but how to do this in a serialized way? so, that, at the end, my file has an ordering structure exactly as an array, so: a b c d any idea? Its realy usefull for config files where the ordering of parameter does matter. Regards Dimitri -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/gf5K3PAgYPoJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-Oct-26 16:56 UTC
[Puppet Users] Re: serialized call for defines by naming them with array (ordering for the output )
On Friday, October 26, 2012 5:26:43 AM UTC-5, Dmitry Nilsen wrote:> > Hi.. I have following issue: > If calling a define with an array as names, then it applyes defines in > parallel way (which is logical by puppet structure) > > example: > > # define a function > define func(){ > exec{"/bin/echo $name >> /tmp/file"} > } > > # call it > func{["a","b","c","d"]: } > > then my file would have an ordering like: > # cat /tmp/file > b > a > d > c > > but how to do this in a serialized way? so, that, at the end, my file has > an ordering structure exactly as an array, so: > a > b > c > d > > any idea? > Its realy usefull for config files where the ordering of parameter does > matter. > >Relative ordering of resources is achieved by declaring resource relationships. You can do that via the ''require'' and ''before'' resource metaparameters, or via the resource chaining operators, but there is no mechanism for creating relationships based on the order of array elements. You might be able to write a custom function that did that -- for instance, a create_relationships() function in the same spirit as the create_resources() built-in. Alternatively, you could surely do what you want by switching (that class) to Ruby DSL instead of Puppet DSL. I can''t think of any other general-purpose approaches, but there might be additional alternatives for your particular problem. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/JC2hMyRuzU8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.