Sha256: e0217c5a30bc7db4f62d0b00e69a78e957edaa816c5831842cf86b4084d3bfd7
Contents?: true
Size: 996 Bytes
Versions: 7
Compression:
Stored size: 996 Bytes
Contents
require 'log4r' require 'timeout' require 'vagrant-conoha/action/abstract_action' module VagrantPlugins module ConoHa module Action class WaitForServerToStop < AbstractAction def initialize(app, _env, retry_interval = 3) @app = app @logger = Log4r::Logger.new('vagrant_openstack::action::stop_server') @retry_interval = retry_interval end def execute(env) if env[:machine].id env[:ui].info(I18n.t('vagrant_openstack.waiting_stop')) client = env[:openstack_client].nova config = env[:machine].provider_config timeout(config.server_stop_timeout, Errors::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 end end end end
Version data entries
7 entries across 7 versions & 1 rubygems