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