Class: VagrantPlugins::Lightsail::Action::StartInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::Lightsail::Action::StartInstance
- Includes:
- Vagrant::Util::Retryable
- Defined in:
- lib/vagrant-lightsail/action/start_instance.rb
Overview
This starts a stopped instance.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _) ⇒ StartInstance
constructor
A new instance of StartInstance.
Constructor Details
#initialize(app, _) ⇒ StartInstance
Returns a new instance of StartInstance.
11 12 13 14 |
# File 'lib/vagrant-lightsail/action/start_instance.rb', line 11 def initialize(app, _) @app = app @logger = Log4r::Logger.new('vagrant_lightsail::action::start_instance') end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant-lightsail/action/start_instance.rb', line 16 def call(env) env[:ui].info I18n.t 'vagrant_lightsail.starting' begin env[:lightsail_client].start_instance(instance_name: env[:machine].id).operations[0] rescue Aws::Lightsail::Errors => e raise Errors::LightailError, message: e end retryable(tries: 120, sleep: 10) do break if env[:interrupted] env[:ui].info I18n.t 'vagrant_lightsail.waiting_for_ssh' raise 'not ready' unless env[:machine].communicate.ready? end env[:ui].info I18n.t('vagrant_lightsail.ready') @app.call env end |