cfn-status 0.4.0 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8d1438c2c6bb5426c57b656fa117bc93c178c2ac85ab0334b7dedba8e5330b4
4
- data.tar.gz: 1b2896136526de36f3ea55f27d3313bf486c198c7f8d5ecb48fea47ff5f03ccd
3
+ metadata.gz: 81771e2b6dbaf3b2110fef3f54f45b311a0f99ba3e21f33995260c48a10ccf20
4
+ data.tar.gz: e39669027cf91efb0a14f8f8f0b365b130008a42b90bd3c57ecbd20ad29328c3
5
5
  SHA512:
6
- metadata.gz: 748fb35140200de97901e0f39bcc300fd4cf1f3261de7f3f406297aec210907b37f71e787bb9d7a69a7fde2b9d9f7bcdfd2f1fcd5d03bb4c03f61f180aa623a4
7
- data.tar.gz: efb43467da800ac14fc4ede985011ff248a3cba4a174fe9f89e3358ee2acc03a615d340759f30220941467fc3186999b3ed8484acf8c048baae0a58281d27f6c
6
+ metadata.gz: 53506afafeefe75a51d71352192b64ffed381688d837a61147d4477dacc1c0ff1b89cc4ff1f9858392d0df9aa7eeddd62c4e30c5e5ee5756698d8f37c775c8fb
7
+ data.tar.gz: 38c5745c0faec6144f50135c1d7b392ed45b00d140d17623d76846dd49fe03db1eca213a093ceb3ebcd3fde03a7dee905538a5b6721c6053af8982dc4d6e27f2
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely* adheres to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.4.4] - 2022-02-14
7
+ - more generic time took message
8
+
9
+ ## [0.4.3] - 2021-05-27
10
+ - [#4](https://github.com/tongueroo/cfn-status/pull/4) fix current status message
11
+
12
+ ## [0.4.2]
13
+ - #3 improve messaging when wait called directly. dont show old events.
14
+
15
+ ## [0.4.1]
16
+ - fix require cfn_status/rollback_stack
17
+
6
18
  ## [0.4.0]
7
19
  - #2 add handle_rollback! method
8
20
 
@@ -1,3 +1,3 @@
1
1
  class CfnStatus
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.4"
3
3
  end
data/lib/cfn_status.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "cfn_status/version"
2
+ require "cfn_status/rollback_stack"
2
3
 
3
4
  class CfnStatus
4
5
  class Error < StandardError; end
@@ -6,11 +7,13 @@ class CfnStatus
6
7
  autoload :AwsService, "cfn_status/aws_service"
7
8
  include AwsService
8
9
 
9
- attr_reader :events
10
+ attr_reader :events, :stack
10
11
  def initialize(stack_name, options={})
11
12
  @stack_name = stack_name
12
13
  @options = options
13
14
  @cfn = options[:cfn] # allow use of different cfn client. can be useful multiple cfn clients and with different regions
15
+ resp = cfn.describe_stacks(stack_name: @stack_name)
16
+ @stack = resp.stacks.first
14
17
  reset
15
18
  end
16
19
 
@@ -20,11 +23,8 @@ class CfnStatus
20
23
  return true
21
24
  end
22
25
 
23
- resp = cfn.describe_stacks(stack_name: @stack_name)
24
- stack = resp.stacks.first
25
-
26
26
  puts "The current status for the stack #{@stack_name.color(:green)} is #{stack.stack_status.color(:green)}"
27
- if stack.stack_status =~ /_IN_PROGRESS$/
27
+ if in_progress?
28
28
  puts "Stack events (tailing):"
29
29
  # tail all events until done
30
30
  @hide_time_took = true
@@ -38,6 +38,11 @@ class CfnStatus
38
38
  success?
39
39
  end
40
40
 
41
+ def in_progress?
42
+ in_progress = stack.stack_status =~ /_IN_PROGRESS$/
43
+ !!in_progress
44
+ end
45
+
41
46
  def reset
42
47
  @events = [] # constantly replaced with recent events
43
48
  @last_shown_event_id = nil
@@ -46,6 +51,10 @@ class CfnStatus
46
51
 
47
52
  # check for /(_COMPLETE|_FAILED)$/ status
48
53
  def wait
54
+ # Check for in progress again in case .wait is called from other libraries like s3-antivirus
55
+ # Showing the event messages when will show old messages which can be confusing.
56
+ return unless in_progress?
57
+
49
58
  puts "Waiting for stack to complete"
50
59
  start_time = Time.now
51
60
 
@@ -74,7 +83,7 @@ class CfnStatus
74
83
 
75
84
  return if @hide_time_took # set in run
76
85
  took = Time.now - start_time
77
- puts "Time took for stack deployment: #{pretty_time(took).color(:green)}."
86
+ puts "Time took: #{pretty_time(took).color(:green)}."
78
87
  success?
79
88
  end
80
89
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfn-status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-23 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-cloudformation
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.1.2
111
+ rubygems_version: 3.2.32
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: CloudFormation status library