Using a VMware provider during plugin development

1,347 views
Skip to first unread message

Jimmy Cuadra

unread,
Jan 15, 2014, 2:41:11 AM1/15/14
to vagra...@googlegroups.com
Hello Vagrant users,

When developing a Vagrant plugin, how do you get Vagrant to recognize a VMware provider plugin? I'm trying to test my plugin with vagrant-vmware-fusion and not sure how to do it. If I run `bundle exec vagrant plugin install vagrant-vmware-fusion`, I get an error message saying that the `vagrant plugin` command can't be run in a Bundler environment. If I add the provider plugin to my Gemfile, then running a `vagrant` command results in the error message, "The provider 'vmware_fusion' could not be found, but was requested to back the machine 'default'. Please use a provider that exists." If I add `Vagrant.require_plugin "vagrant-vmware-fusion"` to the Vagrantfile, then running a `vagrant` command results in the error message, "Vagrant failed to initialize at a very early stage: Failed to load the "vagrant-vmware-fusion" plugin. View logs for more details." Wat do? Thanks in advance.

Jimmy

Jimmy Cuadra

unread,
Jan 15, 2014, 2:52:52 AM1/15/14
to vagra...@googlegroups.com
I looked at the logs, as it suggests, and found this:

ERROR root: Failed to load plugin: vagrant-vmware-fusion
ERROR root:  -- Error: #<RuntimeError: The Vagrant VMware Fusion provider can be purchased from http://www.vagrantup.com/vmware.>

How do I register my plugin license if I can't use `vagrant plugin` in development?

Jimmy Cuadra

unread,
Jan 15, 2014, 3:13:34 AM1/15/14
to vagra...@googlegroups.com
I realized Gemfile.lock had the vagrant gem pinned at an old SHA. I updated it to the current master and now I am able to use `vagrant plugin install`. However, Vagrant.require_plugin is now deprecated. I tried changing those calls to just use `require`, but I get this error:

Vagrant appears to be running in a Bundler environment. Plugins
will not be loaded and plugin commands are disabled.

Vagrant failed to initialize at a very early stage:

There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: /redacted//Vagrantfile
Message: Encoded files can't be read outside of the Vagrant installer.

What's the current approach for loading plugins in development? 

Cassiano Leal

unread,
Jan 15, 2014, 3:48:48 AM1/15/14
to vagra...@googlegroups.com
You have to add it to you .gemspec file as a development dependency.

Check here [0] for an example.

After that, do a bundle install and you're done!



--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jimmy Cuadra

unread,
Jan 16, 2014, 2:31:21 AM1/16/14
to vagra...@googlegroups.com
Thanks for the reply. Unfortunately, that doesn't solve the issue for me. Adding the dependency to the gemspec is not really different from having it in the Gemfile. In both cases, vagrant-vmware-fusion is not detected unless I add `require 'vagrant-vmware-fusion'` to my Vagrantfile, which results in the error message, "Encoded files can't be read outside of the Vagrant installer."

How can the VMware provider be loaded and licensed in the development environment?

Mitchell Hashimoto

unread,
Jan 18, 2014, 12:15:01 PM1/18/14
to vagra...@googlegroups.com
Jimmy,

I plan on documenting this, but you'll need a version of Vagrant installed from the installer, then you need to set the environmental variable `VAGRANT_EMBEDDED_DIR` I believe to be the "embedded" directory within that install path...

Jimmy Cuadra

unread,
Jan 22, 2014, 8:40:07 AM1/22/14
to vagra...@googlegroups.com
Hi Mitchell, thanks for the reply.

I tried setting the environment variable, but still got the error message about encoded files being read outside the installer. Is this the correct invocation?

$ VAGRANT_EMBEDDED_DIR=/Applications/Vagrant/embedded bundle exec vagrant status
Vagrant appears to be running in a Bundler environment. Plugins
will not be loaded and plugin commands are disabled.

Vagrant failed to initialize at a very early stage:

There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.

Path: /Users/jimmy/Code/vagrant-librarian-chef/Vagrantfile
Message: Encoded files can't be read outside of the Vagrant installer.

I have vagrant-vmware-fusion in the Gemfile, as well as installed to the official copy of Vagrant in /Applications.

Jimmy Cuadra

unread,
Jan 22, 2014, 8:46:06 AM1/22/14
to vagra...@googlegroups.com
I just searched the Vagrant source code and discovered that the environment variable is named VAGRANT_INSTALLER_EMBEDDED_DIR. Setting that resulted in a new error message:

Message: The RubyEncoder loader is not installed. Please visit the http://www.rubyencoder.com/loaders/ RubyEncoder site to download the required loader for 'darwin' and unpack it into '/Applications/Vagrant/embedded/rgloader' directory to run this protected script.

However, RubyEncoder already exists at /Applications/Vagrant/embedded/rgloader. Is there something else I need to do to get the bundled Vagrant to recognize it? Thanks!

Jimmy Cuadra

unread,
Jan 22, 2014, 8:54:08 AM1/22/14
to vagra...@googlegroups.com
Solved my own problem again... sorry for all the messages. >_<

I looked at /Applications/Vagrant/embedded/rgloader/loader.rb, and it turns out that it requires loaders specific to version of Ruby you're using. I have Ruby 2.1.0 installed globally, which apparently is not the same version the officially installed Vagrant uses. Switching to Ruby 2.0 made it load correctly!

Hopefully some of the issues I've run into here will be useful in documenting how to do this.

Terry Fundak

unread,
Mar 7, 2014, 7:29:09 PM3/7/14
to vagra...@googlegroups.com
I am current experiencing the issue that started this thread.

I am current using rvm to set the version of ruby which is 2.1.1

What version of ruby were you using when you got the error? and/or Would you expect ruby 2.1.1 to work and if not how can I determine what is the proper match between vagrant - vagrant-vmware-fusion and ruby? I have just done a full rebuild and update of Vagrant 1.4.3, vagrant plug-in and Fusion 6.0.2.

Plug-In list after removing all and other added those necessary for the current cookbook.

vagrant-berkshelf (1.3.7)
vagrant-bindfs (0.2.4)
vagrant-omnibus (1.3.0)

Jon Topper

unread,
Apr 27, 2014, 7:58:56 PM4/27/14
to vagra...@googlegroups.com
I found this thread when hitting some issues with developing against the Fusion provider.  Here's the Gemfile I ended up with:


I hope it helps a fellow Google searcher.  Note still that the Ruby version you're using with Bundler needs to match that provided by the installer (or, at least, for which there's an RGLoader target).
Reply all
Reply to author
Forward
0 new messages