Issue #3490 has been updated by Jordan Sissel.

i cannot reproduce this on puppet master 
(0f8747f37650523d3deca75f5091feeef1b238cb) and 


    snapple(~) !1! % puppet --version
    2.7.9
    snapple(~) % puppet apply -e 'if defined(Class["splunk4::client"]) { 
notice("Found") } else { notice("Not found") }'
    notice: Scope(Class[main]): Not found
    notice: Finished catalog run in 0.03 seconds

----------------------------------------
Bug #3490: Defined() requires the class to exist when used in an if statement
https://projects.puppetlabs.com/issues/3490

Author: Ashley Penney
Status: Accepted
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.

Reply via email to