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