Issue #12050 has been updated by Henrik Lindberg.

This does not happen in 3.0 The result of applying the script in the provided 
gist is:
<pre>
/Stage[main]/D/Notify[d]/message: defined 'message' as 'd'
/Stage[main]/B/A[define_something]/Exec[A-foo]/returns: executed successfully
</pre>
----------------------------------------
Bug #12050: Use of metaparameters inside defines are incorrectly reported as 
dynamic variable lookups under certain conditions
https://projects.puppetlabs.com/issues/12050#change-73414

Author: Tejas Viswanath
Status: Accepted
Priority: Normal
Assignee: 
Category: parser
Target version: 2.7.x
Affected Puppet version: 2.7.6
Keywords: parser deprecation
Branch: 


Consider this

I have a define:
    define A($x) {
      ...
      if $require {
        SomeResource["name"] { require +> $require }
      }
    }

and later use it in a class:
    class B {
      A { "define_something":
        $x => ...
        # no require specified here
      }
    }

This works fine.

However, if I now use Class B within a Class C, and have a require associated 
with Class B, like:
    Class C {
      class { "D": 
      
      }
      
      class { "B":
        require => Class["D"],
      }
    }

I would see:
    warning: Dynamic lookup of $require at <script that has the define>:<line 
number of if $require> is deprecated.  Support will be removed in Puppet 2.8.  
Use a fully-qualified variable name (e.g., $classname::variable) or 
parameterized classes.

So to summarize:

1. Create a define that uses a metaparameter
1. Use that define in a class. Don't specify that metaparameter here
1. Use this class in another class, while specifying the metaparameter

.. and you'll see this warning.


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