On 2012-15-02 24:07, MBroderick@TDS wrote:
We are trying to conditionalize what is required by a resource...
service { "xxx":
...
require => $bool-var ? {
true => [ list1 ],
false => [ list2 ],
}
}
is $bool-var really a boolean, or does it contain the text "true" or
"false"?
Guess what this prints out...
if "false" { notice("false is true") }
(Also note that hyphens in variable names only work in some versions,
and will not be supported going forward. You can change the '-' to '_').
The reason your first example produces undefined is that a string is
neither boolean true nor false when comparing.
The second example produces true for the string (with the meaning it is
not undefined) - it will always be true unless $boolean-var is undefined.
You can try
$boolean-var == "true" ? { true => ..., false => ...}
Regards
- henrik
--
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+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.