Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset some more ruby/gem env-variables before running "puppet" #185

Merged
merged 4 commits into from
Mar 24, 2014

Conversation

njam
Copy link
Contributor

@njam njam commented Mar 12, 2014

Similar to #182 we're experiencing puppet not to run correctly,
because some ruby/gem environment is inherited from vagrant's embedded ruby.

This is happening now that librarian-puppet doesn't depend/use the gem's puppet anymore.

Example error:

/Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find builder-3.2.2 in any of the sources (Bundler::GemNotFound)

@njam
Copy link
Contributor Author

njam commented Mar 12, 2014

@ringods maybe you could have a look as well? Is this legit?
@dlondero fyi

@ringods
Copy link
Contributor

ringods commented Mar 13, 2014

@njam Could you post a full stack trace to your example error? Also, which version of Vagrant are you running? Do you use the vagrant-librarian-puppet plugin?

@njam
Copy link
Contributor Author

njam commented Mar 13, 2014

Yes, using the vagrant-librarian-puppet plugin.
Vagrant version is 1.5.0.
Vagrant plugin gems:

librarian-0.1.2
librarian-puppet-0.9.14
puppet-3.4.3
vagrant-librarian-puppet-0.6.0

Vagrant error output:

Unable to load puppet. Please install it using native packages for your platform (eg .deb, .rpm, .dmg, etc).
puppet --version returned 1

/Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find builder-3.2.2 in any of the sources (Bundler::GemNotFound)
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `map!'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `materialize'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/definition.rb:133:in `specs'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/definition.rb:178:in `specs_for'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/definition.rb:167:in `requested_specs'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/environment.rb:18:in `requested_specs'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/runtime.rb:13:in `setup'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
    from /Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/lib/bundler/setup.rb:17:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Cellar/ruby/2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

exit

With the librarian-puppet-0.9.13 gem I don't have this error. I think it previously used the puppet-executable from the "puppet"-gem. Now it seems to be using the executable on the system's path.

The inherited gem/ruby environment breaks the system's "puppet" (which is installed with "gem" as well).

@ringods
Copy link
Contributor

ringods commented Mar 13, 2014

@njam Your environment is not "clean". The stack trace shows a mix of a Homebrew installed ruby (/usr/local/Cellar/ruby/...) with the Vagrant embedded gems. I think you will have to fix that first. Vagrant should use it's own embedded ruby.

@njam
Copy link
Contributor Author

njam commented Mar 13, 2014

@ringods This stack trace is the output of the puppet --version call that librarian-puppet does!
The problem is that the system's puppet (installed with gem) inherits from vagrant gem's environment. Therefore the mix up.
Running puppet --version from my usual environment works just fine.
Cleaning up these additional environment variables before executing the external puppet works and seems reasonable therefore.
What do you think?

@ringods
Copy link
Contributor

ringods commented Mar 13, 2014

@njam Regarding the environment variables, maybe it is time to switch the approach: instead of removing the variables we don't need, start with an empty hash and only add the ones we do need, e.g. PATH

Regarding your stack trace: I still think that your error stems from the mix up. You mention a system's puppet installed via gem. Puppetlabs advises system packages over RubyGems. When testing librarian-puppet standalone, I have a completely separate RVM+gemset with all the required gems in it, without pointing to Vagrant gems.

@njam
Copy link
Contributor Author

njam commented Mar 13, 2014

So I think the actual root cause for this was the inheriting of the "bundler" configuration! I adjusted the changeset accordingly.
To reproduce I can run something like:

BUNDLE_APP_CONFIG=/var/folders/... BUNDLE_CONFIG=/var/folders/... BUNDLE_GEMFILE=/var/folders/..... BUNDLE_BIN_PATH=/Applications/Vagrant/embedded/gems/gems/bundler-1.5.3/bin/bundle puppet --version

I understand the suggested way of installing puppet is with the provided packages. Unfortunately there's no simple installation via brew or brew cask, that's why I'm sticking with gem for now. I think for running puppet --version it should be sufficient :D

I thought about resetting the whole environment as well. But this can have undesired side effects as well. For example somebody might need some env variables for his system to behave correctly.

@njam
Copy link
Contributor Author

njam commented Mar 14, 2014

@carlossg @ringods do you think this is mergeable?
It will fix running librarian-puppet within vagrant when puppet is installed with rubygems.

I can see a travis build for puppet "3.3.2" failing, where the puppet process dies with "killed thread". Do you have an idea why this is happening / who is killing the thread?

@njam
Copy link
Contributor Author

njam commented Mar 19, 2014

@carlossg what do you think about merging this?
The travis build was just a bit flaky.

carlossg added a commit that referenced this pull request Mar 24, 2014
Reset some more ruby/gem env-variables before running "puppet"
@carlossg carlossg merged commit 396eaef into rodjek:master Mar 24, 2014
@carlossg
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants