On Tue, May 24, 2011 at 9:46 AM, Chip Schweiss <[email protected]> wrote:
> The pre classes are definately getting defined before the variable is being
> declared in my node definition:
>
> node 'deploy.nrg.mir' {
>     $deployment = true
>     $deploy_environment = "development"
>     $deploy_hostname = "testhost"
>     $deploy_fqdn = "testhost.nrg.mir"
>     $deploy_netadapters = "2"
>
>     notify { "node:deploy":
>         message => "deploy_fqdn: $deploy_fqdn"
>     }
>
>     include baseclass
>     include deploy
> }
>
> In my site.pp:
>
> ....lines deleted...
>
> import "templates.pp"
> import "nodes/*"
> import "classes/*"
> import "os/*"
> import "common"
>
> stage { [pre, post]: }
> Stage[pre] -> Stage[main] -> Stage[post]
>
> class {
>     "network": stage => pre;
>     "pre_baseclass": stage => pre;
>     "postclass": stage=> post;
> }
>
> In my network class I want to use deploy_* variables defined in the node.
> I not sure how to get puppet to always load the node definition before all
> other classes.  Almost seems like a bug.

Well it's not a bug, your variables are nested in node scope and it's
not available because the class is declared in top scope. You
effectively are doing:

node sample {
  $var = 'value'
}
class { 'network': }

Declare the class in the node scope and you should have access to $var.

node sample {
  $var = 'value'
  class { 'network': }
}

Another options is to access the variable with it's explicit scope $sample::var.

Thanks,

Nan

-- 
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