Class: Jets::Command::Rollback

Inherits:
Object
  • Object
show all
Includes:
ApiHelpers
Defined in:
lib/jets/commands/rollback/rollback_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ApiHelpers

#check_for_error_message!, #no_token_exit!, #paging_params

Constructor Details

#initialize(options = {}) ⇒ Rollback

Returns a new instance of Rollback.



15
16
17
18
# File 'lib/jets/commands/rollback/rollback_command.rb', line 15

def initialize(options={})
  @options = options
  @version = options[:version]
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



14
15
16
# File 'lib/jets/commands/rollback/rollback_command.rb', line 14

def version
  @version
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jets/commands/rollback/rollback_command.rb', line 20

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