Class: VagrantPlugins::OpenStack::Action::CreateNetworkInterfaces
- Inherits:
-
Object
- Object
- VagrantPlugins::OpenStack::Action::CreateNetworkInterfaces
- Includes:
- Vagrant::Util::ScopedHashOverride
- Defined in:
- lib/vagrant-openstack-plugin/action/create_network_interfaces.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ CreateNetworkInterfaces
constructor
A new instance of CreateNetworkInterfaces.
Constructor Details
#initialize(app, env) ⇒ CreateNetworkInterfaces
Returns a new instance of CreateNetworkInterfaces.
11 12 13 14 |
# File 'lib/vagrant-openstack-plugin/action/create_network_interfaces.rb', line 11 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_openstack::action::create_network_interfaces") end |
Instance Method Details
#call(env) ⇒ Object
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] = network[1] next if type != :private_network next if [:auto_config] === false next if slot_number == 0 = scoped_hash_override(, :openstack) @logger.info "Configuring interface slot_number #{slot_number} options #{}" network_to_configure = { :interface => slot_number, } if [:ip] network_to_configure = { :type => :static, :ip => [: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 |