Is class 'hosts' declared in node 'env_prod' or node 'something'? For this to work I would think it needs to be in node 'something', after the variable declaration.

I'd try declare all your global variables at the top of your node definitions first, then start including classes. Or, convert the 'hosts' class to be a parameterised class.

Lastly, reference your global scope variables like $::mode, as that is forwards compatible with the latest Puppet.

On 12/12/11 15:44, Marek Dohojda wrote:
I am told that somehow I hijacked a thread. I have no idea why that would be since I replied to my own email. If it got attached to anything it shouldn't be I apologize, for an email client snafu.

Anyway, any hints of what may be happening with my variables, why they are hating me?

-----Original Message----- From: Marek Dohojda
Sent: Saturday, December 10, 2011 9:53 PM
To: Puppet Users
Subject: Re: Variables not inheriting

PS.  When I put the variables for testing in the class, the variable is
working fine.

-----Original Message----- From: Marek Dohojda
Sent: Saturday, December 10, 2011 9:51 PM
To: Puppet Users
Subject: Variables not inheriting

I am having a weird problem on a new (rhel6) puppet server. I can not seem to be able to define custom variable. Neither template nor class is able to
use this variable.

Puppet version: 2.7.9
server: RHEL 6.1

here is snippet of what I am doing:

node 'something' inherits  env_prod {
       $mode = "PROD"
}

then I use the following in a class:

class hosts {
       file {"hosts":
                        path => "/etc/hosts",
                        owner => "root",
                        group => "root",
                        mode => 644,
                        content =>
template("env/${environment}/${mode}/etc/hosts.erb"),
                        }
}


what is weird is that this use to work perfectly when I did it on RHEL5.5
with puppet 2.6.

any ideas what I am doing wrong?

Thank you very much


--
Luke Bigum
Information Systems
+44 (0) 20 3192 2520
[email protected] | http://www.lmax.com
LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN


The information in this e-mail and any attachment is confidential and is 
intended only for the named recipient(s). The e-mail may not be disclosed or 
used by any person other than the addressee, nor may it be copied in any way. 
If you are not a named recipient please notify the sender immediately and 
delete any copies of this message. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden. Any view or 
opinions presented are solely those of the author and do not necessarily 
represent those of the company.

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

Reply via email to