jantman / vagrant-r10k

UNSUPPORTED - SEEKING MAINTAINER - Vagrant middleware plugin to retrieve puppet modules using r10k.
MIT License
35 stars 12 forks source link

`find_spec_for_exe': can't find gem puppet (>= 0.a) (Gem::GemNotFoundException) #43

Closed Falkor closed 6 years ago

Falkor commented 6 years ago

I have installed the vagrant-r10k plugin, together with the puppet gem as suggested:

$> vagrant --version 
Vagrant 2.0.4
$> vagrant plugin list  
oscar (0.5.3)
puppet (5.5.1)
terminal-table (1.8.0)
vagrant-cachier (1.2.1)
vagrant-hosts (2.8.0)
vagrant-r10k (0.4.1)
vagrant-triggers (0.5.3)
vagrant-vbguest (0.15.1)

The project I'm using (relying on RVM and Gemset) has the following structure:

.
├── Gemfile
├── Gemfile.lock
├── Makefile
├── README.md
├── VERSION
├── Vagrantfile
├── puppet
│   ├── Puppetfile
│   ├── manifests
│   │   └── default.pp
│   └── modules
└── vagrant

The puppet/Puppetfile has the following content:

forge "https://forgeapi.puppetlabs.com"

# Officials from Puppetlabs / Puppet
mod 'puppetlabs/apache',              :latest
mod 'puppetlabs/git',                 :latest
mod "puppetlabs/vcsrepo",             :latest

Finally, the configuration for vagrant-r10k in the root Vagrantfile is as follows:

  # Puppet R10K configuration (from vagrant-r10k plugin)
  config.r10k.puppet_dir      = 'puppet'
  config.r10k.puppetfile_path = "puppet/Puppetfile"
  config.r10k.module_path     = 'puppet/modules'

Now if I invoke vagrant {up,provision}, I get the following error:

==> default: vagrant-r10k: Beginning r10k deploy of puppet modules into /path/to/project/puppet/modules using /path/to/project/puppet/Puppetfile
INFO     -> Loading modules from Puppetfile into queue
INFO     -> Deploying vcsrepo into /path/to/project/puppet/modules
ERROR    -> Task #<R10K::Task::Module::Sync:0x0000000100f3a4e8> failed while running: Command exited with non-zero exit code:
Command: puppet module --modulepath /path/to/project/puppet/modules --color false install --version=2.3.0 --force puppetlabs/vcsrepo
Stderr:
/opt/vagrant/embedded/lib/ruby/2.4.0/rubygems.rb:271:in `find_spec_for_exe': can't find gem puppet (>= 0.a) (Gem::GemNotFoundException)
    from /opt/vagrant/embedded/lib/ruby/2.4.0/rubygems.rb:299:in `activate_bin_path'
    from $HOME/.rvm/gems/ruby-2.3.4@BSP/bin/puppet:23:in `<main>'
    from $HOME/.rvm/gems/ruby-2.3.4@BSP/bin/ruby_executable_hooks:15:in `eval'
    from$HOME/.rvm/gems/ruby-2.3.4@BSP/bin/ruby_executable_hooks:15:in `<main>'
Exit code: 1
[...]

of course repeated for each module in the Puppetfile. It looks like the gem path to the vagrant plugin is ignored... Any hint?

jantman commented 6 years ago

@Falkor I'm sorry to have to say this, but I have no idea :(

I haven't used this project myself in over 3 years. At a minimum, I can say that the newest versions the automated tests run against are ruby 2.0.0 and Vagrant 1.7.0.

My guess would be that either Vagrant 2, or the Ruby 2.3.4 or 2.4.0 that it now uses broke compatibility with this project.

I feel bad having to say this, but I no longer have the ability or desire to maintain this project. If you happen to know someone who would like to take it over, I'd be more than happy to set that up.

jantman commented 6 years ago

Closing as stale.

ranzbak commented 6 years ago

I managed to get it working with Vagrant 2.1.2 running the following command:

gem install puppet -v 4.10.12 --install-dir ~/.gem/ruby/2.4.0

(I'm still using Puppet 4.10.12, your version of Puppet might be different.) I hope this helps somebody.

ranzbak commented 6 years ago

Also if all else fails, the very dirty workaround I came up with is

# vagrant up 2>&1 | grep 'Command: ' | sed 's/^Command: //' | while read -r line; do sh -c /usr/local/bin/${line}; done

It's very dirty, but when in a bind it's better than copy pasting the command lines.