Bug #11584

Nested defines using higher level variables should fail to compile instead of throwing a scope warning.

Added by Trevor Vaughan 5 months ago. Updated 5 months ago.

Status:Needs Decision Start date:12/28/2011
Priority:Normal Due date:
Assignee:Randall Hansen % Done:

0%

Category:-
Target version:-
Affected Puppet version:2.7.6 Branch:
Keywords:
Votes: 0

Description

In pre-2.6 versions of Puppet, the following code worked:

define test1::def1 (
  $var1 = 'foo',
  $var2 = 'bar'
) {
  test2::def2 { 'test':
    var3 => $var1
  }
}

define test2::def2 (
  $var3
) {
  notify { "Var1 is $var1": }
  notify { "Var2 is $var2": }
  notify { "Var3 is $var3": }
}

test1::def1 { 'test': }

However, Puppet >= 2.6 gives a scope warning on the $var1 and $var2 variables being used in test2::def2.

Since there is no way to know the calling scope from within the Puppet code, this should be a compile failure instead of a scope warning.

History

Updated by Daniel Pittman 5 months ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Randall Hansen

I agree with Trevor; Randall, are you happy with that?

Also available in: Atom PDF