Class: Rudy::Routines::Startup

Inherits:
Base
  • Object
show all
Defined in:
lib/rudy/routines/startup.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

#execute(&each_mach) ⇒ Object

  • each_mach is an optional block which is executed between

disk creation and the after scripts. The will receives two arguments: instances of Rudy::Machine and Rye::Box. Returns an Array of Rudy::Machine objects



14
15
16
17
18
19
20
21
22
# File 'lib/rudy/routines/startup.rb', line 14

def execute(&each_mach)
  routine_separator(:startup)
  unless @routine
    STDERR.puts "[this is a generic startup routine]"
    @routine = {}
  end
  machines = generic_machine_runner(:create) 
  machines
end

#init(*args) ⇒ Object



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

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

#raise_early_exceptionsObject

Called by generic_machine_runner



25
26
27
28
29
30
31
32
# File 'lib/rudy/routines/startup.rb', line 25

def raise_early_exceptions
  rmach = Rudy::Machines.new
  # There's no keypair check here because Rudy::Machines will create one 
  raise MachineGroupNotDefined, current_machine_group unless known_machine_group?
  # We don't check @@global.offline b/c we can't create EC2 instances
  # without an internet connection. Use passthrough for routine tests.
  raise MachineGroupAlreadyRunning, current_machine_group if rmach.running?
end