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

Search Discussions

  • Jcbollinger at Oct 26, 2012 at 7:33 pm

    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 26, '12 at 10:46a
activeOct 26, '12 at 7:33p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Jcbollinger: 1 post Dmitry Nilsen: 1 post

People

Translate

site design / logo © 2022 Grokbase