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
19
20
21
22
23
24
25
26
# File 'lib/jets/commands/rollback/rollback_command.rb', line 15

def initialize(options={})
  @options = options
  @version = options[:version]
  # Handle more gracefully than the way Jets does it currently
  if @version.nil?
    puts "      ERROR: version required\n      Usage: jets rollback VERSION\n    EOL\n    exit 1\n  end\nend\n"

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



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jets/commands/rollback/rollback_command.rb', line 28

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