Issue #4522 has been updated by James Turnbull.

Status changed from Unreviewed to Accepted


----------------------------------------
Bug #4522: Classes, defines, and nodes inside conditionals always take effect
http://projects.puppetlabs.com/issues/4522

Author: Paul Berry
Status: Accepted
Priority: Normal
Assigned to: Paul Berry
Category: 
Target version: 
Affected version: 2.6.1rc1
Keywords: 
Branch: 


The following manifest:
<pre>
if true {
  class foo {
    notify {"truth": }
  }
  notify {"beauty": }
} else {
  class foo {
    notify {"falsehood": }
  }
  notify {"ugliness": }
}
include foo
</pre>

Produces this output:
<pre>
notice: falsehood
notice: //foo/Notify[falsehood]/message: defined 'message' as 'falsehood'
notice: beauty
notice: //Notify[beauty]/message: defined 'message' as 'beauty'
notice: truth
notice: //foo/Notify[truth]/message: defined 'message' as 'truth'
</pre>

(Note: the "beauty" and "ugliness" notify statements are to work around issue 
#4521)

The "falsehood" message is unexpected, since it is declared inside a 
conditional that isn't being executed.

Looking through the code, the problem appears to apply to classes, defines, and 
nodes.  These three types of language constructs always take effect, regardless 
of where they appear in a source file.

A possible fix would be to issue an error (or perhaps a warning) if the user 
tried to put a class, define, or node inside a conditional language construct.

This behavior exists in both 2.6.x and 0.25.x.



-- 
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