Issue #4496 has been updated by Jesse Wolfe.

Affected version set to 2.6.0


----------------------------------------
Bug #4496: module_name variable not consistently set
http://projects.puppetlabs.com/issues/4496

Author: Paul Berry
Status: Accepted
Priority: Normal
Assignee: 
Category: 
Target version: 2.6.x
Affected version: 2.6.0
Keywords: 
Branch:  http://github.com/reductivelabs/puppet/tree/next


With this directory structure:

modules/foo/manifests/init.pp:
<pre>
class foo {
  notify {"foo (inside module $module_name)": }
}
class foo::bar {
  notify {"foo::bar (inside module $module_name)": }
}
</pre>

init1.pp:
<pre>
include foo
</pre>

init2.pp:
<pre>
include foo::bar
</pre>

init3.pp:
<pre>
include foo
include foo::bar
</pre>

When running "puppet --modulepath modules init1.pp", we get the output:
<pre>
notice: foo (inside module foo)
notice: /Stage[main]/Foo/Notify[foo (inside module foo)]/message: defined 
'message' as 'foo (inside module foo)'
</pre>

This is expected, since $module_name refers to the name of the module that the 
class "foo" is defined in, namely, "foo".

When running "puppet --modulepath modules init2.pp", we get the output:
<pre>
notice: foo::bar (inside module foo)
notice: /Stage[main]/Foo::Bar/Notify[foo::bar (inside module foo)]/message: 
defined 'message' as 'foo::bar (inside module foo)'
</pre>

Again, this is expected.  The functionality of $module_name doesn't depend on 
whether we are including module foo directly or some subclass defined within it.

However, when running "puppet --modulepath modules init3.pp", we get unexpected 
output:
<pre>
notice: foo::bar (inside module )
notice: /Stage[main]/Foo::Bar/Notify[foo::bar (inside module )]/message: 
defined 'message' as 'foo::bar (inside module )'
notice: foo (inside module foo)
notice: /Stage[main]/Foo/Notify[foo (inside module foo)]/message: defined 
'message' as 'foo (inside module foo)'
</pre>

The reference to $module_name within foo::bar has mysteriously stopped working.

This bug only applies to version 2.6 since the $module_name feature did not 
exist in previous releases.


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