Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 0e60964

Browse files
committed
More cleanup
1 parent ec3ffd9 commit 0e60964

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

Vagrantfile

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- mode: ruby -*-
22
# vi: set ft=ruby :
3-
VAGRANTFILE_API_VERSION = '2' unless defined? VAGRANTFILE_API_VERSION
43

54
require './lib/drupalvm/vagrant'
65

@@ -36,19 +35,19 @@ end
3635
require_ansible_version ">= #{vconfig['drupalvm_ansible_version_min']}"
3736
Vagrant.require_version ">= #{vconfig['drupalvm_vagrant_version_min']}"
3837

39-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
38+
Vagrant.configure('2') do |config|
39+
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
40+
config.vm.define vconfig['vagrant_machine_name']
41+
4042
# Networking configuration.
4143
config.vm.hostname = vconfig['vagrant_hostname']
42-
if vconfig['vagrant_ip'] == '0.0.0.0' && Vagrant.has_plugin?('vagrant-auto_network')
43-
config.vm.network :private_network, ip: vconfig['vagrant_ip'], auto_network: true
44-
else
45-
config.vm.network :private_network, ip: vconfig['vagrant_ip']
46-
end
44+
config.vm.network :private_network,
45+
ip: vconfig['vagrant_ip'],
46+
auto_network: vconfig['vagrant_ip'] == '0.0.0.0' && Vagrant.has_plugin?('vagrant-auto_network')
4747

48-
if !vconfig['vagrant_public_ip'].empty? && vconfig['vagrant_public_ip'] == '0.0.0.0'
49-
config.vm.network :public_network
50-
elsif !vconfig['vagrant_public_ip'].empty?
51-
config.vm.network :public_network, ip: vconfig['vagrant_public_ip']
48+
if !vconfig['vagrant_public_ip'].empty?
49+
config.vm.network :public_network,
50+
ip: vconfig['vagrant_public_ip'] != '0.0.0.0' ? vconfig['vagrant_public_ip'] : nil
5251
end
5352

5453
# SSH options.
@@ -133,9 +132,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
133132
p.update_guest_tools = true
134133
end
135134

136-
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
137-
config.vm.define vconfig['vagrant_machine_name']
138-
139135
# Cache packages and dependencies if vagrant-cachier plugin is present.
140136
if Vagrant.has_plugin?('vagrant-cachier')
141137
config.cache.scope = :box

0 commit comments

Comments
 (0)