Class Rudy::CLI::Routines

  1. lib/rudy/cli/routines.rb

Public instance methods

passthrough ()

All unknown commands are sent here (using Drydock’s trawler). By default, the generic passthrough routine is executed which does nothing other than execute the routine config block that matches +@alias+ (the name used on the command-line). Calling

$ rudy unknown

would end up here because it’s an unknown command. Passthrough then looks for a routine config in the current environment and role called “unknown”. If found, it’s executed otherwise it’ll raise an exception.

[show source]
    # File lib/rudy/cli/routines.rb, line 79
79:     def passthrough
80:             
81:       machines = @rr.execute
82:       
83:       if !@@global.quiet && !machines.empty?
84:         li $/, "The following machines were processed:"
85:         print_stobjects machines, :noverbose
86:       end
87:       
88:     end
passthrough_valid? ()
[show source]
    # File lib/rudy/cli/routines.rb, line 61
61:     def passthrough_valid?
62:       @rr = Rudy::Routines::Passthrough.new(@alias, @option, @argv)
63:       @rr.raise_early_exceptions
64:       true
65:     end
reboot ()
[show source]
    # File lib/rudy/cli/routines.rb, line 55
55:     def reboot
56:       machines = @rr.execute
57:       li $/, "The following machines have been restarted:"
58:       print_stobjects machines, :noverbose
59:     end
reboot_valid? ()
[show source]
    # File lib/rudy/cli/routines.rb, line 50
50:     def reboot_valid?
51:       @rr = Rudy::Routines::Reboot.new(@alias, @option, @argv)
52:       @rr.raise_early_exceptions
53:       true
54:     end
routines ()
[show source]
    # File lib/rudy/cli/routines.rb, line 11
11:     def routines
12:       if @@config.nil? || @@config.empty?
13:         return if @@global.quiet
14:         raise Rudy::NoConfig
15:       end
16:       
17:       if @option.all
18:         routine = @@config.routines
19:       else
20:         routine = {}
21:         routine.merge! @@config.routines.find_deferred(@@global.environment, @@global.role) || {}
22:         routine.merge! @@config.routines.find(@@global.role) || {}
23:         #envs, roles = @@global.environment || [], @@global.role || []
24:         #envs.each do |env|
25:         #  roles.each do |role|
26:         #    routine.merge! @@config.routines.find_deferred(env, role) || {}
27:         #  end
28:         #end
29:         #roles.each do |role|
30:         #  routine.merge! @@config.routines.find(role) || {}
31:         #end
32:       end
33:       
34:       outform = @@global.format == :json ? :to_json : :to_yaml
35:       
36:       li routine.to_hash.send(outform)
37:     end
routines_valid? ()
[show source]
   # File lib/rudy/cli/routines.rb, line 6
6:     def routines_valid?
7:       raise Rudy::NoRoutinesConfig unless @@config.routines
8:       true
9:     end
shutdown ()
[show source]
     # File lib/rudy/cli/routines.rb, line 95
 95:     def shutdown
 96:       routine = fetch_routine_config(:shutdown) rescue {}
 97:       
 98:       li "All machines in #{current_machine_group} will be shutdown".bright
 99:       if routine && routine.disks
100:         if routine.disks.destroy
101:           li "The following filesystems will be destroyed:".bright
102:           li routine.disks.destroy.keys.join($/).bright
103:         end
104:       end
105:       
106:       execute_check :medium
107:       
108:       machines = @rr.execute
109:       
110:       li $/, "The following instances have been destroyed:"
111:       machines.each do |machine|
112:         li '%s %s ' % [machine.name.bright, machine.instid]
113:       end
114:       
115:     end
shutdown_valid? ()
[show source]
    # File lib/rudy/cli/routines.rb, line 90
90:     def shutdown_valid?
91:       @rr = Rudy::Routines::Shutdown.new(@alias, @option, @argv)
92:       @rr.raise_early_exceptions
93:       true
94:     end
startup ()
[show source]
    # File lib/rudy/cli/routines.rb, line 44
44:     def startup
45:       machines = @rr.execute || []
46:       li $/, "The following machines are now available:" unless machines.empty?
47:       print_stobjects machines, :noverbose
48:     end
startup_valid? ()
[show source]
    # File lib/rudy/cli/routines.rb, line 39
39:     def startup_valid?
40:       @rr = Rudy::Routines::Startup.new(@alias, @option, @argv)
41:       @rr.raise_early_exceptions
42:       true
43:     end