12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/vagrant-startcloud/action/configure_networks.rb', line 12
def call(env)
machine = env[:machine]
config = machine.config.startcloud
if config.networks&.any?
machine.ui.info I18n.t('vagrant_startcloud.provisioner.configuring_networks')
config.networks.each do |network|
options = {
ip: network['address'],
netmask: network['netmask'],
gateway: network['gateway'],
dhcp: network['dhcp4'],
dhcp4: network['dhcp4'],
dhcp6: network['dhcp6'],
auto_config: network['autoconf'],
mac: format_mac_address(network['mac'], @provider),
nic_type: network['nic_type'],
vlan: network['vlan'],
dns: network['dns'],
bridge: network['bridge']
}.compact
case network['type']
when 'host'
configure_network(machine, 'private_network', options)
else
configure_network(machine, network['type'], options)
end
rescue StandardError => e
raise Errors::NetworkConfigurationError, error: e.message
end
end
@app.call(env)
end
|