Issue #11550 has been updated by R.I. Pienaar.
I think for a user trying to figure out what happens with:
<pre>
class foo {
$baz =1
}
define foo::bar {
notify{$baz: }
}
</pre>
vs
<pre>
class foo {
$baz =1
define foo::bar {
notify{$baz: }
}
}
</pre>
is just going to cause frustration assuming we do decide to do this - cos
hopefully the idea is that these 2 cases were identical?
----------------------------------------
Bug #11550: define within a class doesn't use the class's scope
https://projects.puppetlabs.com/issues/11550
Author: Daniel Grace
Status: Needs Decision
Priority: Normal
Assignee: Randall Hansen
Category: language
Target version:
Affected Puppet version: 2.7.9
Keywords: class define template scope
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.