-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

> I have a definition where I am trying to include a class...
> 
> class db_deploy::base {
>     $build_user = "build"
> }
> 
> define db_deploy::elements($db_deploy_version) {
>     include db_deploy::base
> 
>     # Use $build_user here
> }
> 
> When I attempt to access $build_user in the db_deploy::elements
> definition, puppet thinks it has no value. What am I doing wrong?


the definition of the variable is only in the scope of the class.
However you can address it by direct name:

$ cat foo.pp
class a {
  $b = 'helo world'
}

define c(){
  include a
  notice("$a::b")
}

c{'d': }
$ puppet foo.pp
notice: Scope(C[d]): helo world

but you have to include the class, otherwise the class isn't evaluated
hence you can't refer to its variables.

cheers pete
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksbjY4ACgkQbwltcAfKi3/5dQCfZO3yputBjgzFSX23v62qYt7a
TpkAnjjlHdwKtrdZRJABNKYOJPFMs4Y1
=SpBF
-----END PGP SIGNATURE-----

--

You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.


Reply via email to