Sha256: 8eb2b33234a6e66cdf08a364da4b5aa605bc6dee35e30de380039615e7b8c355

Contents?: true

Size: 936 Bytes

Versions: 13

Compression:

Stored size: 936 Bytes

Contents

require "jets/commands/releases/releases_command"

module Jets::Command
  class RollbackCommand < Base # :nodoc:
    desc "rollback", "Rollback to a previous release"
    long_desc Help.text(:rollback)
    def perform(version)
      Rollback.new(options.merge(version: version)).run
    end
  end

  class Rollback
    include Jets::Command::ApiHelpers
    attr_reader :version
    def initialize(options={})
      @options = options
      @version = options[:version]
    end

    def run
      no_token_exit!
      Jets.boot
      payload = Release.new(@options).get(version)
      check_for_error_message!(payload)

      puts "Rolling back to version #{version}"
      # Download previous cfn templates
      Jets::Cfn::Download.new.download_templates(version)
      # Run cloudformation update
      Jets::Cfn::Ship.new(@options.merge(rollback_version: version)).run # also creates the Jets Api deployment record
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.12 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.11 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.10 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.9 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.8 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.7 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.6 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.5 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.4 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.3 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.2 lib/jets/commands/rollback/rollback_command.rb
jets-5.0.1 lib/jets/commands/rollback/rollback_command.rb