Class: VagrantPlugins::OpenNebulaProvider::Action::Create

Inherits:
Object
  • Object
show all
Defined in:
lib/opennebula-provider/action/create.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Create

Returns a new instance of Create.



5
6
7
8
# File 'lib/opennebula-provider/action/create.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant::provider::opennebula::create')
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/opennebula-provider/action/create.rb', line 10

def call(env)
  @logger.info I18n.t('opennebula_provider.info.creating')
  result = env[:rocci].compute
  env[:machine].id = result
  env[:rocci].wait_for_state(env, 'active')
  env[:ui].info I18n.t('opennebula_provider.info.waiting_for_sshd')
  if !env[:interrupted]
    while true
      break if env[:interrupted]
      break if env[:machine].communicate.ready?
      sleep 2
    end
  end
  @app.call(env)
end