Issue #4748 has been updated by Paul Berry.

Category set to language
Status changed from Unreviewed to Investigating
Assignee set to Paul Berry
Affected version set to development

I believe I've been able to reproduce this behavior.  I ran the example using 
the latest code from "next" and got this output:
<pre>
notice: undef
notice: /Stage[main]/Foo/Notify[undef]/message: defined 'message' as 'undef'
</pre>

By contrast, if I commented out the line "include base", I got this:
<pre>
notice: /Stage[main]/Base/File[/tmp/foo]/ensure: defined content as 
'{md5}0bd6506986ec42e732ffb866d33bb14e'
notice: special
notice: /Stage[main]/Foo/Notify[special]/message: defined 'message' as 'special'
</pre>

At first blush, this sure seems like a bug to me: whether or not class "base" 
is included at top level shouldn't affect the relationship of variables between 
classes "special" and "foo", especially variables that are only mentioned in 
"special" and "foo".

I'll spend some time looking at the code in the next day or so to try to figure 
out what's going on.
----------------------------------------
Bug #4748: Variable scope confusing when including subclasses
http://projects.puppetlabs.com/issues/4748

Author: Felix Frank
Status: Investigating
Priority: Normal
Assignee: Paul Berry
Category: language
Target version: 
Affected version: development
Keywords: variables, scope, inheritance
Branch: 


When including a class that inherits another, variables used only in the 
inheriting class still seem to be scoped to the context of the original include 
of the base class.

<pre>
class base {
    file{"/tmp/foo": content => "base"}
}

class foo inherits base {
    notify{$variable:}
    File["/tmp/foo"] { content => $variable }
}

class special {
    $variable = "special"
    include foo
}

include base
include special
</pre>

With thanks to Volcane for the cleaned up example code.

Reproduced with versions 0.25.5 and 2.6.1rc4.


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