Methods
public class
public instance
Included modules
Attributes
machines | [R] | An Array Rudy::Machines objects that will be processed |
Public class methods
disable_run
()
[show source]
# File lib/rudy/routines/base.rb, line 9 9: def self.disable_run; @@run = false; end
enable_run
()
[show source]
# File lib/rudy/routines/base.rb, line 10 10: def self.enable_run; @@run = true; end
new
(name=nil, option={}, argv=[], *args)
- name The name of the command specified on the command line
- option A Hash or OpenStruct of named command line options. If it’s a Hash it will be converted to an OpenStruct.
- argv An Array of arguments
option and argv are made available to the routine block.
routines do magic do |options,argv| ... end end
[show source]
# File lib/rudy/routines/base.rb, line 32 32: def initialize(name=nil, option={}, argv=[], *args) 33: name ||= (self.class.to_s.split(/::/)).last.downcase 34: option = OpenStruct.new(option) if option.is_a? Hash 35: @name, @option, @argv = name.to_sym, option, argv 36: a, s, r = @@global.accesskey, @@global.secretkey, @@global.region 37: @@sdb ||= Rudy::AWS::SDB.new(a, s, r) 38: 39: # Grab the routines configuration for this routine name 40: # e.g. startup, sysupdate, installdeps 41: @routine = fetch_routine_config @name rescue {} 42: 43: ld "Routine: #{@routine.inspect}" 44: 45: if @routine 46: # Removes the dependencies from the routines hash. 47: # We run these separately from the other actions. 48: @before, @after = @routine.delete(:before), @routine.delete(:after) 49: end 50: 51: # Share one Rye::Box instance for localhost across all routines 52: unless defined?(@@lbox) 53: host, opts = @@global.localhost, { :user => Rudy.sysinfo.user } 54: @@lbox = Rudy::Routines::Handlers::RyeTools.create_box host, opts 55: end 56: 57: disable_run if @@global.testrun 58: 59: # We create these frozen globals for the benefit of 60: # the local and remote routine blocks. 61: $global = @@global.dup.freeze unless $global 62: $option = option.dup.freeze unless $option 63: 64: ## TODO: get the machine config for just the current machine group. This 65: ## probably requires Caesars to be aware of which nodes are structural. 66: ##$config = fetch_machine_config unless $config 67: 68: init(*args) if respond_to? :init 69: end
Public instance methods
disable_run
()
[show source]
# File lib/rudy/routines/base.rb, line 13 13: def disable_run; @@run = false; end
enable_run
()
[show source]
# File lib/rudy/routines/base.rb, line 14 14: def enable_run; @@run = true; end
execute
()
[show source]
# File lib/rudy/routines/base.rb, line 72 72: def execute; raise "Please override"; end
raise_early_exceptions
()
[show source]
# File lib/rudy/routines/base.rb, line 71 71: def raise_early_exceptions; raise "Please override"; end