FAQ
Hi every one,

First, I'm really sorry if this topic has already been discussed over and over again but it is not so easy to parse and search the web about this, according to the different versions of puppet.



So, I'm using Puppet 2.6.2 that ships with Debian Squeeze.
(We are not yet ready for puppet 2.7.x).



I'm trying to order classes due to depencies issue and I'am assuming that ordering is recursive (Every thing in class b won't be done before class a)


So I'have tried several syntaxes but in any case, it fails :


Syntax 1
=========

class myClass {

class {'a':
...
}
->
class {'b':}

}


Syntax 2
=========

class myClass {

## Ordering
Class['a'] -> Class['b']

## Declaring
class {'a':
...
}

class {'b':}

}

Syntax 3
=========

class myClass {

class {'a':
...
}

## Use metaparameter
class {'b':
require => Class['a'],
}

}



In every cases, when the client is applying the catalog, resources / types from (or included in) class 'b' are realized before these from class 'a'...

And Yes, I'have checked that none of the resources in class 'b' require one of class 'a'.



So is it possible ? Do I have to upgrade my Puppet master ?


Thanks all for you contributions !

--
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/-/rmqs18UZ-_IJ.
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

  • Nan Liu at Aug 3, 2012 at 3:38 pm

    On Fri, Aug 3, 2012 at 8:15 AM, xkrantz wrote:
    Hi every one,

    First, I'm really sorry if this topic has already been discussed over and over again but it is not so easy to parse and search the web about this, according to the different versions of puppet.



    So, I'm using Puppet 2.6.2 that ships with Debian Squeeze.
    (We are not yet ready for puppet 2.7.x).



    I'm trying to order classes due to depencies issue and I'am assuming that ordering is recursive (Every thing in class b won't be done before class a)


    So I'have tried several syntaxes but in any case, it fails :


    Syntax 1
    =========

    class myClass {

    class {'a':
    ...
    }
    ->
    class {'b':}

    }


    Syntax 2
    =========

    class myClass {

    ## Ordering
    Class['a'] -> Class['b']

    ## Declaring
    class {'a':
    ...
    }

    class {'b':}

    }

    Syntax 3
    =========

    class myClass {

    class {'a':
    ...
    }

    ## Use metaparameter
    class {'b':
    require => Class['a'],
    }

    }



    In every cases, when the client is applying the catalog, resources / types from (or included in) class 'b' are realized before these from class 'a'...

    And Yes, I'have checked that none of the resources in class 'b' require one of class 'a'.



    So is it possible ? Do I have to upgrade my Puppet master ?
    The syntax is correct, and if your classes only contain resources it
    should work, otherwise it's a bug. There's a class containment issue
    and anchors in stdlib have been the way to get around it until some
    definitive solution comes up. This ticket describes this pretty well
    with some examples: http://projects.puppetlabs.com/issues/8040

    Nan

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    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.
  • Xkrantz at Aug 6, 2012 at 7:07 am
    Thank you for your answer Nan,


    Indeed, *"anchor"* from *stdlib* is the solution to the *"global class
    container" ordering issue* in puppet 2.6.

    I finally found it myself but thanks for the answer and the confirmation.

    https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/anchor.rb

    With this syntax :

    class a {
    * anchor {'a::begin' : }*
    * -> *class {'a::params' : }
    -> class {'a::install' : }
    -> class {'a::config' : }
    -> class {'a::service' : }
    * -> anchor {'a::end' : }*
    }

    Macro ordering works :

    class myClass {
    * class {'a': *
    ...
    }
    * -> *
    class {'b':}

    }


    But it is not very easy to find... maybe a reference into the official doc
    of puppet labs http://docs.puppetlabs.com/learning/ordering.html should be
    added ...

    Still, thank you Nan !



    Le vendredi 3 août 2012 17:38:28 UTC+2, Nan Liu a écrit :
    On Fri, Aug 3, 2012 at 8:15 AM, xkrantz wrote:
    Hi every one,

    First, I'm really sorry if this topic has already been discussed over
    and over again but it is not so easy to parse and search the web about
    this, according to the different versions of puppet.


    So, I'm using Puppet 2.6.2 that ships with Debian Squeeze.
    (We are not yet ready for puppet 2.7.x).



    I'm trying to order classes due to depencies issue and I'am assuming
    that ordering is recursive (Every thing in class b won't be done before
    class a)

    So I'have tried several syntaxes but in any case, it fails :


    Syntax 1
    =========

    class myClass {

    class {'a':
    ...
    }
    ->
    class {'b':}

    }


    Syntax 2
    =========

    class myClass {

    ## Ordering
    Class['a'] -> Class['b']

    ## Declaring
    class {'a':
    ...
    }

    class {'b':}

    }

    Syntax 3
    =========

    class myClass {

    class {'a':
    ...
    }

    ## Use metaparameter
    class {'b':
    require => Class['a'],
    }

    }



    In every cases, when the client is applying the catalog, resources /
    types from (or included in) class 'b' are realized before these from class
    'a'...
    And Yes, I'have checked that none of the resources in class 'b' require
    one of class 'a'.


    So is it possible ? Do I have to upgrade my Puppet master ?
    The syntax is correct, and if your classes only contain resources it
    should work, otherwise it's a bug. There's a class containment issue
    and anchors in stdlib have been the way to get around it until some
    definitive solution comes up. This ticket describes this pretty well
    with some examples: http://projects.puppetlabs.com/issues/8040

    Nan
    --
    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/-/mcgONMmeK4gJ.
    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
postedAug 3, '12 at 3:24p
activeAug 6, '12 at 7:07a
posts3
users2
websitepuppetlabs.com

2 users in discussion

Xkrantz: 2 posts Nan Liu: 1 post

People

Translate

site design / logo © 2022 Grokbase