[Puppet - Bug #17616] Package update via Gem provider fails when running Puppet via bundler

2013-02-17 Thread tickets

Issue #17616 has been updated by Josh Nichols.


I ran into  this bug again, in a different context. I took a bit more time to 
dig into it, and found a good place to inject `Bundler.with_clean_env`. I've 
sent two pull requests, one for 2.7.x and  one for 3.0.x. I originally wrote it 
against master, and was able to cherry-pick to 3.0.x, so should apply cleanly 
to 3.1.x too.

* https://github.com/puppetlabs/puppet/pull/1484
* https://github.com/puppetlabs/puppet/pull/1485

The way I was testing on was a small development server, with a Gemfile like:

presource https://rubygems.org;

gem puppet, :path = /path/to/checkout/of/my/fork/pre

Then running:

prebundle install --binstubs
sudo bin/puppet ^Cply --debug -e 'package {foreground: ensure = latest, 
provider = gem}'/pre

Without the patch, it failed with the error Andrew Parker posted. With the 
patch, it installs without error.

Bug #17616: Package update via Gem provider fails when running Puppet via 
bundler
https://projects.puppetlabs.com/issues/17616#change-83384

Author: Björn Albers
Status: Accepted
Priority: Normal
Assignee: 
Category: package
Target version: 
Affected Puppet version: 2.6.10
Keywords: gem, bundler, bundle, package, provider
Branch: 


Given a rubygem / package with dependencies to other package.
When I try do manage that package with Puppet all is fine.
But when I apply the same manifest with Puppet executed via Bundler then I get 
an error (Installing a package w/o dependencies, i.e. rake, works).
To my understanding installing Puppet with bundler is best practice when 
developing  testing modules, so this might have some relevance.
Here's my TPS report:

# Bad:
$ sudo bin/puppet apply --verbose --no-report foreground.pp
info: Applying configuration version '1352903073'
err: /Stage[main]//Package[foreground]/ensure: change from absent to latest 
failed: Could not update: Execution of '/usr/bin/gem install 
--include-dependencies --no-rdoc --no-ri foreground' returned 1: ERROR:  Error 
installing foreground:
foreground requires mixlib-cli (~ 1.2.2)
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
at /Users/bjoern/Documents/puppet-zabbix_osx/foreground.pp:4
notice: Finished catalog run in 78.69 seconds
$ bin/puppet --version
2.7.19

# Good:
$ sudo puppet apply --verbose --no-report foreground.pp 
info: Applying configuration version '1352903176'
notice: Finished catalog run in 3.82 seconds
$ puppet --version
2.7.19

# Context:
$ ruby --version
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
$ bundle --version
Bundler version 1.2.1
$ cat foreground.pp 
package { 'foreground':
  ensure   = latest,
  provider = gem,
}
$ sw_vers 
ProductName:Mac OS X
ProductVersion: 10.7.4
BuildVersion:   11E53
$ gem --version
1.8.24

PS: This might be a bug in bundler / rubygems / whatever, but I think it should 
at least be documented here.


-- 
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 puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet - Bug #17616] Package update via Gem provider fails when running Puppet via bundler

2012-12-06 Thread tickets

Issue #17616 has been updated by Josh Nichols.


I've run into this too. Basically, bundler 'infects' the environment to make 
sure any rubygems things go through bundler, so if the gem isn't in the 
Gemfile, `gem install` won't see it. To get around that, Bundler has a 
`Bundler.with_clean_env` method to run anything inside it's block without those 
environment variables.

I admit it was awhile ago that I tried and I was trying to monkeypatch puppet 
after it was loaded, but I wasn't able to find the right place to put the 
`Bundler.with_clean_env`. Hopefully will take another stab at it soon, but I'm 
thinking the gem provider should be updated to wrap `execute` calls with 
`Bundler.with_clean_env` if the Bundler constant is defined. 

Bug #17616: Package update via Gem provider fails when running Puppet via 
bundler
https://projects.puppetlabs.com/issues/17616#change-78360

Author: Björn Albers
Status: Accepted
Priority: Normal
Assignee: 
Category: package
Target version: 
Affected Puppet version: 2.6.10
Keywords: gem, bundler, bundle, package, provider
Branch: 


Given a rubygem / package with dependencies to other package.
When I try do manage that package with Puppet all is fine.
But when I apply the same manifest with Puppet executed via Bundler then I get 
an error (Installing a package w/o dependencies, i.e. rake, works).
To my understanding installing Puppet with bundler is best practice when 
developing  testing modules, so this might have some relevance.
Here's my TPS report:

# Bad:
$ sudo bin/puppet apply --verbose --no-report foreground.pp
info: Applying configuration version '1352903073'
err: /Stage[main]//Package[foreground]/ensure: change from absent to latest 
failed: Could not update: Execution of '/usr/bin/gem install 
--include-dependencies --no-rdoc --no-ri foreground' returned 1: ERROR:  Error 
installing foreground:
foreground requires mixlib-cli (~ 1.2.2)
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
at /Users/bjoern/Documents/puppet-zabbix_osx/foreground.pp:4
notice: Finished catalog run in 78.69 seconds
$ bin/puppet --version
2.7.19

# Good:
$ sudo puppet apply --verbose --no-report foreground.pp 
info: Applying configuration version '1352903176'
notice: Finished catalog run in 3.82 seconds
$ puppet --version
2.7.19

# Context:
$ ruby --version
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
$ bundle --version
Bundler version 1.2.1
$ cat foreground.pp 
package { 'foreground':
  ensure   = latest,
  provider = gem,
}
$ sw_vers 
ProductName:Mac OS X
ProductVersion: 10.7.4
BuildVersion:   11E53
$ gem --version
1.8.24

PS: This might be a bug in bundler / rubygems / whatever, but I think it should 
at least be documented here.


-- 
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 puppet-bugs@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-bugs+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.