Skip to content

Fix documents when using private_network with dhcp#3349

Closed
tobynet wants to merge 1 commit intohashicorp:masterfrom
tobynet:patch-1
Closed

Fix documents when using private_network with dhcp#3349
tobynet wants to merge 1 commit intohashicorp:masterfrom
tobynet:patch-1

Conversation

@tobynet
Copy link

@tobynet tobynet commented Mar 28, 2014

I wrote in my Vagrantfile following the documents as follows :

  config.vm.provider "virtualbox" do |vb, override|
    override.vm.network "private_network", type: "dhcp"
  end

😄😄😄 Expected 😄😄😄

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: VirtualBox VM is already running.
$ # No problem

💩💩💩 Actual 💩💩💩

$ vagrant up
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* An IP is required for a private network.
$ echo $?
1

😱 💔

Next, I correct my Vagrantfile as follows:

  config.vm.provider "virtualbox" do |vb, override|
    override.vm.network "private_network", type: :dchp
  end

Then,

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: VirtualBox VM is already running.
$ # No problem

✌️✌️✌️

❓ ❓ ❓ Why should I fix it as this patch ❓ ❓ ❓

See below:

at https://github.com/mitchellh/vagrant/blob/v1.5.1/plugins/providers/virtualbox/action/network.rb#L279 :

if options[:type] == :dhcp

at https://github.com/mitchellh/vagrant/blob/v1.5.1/plugins/providers/virtualbox/action/network.rb#L251 :

          options[:ip] = "172.28.128.1" if options[:type] == :dhcp && !options[:ip]

@mitchellh
Copy link
Contributor

We convert to a symbol up here: https://github.com/mitchellh/vagrant/blob/v1.5.1/plugins/providers/virtualbox/action/network.rb#L248

This was a separate issue I just fixed.

@tobynet
Copy link
Author

tobynet commented Apr 2, 2014

LGTM

👍 👎

@tobynet tobynet deleted the patch-1 branch April 2, 2014 05:07
@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants