schubergphilis / vagrant-chef-zero

Vagrant Plugin for Chef Zero
Apache License 2.0
91 stars 42 forks source link

get_chef_server_url': undefined method `ip_address' for nil:NilClass #31

Open joelmoss opened 10 years ago

joelmoss commented 10 years ago

On 0.5.2...

$ vagrant up    
Bringing machine 'default' up with 'virtualbox' provider...
/Users/joelmoss/.vagrant.d/gems/gems/vagrant-chef-zero-0.5.2/lib/vagrant-chef-zero/env_helpers.rb:53:in `get_chef_server_url': undefined method `ip_address' for nil:NilClass (NoMethodError)
    from /Users/joelmoss/.vagrant.d/gems/gems/vagrant-chef-zero-0.5.2/lib/vagrant-chef-zero/action/reconfig.rb:17:in `initialize'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:90:in `new'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:90:in `finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:20:in `block in initialize'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:20:in `map'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/warden.rb:20:in `initialize'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:170:in `new'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:170:in `to_app'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/machine.rb:147:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'
    from /Users/joelmoss/.vagrant.d/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `call'
    from /Users/joelmoss/.vagrant.d/gems/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
andrewgross commented 10 years ago

Thanks for reporting, looks like an issue when we find no private IPv4 address when listing the interfaces with ::Socket.ip_address_list

Any idea what might be going on with your machine?

You can try the following code to get the list of objects that it is filtering.

require 'socket'
puts Socket.ip_address_list
puts Socket.ip_address_list.each { |i| puts i.inspect } 
andrewgross commented 10 years ago

It looks like the logic as it is now will not detect the loopback interface as a valid address. I will need to think about some better logic to implement this so we can reliable find the interface in use.

electrofelix commented 9 years ago

Could be due to the first time running vagrant where the provider hasn't yet created a suitable network.