Sha256: af47222fa6dc8e20c4324c9732e24343446645179a19e34ca2d258edcc21d8d0

Contents?: true

Size: 1.68 KB

Versions: 18

Compression:

Stored size: 1.68 KB

Contents

module Commands
  class MaintInstances

    # holds the options that were passed
    # you can set any initial defaults here
    def options
      @options ||= {
          :migrate_command => '',
          :downtime => false
      }
    end

    # required options
    def required_options
      @required_options ||= Set.new [
          :group,
          :maint,
      ]
    end

    def register(opts, global_options)
      opts.banner = "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|
        options[: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|
        options[:maint] = v
      end

      opts.on('-p', "--print path", "The directory into which we output the data as a file per host.") do |v|
        options[:result_path] = v
      end
    end


    def run(global_options, amazon)
      ec2 = amazon.ec2
      utils = ZZSharedLib::Utils.new(amazon)

      group_name = options[:group]
      maint = options[: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 !options[: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, options[:result_path])

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
zzdeploy-0.1.13 lib/commands/maint_instances.rb
zzdeploy-0.1.12 lib/commands/maint_instances.rb
zzdeploy-0.1.11 lib/commands/maint_instances.rb
zzdeploy-0.1.10 lib/commands/maint_instances.rb
zzdeploy-0.1.9 lib/commands/maint_instances.rb
zzdeploy-0.1.8 lib/commands/maint_instances.rb
zzdeploy-0.1.7 lib/commands/maint_instances.rb
zzdeploy-0.1.6 lib/commands/maint_instances.rb
zzdeploy-0.1.5 lib/commands/maint_instances.rb
zzdeploy-0.1.4 lib/commands/maint_instances.rb
zzdeploy-0.1.3 lib/commands/maint_instances.rb
zzdeploy-0.1.2 lib/commands/maint_instances.rb
zzdeploy-0.1.0 lib/commands/maint_instances.rb
zzdeploy-0.0.9 lib/commands/maint_instances.rb
zzdeploy-0.0.8 lib/commands/maint_instances.rb
zzdeploy-0.0.7 lib/commands/maint_instances.rb
zzdeploy-0.0.6 lib/commands/maint_instances.rb
zzdeploy-0.0.5 lib/commands/maint_instances.rb