Class: Vcloud::NetLauncher::NetLaunch

Inherits:
Object
  • Object
show all
Defined in:
lib/vcloud/net_launcher/net_launch.rb

Instance Method Summary collapse

Constructor Details

#initializevoid

Initializes instance variables.



8
9
10
# File 'lib/vcloud/net_launcher/net_launch.rb', line 8

def initialize
  @config_loader = Vcloud::Core::ConfigLoader.new
end

Instance Method Details

#run(config_file = nil) ⇒ void

This method returns an undefined value.

Parses a configuration file and provisions the networks it defines.

Parameters:

  • config_file (String) (defaults to: nil)

    Path to a YAML or JSON-formatted configuration file



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vcloud/net_launcher/net_launch.rb', line 16

def run(config_file = nil)
  config = @config_loader.load_config(config_file, Vcloud::NetLauncher::Schema::NET_LAUNCH)

  config[:org_vdc_networks].each do |net_config|
    net_config[:fence_mode] ||= 'isolated'
    Vcloud::Core.logger.info("Provisioning orgVdcNetwork #{net_config[:name]}.")
    begin
      Vcloud::Core::OrgVdcNetwork.provision(net_config)
    rescue RuntimeError => e
      Vcloud::Core.logger.error("Could not provision orgVdcNetwork: #{e.message}")
      raise
    end
  end
end