Issue #3490 has been updated by Jordan Sissel.
Status changed from Accepted to Closed
Confirmed. This was fixed in 2.6.0 (broken in previous release, 0.25.6)
% git checkout 0.25.6; RUBYLIB=lib ruby bin/puppet apply -e
'notice(defined(Class["hello::world"])) if defined(Class["hello::world"]) {
notice("Found") } else { notice("Not found") }'
HEAD is now at e34a531... Updated CHANGELOG for 0.25.6
Could not find class hello::world at line 1 on node snapple.home
% git checkout 2.6.0; RUBYLIB=lib ruby bin/puppet apply -e
'notice(defined(Class["hello::world"])) if defined(Class["hello::world"]) {
notice("Found") } else { notice("Not found") }'
HEAD is now at db0b30d... Updated CHANGELOG for 2.6.0
notice: Scope(Class[main]): false
notice: Scope(Class[main]): Not found
----------------------------------------
Bug #3490: Defined() requires the class to exist when used in an if statement
https://projects.puppetlabs.com/issues/3490
Author: Ashley Penney
Status: Closed
Priority: Low
Assignee:
Category: functions
Target version:
Affected Puppet version: 0.25.4
Keywords: defined function
Branch:
This may not be a bug, but it should be documented perhaps as it was surprising
to me. While doing some testing if a new module I pushed the following snippet
to my production modules:
if defined(Class["splunk4::client"]) {
stuff here
}
This then failed when nodes checked in with:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could
not find class splunk4::client at
/etc/puppet/modules/production/rhythmyx/manifests/init.pp:20 on node
hlstestper1.law.harvard.edu
because the splunk4 module wasn't in production. Simply moving it into the
production environment (and including it nowhere) was enough to get it working
which was unexpected. I would expect in an if statment that it would simply
ignore any errors from defined and skip the block, not crash and burn.
--
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.