stack_master 1.11.1 → 1.12.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
2
  SHA256:
3
- metadata.gz: 7a1a98bc3f233b4e4be787c1a070901daebe08fa27d62758c25d242fcc68cc6d
4
- data.tar.gz: 622115d25e6108fa09786bb285066e2bc774d12a5ad949171172dd8ca52b6d82
3
+ metadata.gz: 4c1f1a20264fc1716e6a5d576be33423a4f66d7c7795223156063c96e4d68bb5
4
+ data.tar.gz: d6c8a82fd2b14836d23527952b260485dd54082cf045d73a6aeb7203024091cb
5
5
  SHA512:
6
- metadata.gz: b6ed11859f60804e985d1d68d195cce27fc31c669403c9d8780871d02ee2de575844acf4e8a59d133044e50d13d7520fddc06a1d5302c6acca6636eb069e29a0
7
- data.tar.gz: f151ed9602e66d54dbb4ff3129f3fd43dcdefda321e62f47a6a01cf4441a9087159b5bda429b261ec9d2b0eedb4c228f07ce5cb72b46241637bc4c18aad5fd47
6
+ metadata.gz: 51b1d5a1bd8b1ff4e892763203a823dd65bc2e42720e8804aa1382e5068e7bc9a4c207de0f9699cd65db7f730fefa9970528fe885e522c005294ff83a71ac97a
7
+ data.tar.gz: 5a3b584eb9eb3c88ae84dbcb882648a212ce658b9d0cd9e58c7e81e72234708add9f50c474f44b8f3cb69aa7544bea758fdea8baa32138cbff7b83e39477a7f8
data/README.md CHANGED
@@ -344,7 +344,7 @@ Returns the docker repository URI, i.e. `aws_account_id.dkr.ecr.region.amazonaws
344
344
  container_image_id:
345
345
  latest_container:
346
346
  repository_name: nginx # Required. The name of the repository
347
- registry_id: 012345678910 # The AWS Account ID the repository is located in. Defaults to the current account's default registry
347
+ registry_id: "012345678910" # The AWS Account ID the repository is located in. Defaults to the current account's default registry. Must be in quotes.
348
348
  region: us-east-1 # Defaults to the region the stack is located in
349
349
  tag: production # By default we'll find the latest image pushed to the repository. If tag is specified we return the sha digest of the image with this tag
350
350
  ```
data/lib/stack_master.rb CHANGED
@@ -94,6 +94,10 @@ module StackMaster
94
94
  autoload :Streamer, 'stack_master/stack_events/streamer'
95
95
  end
96
96
 
97
+ NON_INTERACTIVE_DEFAULT = false
98
+ DEBUG_DEFAULT = false
99
+ QUIET_DEFAULT = false
100
+
97
101
  def interactive?
98
102
  !non_interactive?
99
103
  end
@@ -101,7 +105,7 @@ module StackMaster
101
105
  def non_interactive?
102
106
  @non_interactive
103
107
  end
104
- @non_interactive = false
108
+ @non_interactive = NON_INTERACTIVE_DEFAULT
105
109
 
106
110
  def non_interactive!
107
111
  @non_interactive = true
@@ -110,7 +114,7 @@ module StackMaster
110
114
  def debug!
111
115
  @debug = true
112
116
  end
113
- @debug = false
117
+ @debug = DEBUG_DEFAULT
114
118
 
115
119
  def debug?
116
120
  @debug
@@ -121,6 +125,19 @@ module StackMaster
121
125
  stderr.puts "[DEBUG] #{message}".colorize(:green)
122
126
  end
123
127
 
128
+ def quiet!
129
+ @quiet = true
130
+ end
131
+ @quiet = QUIET_DEFAULT
132
+
133
+ def quiet?
134
+ @quiet
135
+ end
136
+
137
+ def reset_flags
138
+ @quiet = QUIET_DEFAULT
139
+ end
140
+
124
141
  attr_accessor :non_interactive_answer
125
142
  @non_interactive_answer = 'y'
126
143
 
@@ -35,6 +35,9 @@ module StackMaster
35
35
  global_option '-d', '--debug', 'Run in debug mode' do
36
36
  StackMaster.debug!
37
37
  end
38
+ global_option '-q', '--quiet', 'Do not output the resulting Stack Events, just return immediately' do
39
+ StackMaster.quiet!
40
+ end
38
41
 
39
42
  command :apply do |c|
40
43
  c.syntax = 'stack_master apply [region_or_alias] [stack_name]'
@@ -187,8 +190,10 @@ module StackMaster
187
190
  region = args[0]
188
191
  end
189
192
 
193
+ stack_name = Utils.underscore_to_hyphen(args[1])
194
+
190
195
  StackMaster.cloud_formation_driver.set_region(region)
191
- StackMaster::Commands::Delete.perform(region, args[1])
196
+ StackMaster::Commands::Delete.perform(region, stack_name)
192
197
  end
193
198
  end
194
199
 
@@ -21,7 +21,7 @@ module StackMaster
21
21
  ensure_valid_parameters!
22
22
  ensure_valid_template_body_size!
23
23
  create_or_update_stack
24
- tail_stack_events
24
+ tail_stack_events unless StackMaster.quiet?
25
25
  set_stack_policy
26
26
  end
27
27
 
@@ -20,7 +20,7 @@ module StackMaster
20
20
  end
21
21
 
22
22
  delete_stack
23
- tail_stack_events
23
+ tail_stack_events unless StackMaster.quiet?
24
24
  end
25
25
 
26
26
  private
@@ -17,12 +17,14 @@ module StackMaster
17
17
  ecr_client = Aws::ECR::Client.new(region: @region)
18
18
 
19
19
  images = fetch_images(parameters['repository_name'], parameters['registry_id'], ecr_client)
20
- return nil if images.empty?
21
20
 
22
- if !parameters['tag'].nil?
21
+ unless parameters['tag'].nil?
23
22
  images.select! { |image| image.image_tags.any? { |tag| tag == parameters['tag'] } }
24
23
  end
25
24
  images.sort! { |image_x, image_y| image_y.image_pushed_at <=> image_x.image_pushed_at }
25
+
26
+ return nil if images.empty?
27
+
26
28
  latest_image = images.first
27
29
 
28
30
  # aws_account_id.dkr.ecr.region.amazonaws.com/repository@sha256:digest
@@ -1,3 +1,3 @@
1
1
  module StackMaster
2
- VERSION = "1.11.1"
2
+ VERSION = "1.12.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.11.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hodgkiss
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-16 00:00:00.000000000 Z
12
+ date: 2019-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '1.5'
20
+ version: '0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '1.5'
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement