CfnTools 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/CfnTools.rb +33 -30
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa4b0f7a6618b9ff07a53f7dc816e9a9fab54bd6
4
- data.tar.gz: ffe497e34409b62484b545553ce64c7c0d1d387f
3
+ metadata.gz: f5f6c53dd5c5ea082905af92f85778545b2cff90
4
+ data.tar.gz: 98458e407b17e3d427da4d921903eab689940e33
5
5
  SHA512:
6
- metadata.gz: f313ea53fc0fffc2258742c94def7a61a50b760aad49551abe8cc9cbd1dfa78e6bddcbe91eeee4cfe87a7c8cda9603217e3758217409652559865afd63d7751b
7
- data.tar.gz: 20f590299cbd2da3e5f3945b69a0d03e5eecd82bb862b7dfa2d1ea874e8266361fa124fc9f5c1d0ea06bd1c85e059267d4cbc397168f6dc864254c1f474a4267
6
+ metadata.gz: 7770aab053591b2adfe016f4241998225bcfce3f2805b3f73937c0dbe77a0e69df12264b46e8c8afe229c4025265ae6f52b973af10f719c5a6c91db735bfea9d
7
+ data.tar.gz: 631bb232b2fc190b1ea6bd7c02208c1565c378fc1e12e9993bfeea323fd48d2fe30f00827c315bc934df110820a3cbc966fdce7665231194bf8d5dd0de62e225
data/lib/CfnTools.rb CHANGED
@@ -13,11 +13,9 @@ class CfnTools
13
13
  exit 1
14
14
  end
15
15
 
16
- @substacks = get_sub_stacks
17
- @stack_as = Array.new()
16
+ @substacks = nil
17
+ @stack_as = nil
18
18
  @stack_events = Set.new()
19
-
20
- get_stack_as()
21
19
  end
22
20
 
23
21
  def ret_stack_name()
@@ -25,11 +23,11 @@ class CfnTools
25
23
  end
26
24
 
27
25
  def ret_substacks()
28
- return @substacks
26
+ return get_sub_stacks()
29
27
  end
30
28
 
31
29
  def ret_stack_as()
32
- return @stack_as
30
+ return get_stack_as()
33
31
  end
34
32
 
35
33
  def ret_stack_events()
@@ -44,38 +42,43 @@ class CfnTools
44
42
  end
45
43
 
46
44
  def get_sub_stacks()
47
- substacks = Set.new
48
45
  AWS.memoize do
49
- stack = @cfn.stacks[@stack_name]
50
- stack.resource_summaries.each do |resource|
51
- if resource[:resource_type] == 'AWS::CloudFormation::Stack'
52
- if resource[:physical_resource_id].is_a? String
53
- substacks.add( resource[:physical_resource_id] )
46
+ if @substacks.nil?
47
+ @substacks = []
48
+ stack = @cfn.stacks[@stack_name]
49
+ stack.resource_summaries.each do |resource|
50
+ if resource[:resource_type] == 'AWS::CloudFormation::Stack'
51
+ if resource[:physical_resource_id].is_a? String
52
+ @substacks.push( resource[:physical_resource_id] )
53
+ end
54
54
  end
55
55
  end
56
56
  end
57
+ return @substacks
57
58
  end
58
- return substacks
59
59
  end
60
60
 
61
61
  def get_stack_as()
62
- AWS.memoize do
63
- stack = @cfn.stacks[@stack_name]
64
- stack.resource_summaries.each do |resource|
65
- if resource[:resource_type] == 'AWS::AutoScaling::AutoScalingGroup'
66
- @stack_as.push( resource[:physical_resource_id])
67
- end
68
- end
69
- @substacks.each do |substack|
70
- stack = @cfn.stacks[substack]
71
- stack.resource_summaries.each do |resource|
72
- if resource[:resource_type] == 'AWS::AutoScaling::AutoScalingGroup'
73
- @stack_as.push( resource[:physical_resource_id])
74
- end
75
- end
62
+ AWS.memoize do
63
+ if @stack_as.nil?
64
+ @stack_as = []
65
+ stack = @cfn.stacks[@stack_name]
66
+ stack.resource_summaries.each do |resource|
67
+ if resource[:resource_type] == 'AWS::AutoScaling::AutoScalingGroup'
68
+ @stack_as.push( resource[:physical_resource_id])
69
+ end
70
+ end
71
+ get_sub_stacks().each do |substack|
72
+ stack = @cfn.stacks[substack]
73
+ stack.resource_summaries.each do |resource|
74
+ if resource[:resource_type] == 'AWS::AutoScaling::AutoScalingGroup'
75
+ @stack_as.push( resource[:physical_resource_id])
76
+ end
77
+ end
78
+ end
76
79
  end
77
- end
78
- return @stack_as
80
+ return @stack_as
81
+ end
79
82
  end
80
83
 
81
84
  def get_as_instances( as_name)
@@ -96,7 +99,7 @@ class CfnTools
96
99
 
97
100
  def get_stack_events()
98
101
  events = Array.new()
99
- stacks = @substacks
102
+ stacks = get_sub_stacks()
100
103
  stacks.push( @stack_name)
101
104
  AWS.memoize do
102
105
  stacks.each do |stack|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CfnTools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Schrock