Issue #20894 has been updated by Charlie Sharpsteen.

Status changed from Unreviewed to Rejected
Assignee set to Charlie Sharpsteen

Looks like you are running into scoping issues here. In your puppetmaster logs, 
you may see warning messages similar to the following:

<pre>
May 29 20:34:06 localhost puppet-master[6467]: (Scope(Class[Vm_php::Java])) 
Could not look up qualified variable 'vm_php::params::jdk_version'; class 
vm_php::params has not been evaluated
May 29 20:34:06 localhost puppet-master[6467]: (Scope(Class[Vm_php::Java])) 
Could not look up qualified variable 'vm_php::params::jdk_rpm_url'; class 
vm_php::params has not been evaluated
May 29 20:34:06 localhost puppet-master[6467]: (Scope(Class[Vm_php::Java])) 
Could not look up qualified variable 'vm_php::params::jdk_rpm_version'; class 
vm_php::params has not been evaluated
</pre>

In Puppet 3, classes only have access to variables from three places:

  - Top Scope, where things like Facter Facts are defined

  - Node Scope, where info from `site.pp` is defined

  - Variables declared in any parent class that your class inherits from.

For complete information, see the [documentation on scoping 
rules](http://docs.puppetlabs.com/puppet/3/reference/lang_scope.html) and how 
[scoping rules have changed from Puppet 
2.7.x](http://docs.puppetlabs.com/guides/scope_and_puppet.html). Our [guide on 
parameterized 
classes](http://docs.puppetlabs.com/guides/parameterized_classes.html#appendix-smart-parameter-defaults)
 contains a good example of what to do in this situation.

Hope that helps!

----------------------------------------
Bug #20894: Weird behaviour with out-of-scope variables  and puppet server
https://projects.puppetlabs.com/issues/20894#change-91778

* Author: Jean-Sébastien Hedde
* Status: Rejected
* Priority: Normal
* Assignee: Charlie Sharpsteen
* Category: 
* Target version: 
* Affected Puppet version: 3.1.1
* Keywords: 
* Branch: 
----------------------------------------
Hi,

I have a strange problem with my puppet module.

In this module, every manifests use variables defined in a params.pp.

It has worked well but now in new manifest variable stay undef.

Some snippets :

# java.pp
<pre><code class="ruby">
class vm_php::java ($jdkversion = $vm_php::params::jdk_version) {
  package { $vm_php::params::jdk_rpm_version:
    ensure   => present,
    provider => rpm,
    source   => $vm_php::params::jdk_rpm_url
  }
[...]
}
</code></pre>
# params.pp
<pre><code class="ruby">
class vm_php::params {
[...]
  $jdk_version     = '1.7.0'
  $jdk_rpm_version = "jdk-${jdk_version}-fcs.x86_64"
  $jdk_rpm_url     = 
'http://rpm.prod.lan/centos/6/os/x86_64/jdk-7-linux-x64.rpm'
[...]
}</code></pre>

Ouput of puppet agent --test --noop :
<pre>
Notice: /Stage[main]/Vm_php::Java/Package[undef]/ensure: current_value absent, 
should be present (noop)
</pre>

# Versions
* CentOS release 6.3 (Final)
* puppet : 3.1.1
* puppet-dashboard : 1.2.23
* puppet-server : 3.1.1
* ruby : 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to