Puppet3: top scope rooted variable, don't get it

12 views
Skip to first unread message

Julien Deloubes

unread,
Mar 17, 2014, 5:21:00 PM3/17/14
to puppet...@googlegroups.com
Hello there,
i recently bought the new Pro Puppet 2nd edition.
There is something i don't understand, it's about the syntax of top scope rooted variable, here is an example (page 38 of the book):

class ssh_example::params{
  case $::osfamily {
    'Debian': { $sshd_package = 'ssh'}
    'RedHat': { $sshd_package = 'openssh-server'}
    default: {fail("Login class does not work on osfamily: ${::osfamily}")}
  }
}

class ssh_example inherits ssh_example::params {
  package { $::ssh_example::params::sshd_package:
    ensure => installed,
  }
}

As the book said: "The variable $::ssh_example::params::sshd_package is a way of writing the $sshd_package variable so that it can refer only to a single declaration"

I don't get it, OK there is a new package defined at top scope, but where is the relation between this new top scope package and the variable from the inherits class?
I don't understand the logic, could you help me?

Thanks.

Julien Deloubes

unread,
Mar 17, 2014, 5:48:10 PM3/17/14
to puppet...@googlegroups.com
Forget it, it was late, i get confused by the title of the package, got it now :)
Reply all
Reply to author
Forward
0 new messages