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
48
|
# File 'lib/vagrant-openstack-plugin/action/create_network_interfaces.rb', line 16
def call(env)
networks_to_configure = []
env[:machine].config.vm.networks.each_with_index do |network, slot_number|
type = network[0]
original_options = network[1]
next if type != :private_network
next if original_options[:auto_config] === false
next if slot_number == 0
options = scoped_hash_override(original_options, :openstack)
@logger.info "Configuring interface slot_number #{slot_number} options #{options}"
network_to_configure = {
:interface => slot_number,
}
if options[:ip]
network_to_configure = {
:type => :static,
:ip => options[:ip],
:netmask => "255.255.255.0",
}.merge(network_to_configure)
else
network_to_configure[:type] = :dhcp
end
networks_to_configure.push(network_to_configure)
end
env[:ui].info I18n.t('vagrant.actions.vm.network.configuring')
env[:machine].guest.capability(:configure_networks, networks_to_configure)
@app.call(env)
end
|