Bug #3758

node inheritance locks scope

Added by Kjetil Torgrim Homme about 2 years ago. Updated 4 months ago.

Status:Accepted Start date:05/12/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:parser
Target version:-
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

when a resource is defined via a class included in a parent node, the scope seems to get fixed, and later overrides will not use the most recent scope.

class foo {

file { "/tmp/blub": }

} class foo::overrides inherits foo {

File["/tmp/blub"] {
    source => "puppet:///foo.$var"
}

} node base_node {

include foo

} node ‘feh’ inherits base_node {

$var = "testing"
include foo::overrides

}

“feh” is the name of my workstation. when I run the above code, it complains about the file “foo.” missing. if I move “include foo” into the feh node, I get the expected error about “foo.testing” missing. setting $var in base_node before “include foo” also works.

History

Updated by James Turnbull almost 2 years ago

  • Category set to parser
  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Luke Kanies

I think this is normal behaviour?

Updated by Luke Kanies almost 2 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from Luke Kanies to Markus Roberts

This looks like a scoping bug or something to me. Markus?

Updated by Kjetil Torgrim Homme over 1 year ago

I think this is essentially a dup of #4748 (or vice versa).

Updated by Joshua Lifton 5 months ago

  • Assignee deleted (Markus Roberts)

This issue was assigned to a former Puppet Labs employee. Adding back to the pool of unreviewed issues.

Updated by Joshua Lifton 5 months ago

This issue was assigned to a former Puppet Labs employee. Adding back to the pool of unreviewed issues.

Updated by Ben Hughes 4 months ago

  • Description updated (diff)
  • Status changed from Accepted to Unreviewed

Updated by Jeff Weiss 4 months ago

The problem as reported still does not work.

When moving the include of foo into the specific node, then apply complains about the deprecation of dynamic lookup and suggests using parameterized classes.

Altering to use parameterized classes, yields to expected behaviour.

class foo {
file { "/tmp/blub": }
}
class foo::overrides ($var) inherits foo {
File["/tmp/blub"] {
source => "/tmp/foo.$var"
}
}
node base_node {
include foo
}
node 'macbook-pro' inherits base_node {
class {'foo::overrides':
var => 'testing',
}
}

Updated by Jeff Weiss 4 months ago

  • Description updated (diff)
  • Status changed from Unreviewed to Accepted

Also available in: Atom PDF