Sha256: 73bdffe0f84d2e51e466e1f749b0e618f10690552704ff19610eb2a5249676af

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require 'clamp'
require 'opsworks_rolling_deploy/services/deploy_service'
require 'json'
module OpsworksRollingDeploy
  module Commands
    class DeployCommand < Clamp::Command
      option "--aws-id", "AWS_ACCESS_KEY_ID", "aws access key id", environment_variable: "AWS_ACCESS_KEY_ID"
      option "--aws-secret", "AWS_SECRET_ACCESS_KEY", "aws secret access key", environment_variable: "AWS_SECRET_ACCESS_KEY"

      option "--stack", "STACK_NAME", "the stack name", required: true
      option "--app", "APP_NAME", "the application name", required: true
      option "--layer", "LAYER_NAME", "the layer name", required: false

      option "--command", "COMMAND", "the command to be executed by opsworks", default: 'deploy'
      option "--command-args", "COMMAND_ARGS", "the args to the command to be executed by opsworks as JSON (e.g. '{\"migrate\":[\"true\"]}'", default: '{}'
      option "--custom-json", "CUSTOM_JSON", " A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values (e.g. '{\"key1\": \"value1\", \"key2\": \"value2\",...}'", default: '{}'

      option "--pretend", :flag, "pretend execution"
      option "--verbose", :flag, "display aws commands"
      option "--exclude", "PATTERN" , "wildcard pattern to exclude hosts", multivalued: true

      def execute
        OpsworksRollingDeploy.set_verbose(verbose?)
        OpsworksRollingDeploy.set_auth_default(aws_id, aws_secret) if aws_id
        Services::DeployService.new.deploy(stack, layer, app, command, JSON.parse(command_args), custom_json, pretend?, exclude_list)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opsworks_rolling_deploy-0.2.0 lib/opsworks_rolling_deploy/commands/deploy_command.rb