I don''t know what I m doing wrong, but I ca''t get this to
work.
I want some nodes to explicitly set a variable $x, and other nodes
to get a default value.  I want to calculate another variable $y
in a different way depending on whether or not $x is set.
## site.pp:
node default {
    $x = "x set in node"
    import "defs.pp"
    notify { "in node: x=\"$x\" y=\"$y\"": }
}
## defs.pp:
if $x != "" {
    notify { "in defs.pp: x WAS ALREADY defined": }
    $y = "y derived from x in defs.pp"
} else {
    notify { "in defs.pp: x WAS NOT defined": }
    $x = "x default set in defs.pp"
    $y = "y default set in defs.pp"
}
notify { "in defs.pp: x=\"$x\" y=\"$y\"": }
## command line:
puppet ./site.pp
## output:
notice: in defs.pp: x WAS NOT defined
notice: //Notify[in defs.pp: x WAS NOT defined]/message: defined
''message'' as
''in defs.pp: x WAS NOT defined''
notice: in defs.pp: x="x default set in defs.pp" y="y default set
in defs.pp"
notice: //Notify[in defs.pp: x="x default set in defs.pp" y="y
default set in
defs.pp"]/message: defined ''message'' as ''in
defs.pp: x="x default set in
defs.pp" y="y default set in defs.pp"''
notice: in node: x="x set in node" y="y default set in
defs.pp"
notice: //Node[default]/Notify[in node: x="x set in node" y="y
default set in
defs.pp"]/message: defined ''message'' as ''in
node: x="x set in node" y="y
default set in defs.pp"''
Why is it seeing $x as undefined, and taking the wrong branch of
the if statement in defs.pp?  What can I do differently to make it
do what I want?
If I replace the ''import "defs.pp"'' with an actual
copy of defs.pp,
then it works, but I don''t want to do that, because it doesn''t
scale.  I don''t particularly want to move the logic to extlookup()
or an external node classifier.
--apb (Alan Barrett)
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.