Issue #5074 has been updated by Dan Bode.
I missed that ticket, it seems like the implementation required for both use
cases might be the same...
my use case has to do with the ability to share data between modules/classes
(attr_reader in ruby terms) which is pretty critical for the ability to write
plugin-modules:
keep in mind, I have no idea how this fits in with the declarative nature of
the puppet language (which is your concern)
* as a real world example, rails needs to know the real value of mysql socket
for database.yaml
<pre>
class mysql(
$sock = /var/mysql.sock
) {
...
}
</pre>
<pre>
class rails_config::mysql {
$sock = $mysql::socket
}
</pre>
* it would be nice if it could query the 'real value' out of the class
responsible for the data:
* now I can customize it:
<pre>
class { 'mysql':
$sock => '/var/secure/special.sock'
}
</pre>
* and rails automatically is configured to use the new value
I have even crazier longer term use cases that I am envisioning... (which of
coarse need to be well thought out/better articulated)
<pre>
class apache (
$process_name = 'httpd',
$port = '80'
) {
...
}
class nagios {
# search through all clases, return those that have assigned values (and
attr_readers) for process_name, port
$monitorable_array = search_('*', ['process_name', 'port'])
# for everything with a process name and port, we configure something on the
machine to monitor it
port_process_monitor($monitorable_array)
}
</pre>
----------------------------------------
Bug #5074: declaring a parameterized class does not make its enclosed variables
accessible
https://projects.puppetlabs.com/issues/5074
Author: Dan Bode
Status: Re-opened
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version: 2.6.3rc1
Keywords: include class parameterized scope
Branch:
The following code
<pre>
class { 'motd':
override_data => 'override'
}
notice($motd::override_data)
</pre>
results in:
<pre>
warning: Scope(Class[main]): Could not look up qualified variable
'motd::override_data'; class motd has not been evaluated
notice: Scope(Class[main]):
</pre>
I can fix this, by putting an include before I want to use the qualified
variable.
<pre>
class { 'motd':
override_data => 'override'
}
include motd
notice($motd::local_var)
</pre>
<pre>
notice: Scope(Class[main]): override
</pre>
--
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.