stack_master 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: f8f3ec342c9c81f5cac5ebd53b5b1b85b9bdb2639909eb30e417bd3f47245a8e
4
- data.tar.gz: c4845e2cbc067c72b28a7384dca7d09e2f06b4c0674bf87b40944b1ef4bd5071
2
+ SHA1:
3
+ metadata.gz: 9db7bab79978f6540e7782d510bbfa244e20a17c
4
+ data.tar.gz: 42668064c6f38367d645112bf2fbea084bd4084c
5
5
  SHA512:
6
- metadata.gz: 259d79a2d44819916e2f7517cfda964bfd0aae5565baf21f78f43a0d985c865beaff38adf01e2514a484a886543b70d7704387962da2ea98d81b6f4a5cb43861
7
- data.tar.gz: 8512744614c1a54960771e4fe6f61439693a1c086d1cc6c18bf00ab97f2f1345e57b532151926bc5035ca018ff2127d2fca3358f57911d88023558d9de0e8936
6
+ metadata.gz: f8399293cf7b92cbdc7573b83863547b75351eff2dbcf6de2c5661365326c75c085d0497eb3f12f92723f3bbfd2cb0942e6cef3f31cc089cb67b1d410fe5824e
7
+ data.tar.gz: d836db6fdbc9d2fc8b698186e8a51ca10aab899d802144458b7c3179af627483b155476e8f5c5fc6f7601404a7b31cc90c57966422e5fcf936597c43ee825103
@@ -42,6 +42,7 @@ module StackMaster
42
42
  c.description = "Creates or updates a stack. Shows a diff of the proposed stack's template and parameters. Tails stack events until CloudFormation has completed."
43
43
  c.example 'update a stack named myapp-vpc in us-east-1', 'stack_master apply us-east-1 myapp-vpc'
44
44
  c.option '--on-failure ACTION', String, "Action to take on CREATE_FAILURE. Valid Values: [ DO_NOTHING | ROLLBACK | DELETE ]. Default: ROLLBACK\nNote: You cannot use this option with Serverless Application Model (SAM) templates."
45
+ c.option '--yes-param PARAM_NAME', String, "Auto-approve stack updates when only parameter PARAM_NAME changes"
45
46
  c.action do |args, options|
46
47
  options.defaults config: default_config_file
47
48
  execute_stacks_command(StackMaster::Commands::Apply, args, options)
@@ -13,6 +13,7 @@ module StackMaster
13
13
  @from_time = Time.now
14
14
  @options = options
15
15
  @options.on_failure ||= nil
16
+ @options.yes_param ||= nil
16
17
  end
17
18
 
18
19
  def perform
@@ -59,7 +60,11 @@ module StackMaster
59
60
 
60
61
  def diff_stacks
61
62
  abort_if_review_in_progress
62
- StackDiffer.new(proposed_stack, stack).output_diff
63
+ differ.output_diff
64
+ end
65
+
66
+ def differ
67
+ @differ ||= StackDiffer.new(proposed_stack, stack)
63
68
  end
64
69
 
65
70
  def create_or_update_stack
@@ -125,12 +130,20 @@ module StackMaster
125
130
  halt!(@change_set.status_reason)
126
131
  end
127
132
 
133
+ if differ.single_param_update?(@options.yes_param)
134
+ StackMaster.stdout.puts("Auto-approving update to single parameter #{@options.yes_param}")
135
+ else
136
+ ask_update_confirmation!
137
+ end
128
138
  @change_set.display(StackMaster.stdout)
139
+ execute_change_set
140
+ end
141
+
142
+ def ask_update_confirmation!
129
143
  unless ask?("Apply change set (y/n)? ")
130
144
  ChangeSet.delete(@change_set.id)
131
145
  halt! "Stack update aborted"
132
146
  end
133
- execute_change_set
134
147
  end
135
148
 
136
149
  def upload_files
@@ -1,4 +1,5 @@
1
1
  require "diffy"
2
+ require "hashdiff"
2
3
 
3
4
  module StackMaster
4
5
  class StackDiffer
@@ -72,6 +73,14 @@ module StackMaster
72
73
  end
73
74
  end
74
75
 
76
+ def single_param_update?(param_name)
77
+ return false if param_name.blank? || @current_stack.blank? || body_different?
78
+ differences = HashDiff.diff(@current_stack.parameters_with_defaults, @proposed_stack.parameters_with_defaults)
79
+ return false if differences.count != 1
80
+ diff = differences[0]
81
+ diff[0] == "~" && diff[1] == param_name
82
+ end
83
+
75
84
  private
76
85
 
77
86
  def display_diff(thing, diff)
@@ -1,3 +1,3 @@
1
1
  module StackMaster
2
- VERSION = "1.10.0"
2
+ VERSION = "1.11.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hodgkiss
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-14 00:00:00.000000000 Z
12
+ date: 2018-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -375,6 +375,20 @@ dependencies:
375
375
  - - ">="
376
376
  - !ruby/object:Gem::Version
377
377
  version: '0'
378
+ - !ruby/object:Gem::Dependency
379
+ name: hashdiff
380
+ requirement: !ruby/object:Gem::Requirement
381
+ requirements:
382
+ - - ">="
383
+ - !ruby/object:Gem::Version
384
+ version: '0'
385
+ type: :runtime
386
+ prerelease: false
387
+ version_requirements: !ruby/object:Gem::Requirement
388
+ requirements:
389
+ - - ">="
390
+ - !ruby/object:Gem::Version
391
+ version: '0'
378
392
  - !ruby/object:Gem::Dependency
379
393
  name: dotgpg
380
394
  requirement: !ruby/object:Gem::Requirement
@@ -500,7 +514,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
500
514
  version: '0'
501
515
  requirements: []
502
516
  rubyforge_project:
503
- rubygems_version: 2.7.6
517
+ rubygems_version: 2.4.5.2
504
518
  signing_key:
505
519
  specification_version: 4
506
520
  summary: StackMaster is a sure-footed way of creating, updating and keeping track