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

in vcenter_upload_box': undefined method name' for nil:NilClass (NoMethodError) #42

Open
hgch opened this issue Aug 1, 2016 · 9 comments

Comments

@hgch
Copy link

hgch commented Aug 1, 2016

Hi,

I've installed version 0.3.3 and now when im trying create one new vagrant then vcenter_upload_box': undefined methodname'.

I'm using the new template from git

.vagrant.d/gems/gems/vagrant-vcenter-0.3.3/lib/vagrant-vcenter/action/inventory_check.rb:29:in vcenter_upload_box': undefined methodname' for nil:NilClass (NoMethodError)
from C:/Users/hgoncalves/.vagrant.d/gems/gems/vagrant-vcenter-0.3.3/lib/vagrant-vcenter/action/inventory_check.rb:130:in vcenter_check_inventory' from C:/Users/hgoncalves/.vagrant.d/gems/gems/vagrant-vcenter-0.3.3/lib/vagrant-vcenter/action/inventory_check.rb:22:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/warden.rb:34:in call' from C:/Users/hgoncalves/.vagrant.d/gems/gems/vagrant-vcenter-0.3.3/lib/vagrant-vcenter/action/connect_vcenter.rb:33:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/warden.rb:34:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/builtin/config_validate.rb:25:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/warden.rb:34:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/builder.rb:116:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/runner.rb:66:in block in run' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/busy.rb:19:inbusy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/action/runner.rb:66:in run' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:225:inaction_raw'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:200:in block in action' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/environment.rb:561:inlock'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:186:in call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:186:inaction'
from C:/Users/hgoncalves/.vagrant.d/gems/gems/vagrant-vcenter-0.3.3/lib/vagrant-vcenter/provider.rb:28:in state' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:504:instate'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine.rb:145:in initialize' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/vagrantfile.rb:79:innew'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/vagrantfile.rb:79:in machine' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/environment.rb:663:inmachine'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:177:in block in with_target_vms' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:201:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:201:in block in with_target_vms' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:183:ineach'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/plugin/v2/command.rb:183:in with_target_vms' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/commands/up/command.rb:131:ininstall_providers'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/commands/up/command.rb:85:in execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/cli.rb:42:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/environment.rb:302:in cli' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.5/bin/vagrant:174:in

'

@aloha
Copy link

aloha commented Sep 8, 2016

Stepped through the code and I see cfg = env[:machine].provider_config and cfg.box is actually Nil. This seems to be the problem. The code assumes .box is not nil and it's probably correct in doing so. I'm not super familiar with vagrant plugin development but it seems the warden is sending a different env[:machine] than expected to the check inventory method. Is this a difference in vagrant versions? I will try an older version and see if it helps.

@chinmayb
Copy link

chinmayb commented Oct 3, 2016

I'm facing the same issue, any suggestions please?

@kesterriley
Copy link

I have the same problem, anyone found a solution?

@eegilbert
Copy link

/home/user/.vagrant.d/gems/2.2.5/gems/vagrant-vcenter-0.3.3/lib/vagrant-vcenter/action/inventory_check.rb:29:in vcenter_upload_box': undefined method name' for nil:NilClass (NoMethodError)

vagrant 1.8.6: I get the same error message
vagrant 1.9.0: I get the same error message

@jrampon
Copy link

jrampon commented Dec 15, 2016

Same error here with Vagrant 1.9.1. Going back to the plugin version 0.3.2 works fine.

vagrant plugin install vagrant-vcenter --plugin-version 0.3.2

@vladistan
Copy link

Same error here Vagrant 1.8.1 or 1.9.1 plugin version 0.3.3

More information about this. The error started to appear after I added another machine to the Vagrant file that is using new box. When I change the box name to something that is already uploaded to VCenter server as template the error disappears.

Going back to version 0.3.2 makes the error go away

@chamap1
Copy link

chamap1 commented Mar 21, 2017

Is this going to be fixed?

@sdorsett
Copy link

sdorsett commented Oct 9, 2017

This error affects both vagrant status as well the vagrant up command and seems to be related to lib/vagrant-vcenter/action/inventory_check.rb referencing properties of the box file ( specifically 'name' and 'directory') before the HandleBox action downloads the box file, resulting in env[:machine].box being nil.

One work around I found was I could use vagrant box add to download/stage the box file before initially running vagrant up or vagrant status to prevent env[:machine].box from being nil. The vagrant commands would then behave as expected.

@TheSin-
Copy link

TheSin- commented Aug 13, 2021

looking at the commit that causes the issue

440c6ab#diff-43751c934090f8d0fd91747614a16681bf709f6a6111698d15c57a319cf48778

I assume it's the missing to_s causing the issue here?

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

No branches or pull requests

10 participants