Issue #11550 has been updated by J.D. Welch.

Keywords changed from class define template scope  to class define template 
scope dsl backlog


----------------------------------------
Bug #11550: define within a class doesn't use the class's scope
https://projects.puppetlabs.com/issues/11550#change-74220

Author: Daniel Grace
Status: Needs Decision
Priority: Normal
Assignee: J.D. Welch
Category: language
Target version: 
Affected Puppet version: 2.7.9
Keywords: class define template scope dsl backlog
Branch: 


I'm trying to do something akin to this to initialize several configuration 
files from templates:

<pre>class foo (...) {
    $basedir = '/etc/foo'

    define foofile ( $path = $title) {
        file { "${basedir}/${path}": contents => template($path)
    }

    foofile { ['file1', 'file2'] }
}</pre>

This fails in all sorts of interesting ways:

 * template() will search for the template in the base templates directory, 
rather than modules/foo/templates
 * Puppet 2.7 complains that $basedir is not local and should be fully qualified
 * If I change template($path) to template("foo/${path}"), the template will 
load but again complain about the scope of variables.

If this is not a bug and is by design (quite possible, I'm still very new to 
Puppet), it still seems that it'd be very useful to use defines in this context.


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