Issue #18755 has been updated by Josh Cooper.

The issue I was seeing (about calling nil.exists? when there is no default 
user/group provider) is a different issue, and I'll file a ticket for that.

I am able to reproduce Ashley's issue when using rubygems >= 1.8 and when I 
have puppet versions 3.1.0.rc1 and 3.0.2 installed as gems. The problem is that 
the autoloader search path includes both versions of gems, with the older 
version coming first:

<pre>
# /usr/local/bin/ruby18 -rubygems -e "require 'puppet'; puts 
Puppet::Util::Autoload.search_directories"  | grep "\/puppet-"
/usr/local/lib/ruby/gems/1.8/gems/puppet-3.0.2/lib
/usr/local/lib/ruby/gems/1.8/gems/puppet-3.1.0.rc1/lib
</pre>

Under rubygems 1.8, the autoloader calls `Gem::Specification.latest_specs` to 
get the list of gems from which code can be loaded. However, this method by 
default excludes prerelease gems. As a result, the `Autoloader.gem_directories` 
method includes the old version 3.0.2.

But as soon as puppet itself is required, e.g. CommandLine, rubygems adds the 
prerelease puppet gem to the $LOAD_PATH:

<pre>
# /usr/local/bin/ruby18 -rubygems -e "require 'puppet'; puts $:"           
/usr/local/lib/ruby/gems/1.8/gems/facter-1.6.17/lib
/usr/local/lib/ruby/gems/1.8/gems/puppet-3.1.0.rc1/lib
/usr/local/lib/ruby/gems/1.8/gems/iconv-0.1/lib
</pre>

Resulting in multiple puppet versions (since the autoloader combines 
`[gem_directories, module_directories(env), libdirs, $LOAD_PATH]`

We need to call `Gem::Specification.latest_specs(true)` so that prerelease gems 
are included, which matches the behavior if one was to just do `require 
'puppet'`.

When using rubygem versions < 1.8, this is not a problem, because we call the 
`Gem.latest_load_paths` method which always includes prerelease gems:

<pre>
# gem --version
1.3.7
# ruby -rubygems -e "puts Gem.latest_load_paths" | grep puppet
/var/lib/gems/1.8/gems/puppet-3.1.0.rc1.67/lib
# gem list puppet
puppet (3.1.0.rc1.67, 3.0.2, 3.0.0)
</pre>
----------------------------------------
Bug #18755: Puppet apply completely broken in 3.1rc1
https://projects.puppetlabs.com/issues/18755#change-81572

Author: Ashley Penney
Status: Accepted
Priority: High
Assignee: Ashley Penney
Category: 
Target version: 3.1.0
Affected Puppet version: 3.1.0-rc1
Keywords: 
Branch: 


I recently installed 3.1 (via a gem) to fix the rspec testing issues but 
discovered a new problem:

<pre>
[root@arch manifests]# puppet apply test.pp 
Could not retrieve macaddress: undefined method `each_line' for nil:NilClass
Could not retrieve macaddress: undefined method `each_line' for nil:NilClass
Could not retrieve macaddress: undefined method `each_line' for nil:NilClass
Could not retrieve ipaddress6: undefined method `scan' for nil:NilClass
Error: Could not create resources for managing Puppet's files and directories 
in sections [:main, :ssl, :agent]: undefined method `exists?' for 
Group[puppet]:Puppet::Type::Group
Error: Could not create resources for managing Puppet's files and directories 
in sections [:main, :ssl, :agent]: undefined method `exists?' for 
Group[puppet]:Puppet::Type::Group
undefined method `exists?' for Group[puppet]:Puppet::Type::Group
</pre>

As soon as I revert to 3.0.2 this works again.

test.pp is just a quick call to a single define:

<pre>
json::add_file { 'env.json': }
</pre>

My puppet.conf:

<pre>
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
environment = production
pluginsync = true
modulepath=/home/apenney/git/configuration/modules

[master]
modulepath=/home/apenney/git/configuration/modules

[agent]
modulepath=/home/apenney/git/configuration/modules
</pre>

/etc/group entry:

<pre>
puppet:x:1000:
</pre>

/etc/passwd:

<pre>
puppet:x:1001:1000::/var/lib/puppet:/bin/false
</pre>

This is using ruby 1.9.3p374 on arch linux.  I set the priority as high only 
because this seems a fairly large change in behavior that might have slipped 
through the cracks and will upset users! :)  If there's any other info I can 
get for you just let me know.


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