[Puppet Users] Puppet 3 scoping question

whm@stanford.edu
Fri, 07 Nov 2014 02:30:16 -0000

In puppet 2.7 we use the following construct.

define some::fun(
  ensure => present,
  sname => 'some.server.com'
) {
  include some::fun_setup
  # Template uses sname
  file {"/path/$name":
    content => template("${name}.erb"),
  }
}

class some::fun_setup {
  file{"/etc/ssl/certs/${sname}":
    source => "puppet:///modules/some-files/${sname}.ca.pem"
  }
}

The reference to sname in some::fun_setup does not work in puppet 3.  Not
surprising given the scoping changes.  The problem is I am not sure how to
reference sname defined in the resource from the class some::fun_setup.  In
reading the documentation I think something like $some::fun::sname should
work, but it doesn't.  What is the correct way to reference sname from
some::fun_setup?

The goal is to be able to have manifests that use some::fun as follows:

  some::fun{'fragment1': ensure => present}
  some::fun{'fragment2': ensure => present}
  ...

The fragments are unique, but the ca cert only needs to be installed once.

Thanks in advance,

Bill

--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/affc1a19-64fa-4393-8b17-2b5773eec1ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.