Class: VagrantPlugins::Openstack::Action::WaitForServerToBeActive
- Inherits:
-
Object
- Object
- VagrantPlugins::Openstack::Action::WaitForServerToBeActive
- Defined in:
- lib/vagrant-openstack-provider/action/wait_active.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _env) ⇒ WaitForServerToBeActive
constructor
A new instance of WaitForServerToBeActive.
Constructor Details
#initialize(app, _env) ⇒ WaitForServerToBeActive
Returns a new instance of WaitForServerToBeActive.
8 9 10 11 |
# File 'lib/vagrant-openstack-provider/action/wait_active.rb', line 8 def initialize(app, _env) @app = app @logger = Log4r::Logger.new('vagrant_openstack::action::start_server') end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant-openstack-provider/action/wait_active.rb', line 13 def call(env) if env[:machine].id env[:ui].info(I18n.t('vagrant_openstack.waiting_start')) client = env[:openstack_client].nova timeout(200) do while client.get_server_details(env, env[:machine].id)['status'] != 'ACTIVE' sleep 3 @logger.info('Waiting for server to be active') end end end @app.call(env) end |