Running vagrant within a jenkins build fails with "uninitialized constant" error

308 views
Skip to first unread message

bwal...@gmail.com

unread,
Feb 21, 2014, 8:01:38 AM2/21/14
to vagra...@googlegroups.com
I have a jenkins server running on Centos 6.5, it is started as a server and as the user "build". 

If I run "vagrant up --provider=vsphere" in the build directory manually then it works fine. When I run it from the jenkins build I get the error "uninitialized constant VagrantPlugins::VSphere::Errors::RsyncError"  (details shown below). 

I cannot see what the difference is between running it manually and running it from the build server. The build is setup as a freestyle software project and has a short bit of shell script to run the build like so:

source /etc/profile
cd Products/IntegrationTests/AutoDeploy
pwd
vagrant status
vagrant box list
#mvn clean || true # don't care if this fails
vagrant destroy -f || true # don't care if this fails
#mvn integration-test
vagrant up --provider vsphere
vagrant ssh-config > target/ssh-config.txt


The build output is:

+ pwd
/build/hudson/jobs/UDR.Hg-head-AutoDeploy/workspace/Products/IntegrationTests/AutoDeploy
+ vagrant status
Current machine states:
default                   vagrant_vsphere.states.short_running (vsphere)
vagrant_vsphere.states.long_running
+ vagrant box list
CentOS-6.4-x86_64 (aws)
CentOS-6.4-x86_64 (virtualbox)
CentOS-6.4-x86_64 (vsphere)
+ vagrant destroy -f
[default] Calling vSphere PowerOff
[default] Calling vShpere Destroy
+ vagrant up --provider vsphere
Bringing machine 'default' up with 'vsphere' provider...
[default] Calling vSphere CloneVM with the following settings:
[default]  -- Template VM: Centos 6.4 Vagrant Test
[default]  -- Name: autodeployed
[default] Waiting for SSH to become available...
[default] New virtual machine successfully cloned and started
[default] Rsyncing folder: /build/hudson/jobs/UDR.Hg-head-AutoDeploy/workspace/Products/IntegrationTests/AutoDeploy/ => /vagrant
uninitialized constant VagrantPlugins::VSphere::Errors::RsyncError
/home/build/.vagrant.d/gems/gems/vagrant-vsphere-0.7.0/lib/vSphere/action/close_vsphere.rb:18:in `rescue in call'
/home/build/.vagrant.d/gems/gems/vagrant-vsphere-0.7.0/lib/vSphere/action/close_vsphere.rb:12:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:57:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/call.rb:57:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
/home/build/.vagrant.d/gems/gems/vagrant-vsphere-0.7.0/lib/vSphere/action/connect_vsphere.rb:16:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/builder.rb:116:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/action/runner.rb:69:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/machine.rb:147:in `action'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'
No error message 
Build step 'Execute shell' marked build as failure 

Mitchell Hashimoto

unread,
Feb 21, 2014, 11:49:15 AM2/21/14
to vagra...@googlegroups.com
Hi,

The exception is originating from a plugin "vagrant-vsphere". Please contact that plugin author about this happening!

Best,
Mitchell


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

bwal...@gmail.com

unread,
Feb 24, 2014, 8:02:58 PM2/24/14
to vagra...@googlegroups.com
Thanks, turns out the error was caused by having selinux enabled on the server. That and a bug in the vsphere plugin that prevents it from reporting the error correctly.
Reply all
Reply to author
Forward
0 new messages