Class: Rudy::Routines::Shutdown

Inherits:
Base
  • Object
show all
Defined in:
lib/rudy/routines/shutdown.rb

Instance Method Summary collapse

Methods inherited from Base

#enjoy_every_sandwich, #execute_dependency, #generic_machine_runner, #has_remote_task?, #initialize, #keep_going?, #machine_separator, #preliminary_separator, #routine_separator, #task_separator

Methods included from Huxtable

change_environment, change_position, change_region, change_role, change_zone, #check_keys, #config_dirname, create_domain, #current_group_name, #current_machine_address, #current_machine_count, #current_machine_group, #current_machine_hostname, #current_machine_image, #current_machine_name, #current_machine_size, #current_user, #current_user_keypairpath, debug?, #debug?, domain, domain_exists?, #group_metadata, #has_keypair?, #has_keys?, #has_pem_keys?, #has_root_keypair?, keypair_path_to_name, #known_machine_group?, #root_keypairname, #root_keypairpath, #switch_user, update_config, update_global, update_logger, #user_keypairname, #user_keypairpath

Constructor Details

This class inherits a constructor from Rudy::Routines::Base

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rudy/routines/shutdown.rb', line 10

def execute
  routine_separator(:shutdown)
  unless @routine
    STDERR.puts "[this is a generic shutdown routine]"
    @routine = {}
  end
  machines = []
  generic_machine_runner(:destroy) do |machine,rbox|
    puts $/, "Shutting down...", $/
    machines << machine
  end
  machines
end

#init(*args) ⇒ Object



6
7
8
# File 'lib/rudy/routines/shutdown.rb', line 6

def init(*args)
  @routine = fetch_routine_config(:shutdown)
end

#raise_early_exceptionsObject

Called by generic_machine_runner



25
26
27
28
29
# File 'lib/rudy/routines/shutdown.rb', line 25

def raise_early_exceptions
  rmach = Rudy::Machines.new
  raise Rudy::PrivateKeyNotFound, root_keypairpath unless has_keypair?(:root)
  raise MachineGroupNotRunning, current_machine_group unless rmach.running?
end