mitchellh / vagrant-rackspace

Use Vagrant to manage Rackspace Cloud instances.
MIT License
236 stars 155 forks source link

uninitialized constant Vagrant::VM #81

Closed mvrueden closed 10 years ago

mvrueden commented 10 years ago

Hey guys,

when I have installed the vagrant-rackspace plugin I always get a "uninitialized constant Vagrant::VM" exception.

It is not only plugin related. Vagrant is not working at all with that plugin. Only uninstalling the plugin works.

   .....
Here is a snippiet of the debug output "vagrant --debug"
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/kernel_v1/ plugin.rb
INFO manager: Registered plugin: kernel
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/communicators/ssh/plugin.rb
INFO manager: Registered plugin: ssh communicator
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/kernel_v2/ plugin.rb
INFO manager: Registered plugin: kernel
INFO global: Loading plugins!
INFO manager: Registered plugin: vagrant-login
INFO manager: Registered plugin: vagrant-share
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::PluginLoadError: The plugins failed to load properly. The error   message given is shown below.

uninitialized constant Vagrant::VM>
ERROR vagrant: The plugins failed to load properly. The error message given is shown below.

uninitialized constant Vagrant::VM
ERROR vagrant: /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant.rb:264:in `rescue in <top  (required)>'
/opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant.rb:260:in `<top (required)>'
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.1/bin/vagrant:95:in `require'
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.5.1/bin/vagrant:95:in `<main>'
Vagrant failed to initialize at a very early stage:
     The plugins failed to load properly. The error message given is shown below.
   uninitialized constant Vagrant::VM

Vagrant version: 1.5.1

Installed plugins:

vagrant-aws (0.0.1)
vagrant-login (1.0.1, system)
vagrant-rackspace (0.1.7)
vagrant-share (1.0.1, system)

Any ideas?

Edit: It seems that the vagrant-rackspace and vagrant-aws plugins have an affect on each other. If I uninstall the vagrant-aws plugin the rackspace one is working.

krames commented 10 years ago

Thanks for reporting the issue!

It looks like you have a very old version of vagrant-aws. Can you try re-installing that plugin for me and report back on the version number?

mvrueden commented 10 years ago

Hey krames,

thanks for your response.

I did as you asked, the problem is still there, but I noticed a weired log output.

I installed both plugins from scratch, the output is as follows:

Installing the 'vagrant-aws' plugin. This can take a few minutes...
Installed the plugin 'vagrant-aws (0.4.1)'!
Installing the 'vagrant-rackspace' plugin. This can take a few minutes...
Installed the plugin 'vagrant-rackspace (0.1.7)'!

But the output from vagrant plugin list is:

vagrant-aws (0.0.1)
vagrant-login (1.0.1, system)
vagrant-rackspace (0.1.7)
vagrant-share (1.0.1, system)

I do not know if it is related.

Thanks and kind regards

Markus

krames commented 10 years ago

@mvrueden Are you still experiencing the same issues now that you have upgraded your plugins?

maxlinc commented 10 years ago

Hi @mvrueden,

I was able to reproduce at first, but I can't anymore. I think how vagrant handles this conflict depends on what plugins were previously installed, and in what order. Try vagrant plugin update, or installing in the opposite order. If you're lucky, that might work around the conflict, but I'm not sure.

I was able to reproduce the behavior where vagrant downgraded vagrant-aws to 0.0.1, which then causes the PluginLoadError. I believe this is partly because vagrant-aws is too strict about the version of fog they require. I opened https://github.com/mitchellh/vagrant-aws/pull/216 for them to relax their constraint.

The fact that it downgraded vagrant-aws (rather than downgrading fog) is also odd, and possibly something that needs to be fixed in vagrant core. Unfortunately, all of this is outside of vagrant-rackspace, so I don't think there's much we can do.

If you need both plugins in the same project, then the best workaround might be to follow the instructions about how you deal with dependencies for vagrant plugin development. However, that can get confusing when you switch back and forth from plugin development to running vagrant normally. If you don't need vagrant-aws, or if you don't need it in the same project, then I recommend going back and forth between plugin development and normal vagrant usage can get confusing (you may need to uninstall the vagrant gem or change your PATH variable).

If you don't need both plugins at the same time, or want to wait for a more permanent fix, then the best workaround may be to simply use one plugin at a time - uninstalling the plugin you aren't currently using.

mvrueden commented 10 years ago

Hi @maxlinc,

Thank you for your help. I do not need both plugins at the same time, it would just make my life easier if I could ;)

But for now I will - as you already suggested - install/uninstall the plugins as I go.

maxlinc commented 10 years ago

@smashwilson I think we can close this now. @mvrueden was able to workaround by uninstalling/reinstalling, and vagrant-aws has released https://github.com/mitchellh/vagrant-aws/pull/216 to use semver, hopefully preventing future conflicts.

I also recommended they yank vagrant-aws 0.0.1 but that's beyond our control.

smashwilson commented 10 years ago

@maxlinc :thumbsup: On it.