FAQ
Hi.

I have a dilemma.

So far I've used this kind of syntax:

class foo (
$var1 = $foo::params::var1
$var2 = $foo::params::var2
$var3 = $foo::params::var3
){
...
some code
..
}

but, I've seen also this kind of usage:


class foo (
$var1 = $::foo::params::var1
$var2 = $::foo::params::var2
$var3 = $::foo::params::var3
){
...
some code
..
}


So, what's up with forcing the root scope for the default values of
class params? Is this a better way of writing a module? What do you
think is more "by the book"?

--
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • David Schmitt at Mar 8, 2013 at 7:44 am

    On 2013-03-07 22:14, Jakov Sosic wrote:
    Hi.

    I have a dilemma.

    So far I've used this kind of syntax:

    class foo (
    $var1 = $foo::params::var1
    $var2 = $foo::params::var2
    $var3 = $foo::params::var3
    ){
    ...
    some code
    ..
    }

    but, I've seen also this kind of usage:


    class foo (
    $var1 = $::foo::params::var1
    $var2 = $::foo::params::var2
    $var3 = $::foo::params::var3
    ){
    ...
    some code
    ..
    }


    So, what's up with forcing the root scope for the default values of
    class params? Is this a better way of writing a module? What do you
    think is more "by the book"?
    The latter is what you want to say. The former is a legitimate shortcut
    until you have a class foo::foo. Then you're welcome to a world of pain.




    Best Regards, David

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Nick Fagerlund at Mar 8, 2013 at 10:42 pm
    It's defensive coding around a long-standing unwanted behavior of Puppet.

    See bug http://projects.puppetlabs.com/issues/2053

    More information and explanation here:
    http://docs.puppetlabs.com/puppet/latest/reference/lang_namespaces.html#relative-name-lookup-and-incorrect-name-resolution

    David's comment is right in the general sense, but in the specific sense,
    you'd only run into a problem if you had both:

    - class foo::params
    - class foo::foo::params

    ...in which case you'd get the wrong one unless you forced top namespace.
    But since you'll generally only have one params class per module, you're
    generally fine.
    On Thursday, March 7, 2013 1:14:07 PM UTC-8, Jakov Sosic wrote:

    Hi.

    I have a dilemma.

    So far I've used this kind of syntax:

    class foo (
    $var1 = $foo::params::var1
    $var2 = $foo::params::var2
    $var3 = $foo::params::var3
    ){
    ...
    some code
    ..
    }

    but, I've seen also this kind of usage:


    class foo (
    $var1 = $::foo::params::var1
    $var2 = $::foo::params::var2
    $var3 = $::foo::params::var3
    ){
    ...
    some code
    ..
    }


    So, what's up with forcing the root scope for the default values of
    class params? Is this a better way of writing a module? What do you
    think is more "by the book"?
    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 7, '13 at 9:14p
activeMar 8, '13 at 10:42p
posts3
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase