Issue #12479 has been updated by Nicolas Simonds.
Where this gets us in trouble is cases like:
case $schrodingers_fact {
/\w/: {
notice("fact is set. hooray!")
}
default: {
notice("fact is not set. set it")
$schrodingers_fact = retrieve_fact_via_carrier_pigeon()
}
}
...because now Puppet seems to think the fact doesn't need to be set, when it
does. This idiom worked swimmingly in Puppet 0.25.x, and seems to have stopped
working in the 2.6.x vintage.
----------------------------------------
Bug #12479: Regression: Regex matching against non-existant facts results in
false-positive
https://projects.puppetlabs.com/issues/12479
Author: Nicolas Simonds
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version:
Keywords:
Branch:
Non-existant facts are stringify-ing under the hood as something, which causes
them to match regexes, despite returning nil when otherwise asked.
A simple bash script to test:
----
#!/bin/bash
for LOLWUT in {a..z}
do
cat <<- EOF > /tmp/test.pp
case \$wtf {
/$LOLWUT/: {
notice("The fact[\$wtf] matches the regex /$LOLWUT/")
}
default: {
notice("The fact[\$wtf] does NOT match the regex
/$LOLWUT/")
}
}
notice(\$facility)
EOF
puppet apply /tmp/test.pp
done
----
Expected result:
All notices that the non-existant fact doesn't match.
Actual result:
Various and sundry notices that it matched. BAD PUPPET! NO COOKIE!
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" 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-bugs?hl=en.