Issue #17799 has been updated by Henrik Lindberg.

Affected Puppet version changed from 2.7.12 to 3.0.2

The behavior that references are relative unless they start with "::" is 
correct and expected.
In 3.0, the lookup is should be made in a relative fashion in the current 
scope, and then it is tried as an absolute (as if it started with '::').

In the given example, I would not expect the global $package variable (i.e. 
$::package) to be dereferenced by $mysql_server::package, since they do not 
share the parent 'mysql_server'. 

I tried the example on 3.0.2 (actually a bit more recent than what is 
released), and the behavior can be seen there as well. What happens is that 
since there is not $package defined in mysql_server at the point where mysql is 
realized (when it is included), the logic then wrongly strips off the name of 
the context (as if this was an internal lookup of $package from within the 
mysql_server class).

if this is changed:
<pre>
class mysql_server {
  include mysql
  $package = 'mysql-server'
}
<pre>
to instead do this:
<pre>
class mysql_server {
  $package = 'mysql-server'
  include mysql
}
<pre>
Then it will pick up the expected 'mysql-server' package name.

I changed the affected version to 3.0.2 as the behavior is still there.

----------------------------------------
Bug #17799: Scope problem in 2.7.12 (PE 2.5.3)
https://projects.puppetlabs.com/issues/17799#change-79738

Author: Walter Heck
Status: Needs Decision
Priority: Normal
Assignee: Henrik Lindberg
Category: language
Target version: 
Affected Puppet version: 3.0.2
Keywords: 
Branch: 


Copy-paste from the mailing list:
<pre>
I was playing around with scopes, and I noticed the following
behaviour, which strikes me as odd? This was done with Puppet
Enterprise 2.5.3 which is really Puppet 2.7.12.
I'm not sure what I would expect, quite likely an error message or at
the very least 'mysql-server' package gettign installed. Instead, it
just seems to choose the top-scope variable 'mysql'

$package = 'mysql'

class mysql {
  package { $mysql_server::package:
    ensure => present
  }
}

class mysql_server {
  include mysql
  $package = 'mysql-server'
}

include mysql_server


This yields:
[root@master test]# puppet apply manifests/init.pp
notice: /Stage[main]/Mysql/Package[mysql]/ensure: created
notice: Finished catalog run in 6.25 seconds
</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.

Reply via email to