Class: Commands::MaintInstances
- Inherits:
-
Object
- Object
- Commands::MaintInstances
- Defined in:
- lib/commands/maint_instances.rb
Instance Method Summary collapse
-
#options ⇒ Object
holds the options that were passed you can set any initial defaults here.
- #register(opts, global_options) ⇒ Object
-
#required_options ⇒ Object
required options.
- #run(global_options, amazon) ⇒ Object
Instance Method Details
#options ⇒ Object
holds the options that were passed you can set any initial defaults here
6 7 8 9 10 11 |
# File 'lib/commands/maint_instances.rb', line 6 def @options ||= { :migrate_command => '', :downtime => false } end |
#register(opts, global_options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/commands/maint_instances.rb', line 21 def register(opts, ) opts. = "Usage: maint [options]" opts.description = "Put up or take down the maintenance page." opts.on('-g', "--group name", "Required - Name of this deploy group.") do |v| [:group] = v end opts.on('-m', "--[no-]maint", "Required - Use --maint if you want the maint page, --no-maint to remove the maint page.") do |v| [:maint] = v end opts.on('-p', "--print path", "The directory into which we output the data as a file per host.") do |v| [:result_path] = v end end |
#required_options ⇒ Object
required options
14 15 16 17 18 19 |
# File 'lib/commands/maint_instances.rb', line 14 def @required_options ||= Set.new [ :group, :maint, ] end |
#run(global_options, amazon) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/commands/maint_instances.rb', line 39 def run(, amazon) ec2 = amazon.ec2 utils = ZZSharedLib::Utils.new(amazon) group_name = [:group] maint = [:maint] # first see if already exists deploy_group = amazon.find_deploy_group(group_name) instances = amazon.find_and_sort_named_instances(group_name) # see if already deploying if ![:force] # raises an exception if not all in the ready or error state utils.check_deploy_state(instances, [:deploy_chef, :deploy_app]) end # put up or take down the maint page BuildDeployConfig.do_maint_deploy(utils, amazon, instances, group_name, deploy_group, maint, [:result_path]) end |