Class: Engineyard::Local::Command::Start

Inherits:
Base show all
Defined in:
lib/engineyard-local/command/start.rb

Instance Attribute Summary

Attributes inherited from Base

#env, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods inherited from Vagrant::Command::Base

#cookbook_status, #initialize

Methods included from Helpers

#insert_linebreaks, #merge_run_options, #run

Constructor Details

This class inherits a constructor from Engineyard::Local::Command::Base

Instance Method Details

#exec(*args) ⇒ Object

Wrap Vagrant’s :resume so that it checks to see if the instance is suspended first, and gives helpful output if it is not.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/engineyard-local/command/start.rb', line 7

def exec(*args)
  with_target_vms do |vm|
    if vm.created?
      if ( vm.state == :saved )
        vm.resume
      elsif ( vm.state == :running )
        env.ui.info( insert_linebreaks( I18n.t( "eylocal.start.running" ) ) )
      else
        env.ui.info( insert_linebreaks( I18n.t( "eylocal.start.not_startable" , :state => vm.state ) ) )
      end
    else
      env.ui.info( I18n.t( "eylocal.start.not_created" ) )
    end
  end
end