According to the documentation at
http://docs.puppetlabs.com/puppet/2.7/reference/lang_conditional.html#if-statements,
you can test for truth with syntax like this:
if $is_virtual == 'true' {
AFAICT that's not the case. The quotes around 'true' make the comparison
always fail. Here's my test case
class users {
define u($managehome=true) {
notice("The value is: ${managehome}") # <== says it's
true
if $managehome == 'true' {
notice("...yes, it is true") # <== not reached
} else{
notice("...no, it is false") # <== this prints
}
}
@u { mytest:
managehome => false,
}
}
include users
realize Users::U[mytest]
and these are the results
$ puppet apply test.pp
notice: Scope(Users::U[mytest]): The value is: true
notice: Scope(Users::U[mytest]): ...no, it is false
Removing the single quotes in the == comparison make the code work as
expected.
This is with 2.7.18. Am I misunderstanding something, or is this a problem
in the documentation?
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.