vagrant-landrush / landrush

A Vagrant plugin that provides a simple DNS server for Vagrant guests
MIT License
668 stars 80 forks source link

InvalidAddressError needs to be caught #323

Open hferentschik opened 5 years ago

hferentschik commented 5 years ago

There seems to be situations where ip = IPAddr.new(addr[key]) in lib/landrush/cap/guest/all/read_host_visible_ip_address.rb can throw a InvalidAddressError.

vagrant up --provider libvirt
Bringing machine 'default' up with 'libvirt' provider...
==> default: Box 'debian/jessie64' could not be found. Attempting to find and install...
    default: Box Provider: libvirt
    default: Box Version: >= 0
==> default: Loading metadata for box 'debian/jessie64'
    default: URL: https://vagrantcloud.com/debian/jessie64
==> default: Adding box 'debian/jessie64' (v8.11.0) for provider: libvirt
    default: Downloading: https://vagrantcloud.com/debian/boxes/jessie64/versions/8.11.0/providers/libvirt.box
==> default: Successfully added box 'debian/jessie64' (v8.11.0) for 'libvirt'!
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default:  -- Name:              landrush-ip_default
==> default:  -- Domain type:       kvm
==> default:  -- Cpus:              1
==> default:
==> default:  -- Feature:           acpi
==> default:  -- Feature:           apic
==> default:  -- Feature:           pae
==> default:  -- Memory:            512M
==> default:  -- Management MAC:
==> default:  -- Loader:
==> default:  -- Base box:          debian/jessie64
==> default:  -- Storage pool:      default
==> default:  -- Image:             /var/lib/libvirt/images/landrush-ip_default.img (10G)
==> default:  -- Volume Cache:      default
==> default:  -- Kernel:
==> default:  -- Initrd:
==> default:  -- Graphics Type:     vnc
==> default:  -- Graphics Port:     -1
==> default:  -- Graphics IP:       127.0.0.1
==> default:  -- Graphics Password: Not defined
==> default:  -- Video Type:        cirrus
==> default:  -- Video VRAM:        9216
==> default:  -- Sound Type:
==> default:  -- Keymap:            en-us
==> default:  -- TPM Path:
==> default:  -- INPUT:             type=mouse, bus=ps2
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Setting hostname...
==> default: Automatic installation for Landrush IP not enabled
==> default: Configuring and enabling network interfaces...
==> default: [landrush] setting up machine's DNS to point to our server
==> default: [landrush] network: :private_network, {:type=>"dhcp", :protocol=>"tcp", :id=>"db902ce6-128a-4a54-9398-9ac3fa1fbc45"}
==> default: [landrush] network: :private_network, {:type=>"dhcp", :protocol=>"tcp", :id=>"5599cafb-e116-41ef-a28d-3dae861738cc"}
==> default: [landrush] network: :private_network, {:type=>"dhcp", :protocol=>"tcp", :id=>"4dd50c9e-f015-4b0f-aac9-9de6be71168d"}
==> default: [landrush] network: :private_network, {:type=>"dhcp", :protocol=>"tcp", :id=>"9bd6f66f-0127-4802-b2df-d255b4cb8bc7"}
==> default: [landrush] network: :private_network, {:type=>"dhcp", :protocol=>"tcp", :id=>"dff86eca-0506-4050-8e49-22ffc1737f95"}
==> default: [landrush] network: :forwarded_port, {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :protocol=>"tcp"}
==> default: Removing domain...
/opt/vagrant/embedded/lib/ruby/2.4.0/ipaddr.rb:563:in `in6_addr': invalid address (IPAddr::InvalidAddressError)
    from /opt/vagrant/embedded/lib/ruby/2.4.0/ipaddr.rb:500:in `initialize'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/landrush-1.3.0.dev/lib/landrush/cap/guest/all/read_host_visible_ip_address.rb:66:in `new'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/landrush-1.3.0.dev/lib/landrush/cap/guest/all/read_host_visible_ip_address.rb:66:in `read_host_visible_ip_address'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/capability_host.rb:111:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/capability_host.rb:111:in `capability'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/guest.rb:43:in `capability'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/landrush-1.3.0.dev/lib/landrush/action/setup.rb:25:in `host_ip_address'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/landrush-1.3.0.dev/lib/landrush/action/setup.rb:84:in `record_machine_dns_entry'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/landrush-1.3.0.dev/lib/landrush/action/setup.rb:38:in `post_boot_setup'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/landrush-1.3.0.dev/lib/landrush/action/setup.rb:18:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_networks.rb:84:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/share_folders.rb:20:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/prepare_nfs_settings.rb:18:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/prepare_nfs_valid_ids.rb:12:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/provision.rb:80:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_domain.rb:317:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_domain_volume.rb:82:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/handle_box_image.rb:113:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/handle_storage_pool.rb:52:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/hardy/.vagrant.d/gems/2.4.4/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/set_name_of_domain.rb:35:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/box_check_outdated.rb:31:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/machine.rb:239:in `action_raw'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/machine.rb:208:in `block in action'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/environment.rb:598:in `lock'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/machine.rb:194:in `call'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/machine.rb:194:in `action'
    from /opt/vagrant/embedded/gems/2.1.2/gems/vagrant-2.1.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

The code should catch and handle this error more gracefully.