Class: VagrantPlugins::VCloud::Action::PowerOn
- Inherits:
-
Object
- Object
- VagrantPlugins::VCloud::Action::PowerOn
- Defined in:
- lib/vagrant-vcloud/action/power_on.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ PowerOn
constructor
A new instance of PowerOn.
Constructor Details
#initialize(app, env) ⇒ PowerOn
Returns a new instance of PowerOn.
7 8 9 10 |
# File 'lib/vagrant-vcloud/action/power_on.rb', line 7 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_vcloud::action::power_on") end |
Instance Method Details
#call(env) ⇒ Object
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 |
# File 'lib/vagrant-vcloud/action/power_on.rb', line 12 def call(env) @env = env cfg = env[:machine].provider_config cnx = cfg.vcloud_cnx.driver vmName = env[:machine].name vAppId = env[:machine].get_vapp_id env[:ui].info("Booting VM...") testIp = cnx.get_vapp_edge_public_ip(vAppId) poweronVM = cnx.poweron_vm(env[:machine].id) cnx.wait_task_completion(poweronVM) if testIp.nil? && cfg.vdc_edge_gateway_ip && cfg.vdc_edge_gateway @logger.debug("This is our first boot, we should map ports on org edge!") env[:ui].info("Creating NAT rules on [#{cfg.vdc_edge_gateway}] for IP [#{cfg.vdc_edge_gateway_ip}].") edgeMap = cnx.set_edge_gateway_rules(cfg.vdc_edge_gateway, cfg.vdc_id, cfg.vdc_edge_gateway_ip, vAppId) cnx.wait_task_completion(edgeMap) end @app.call(env) end |