CfnTools 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/CfnTools.rb +33 -30
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5f6c53dd5c5ea082905af92f85778545b2cff90
|
4
|
+
data.tar.gz: 98458e407b17e3d427da4d921903eab689940e33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
17
|
-
@stack_as =
|
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
|
26
|
+
return get_sub_stacks()
|
29
27
|
end
|
30
28
|
|
31
29
|
def ret_stack_as()
|
32
|
-
return
|
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
-
|
78
|
-
|
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 =
|
102
|
+
stacks = get_sub_stacks()
|
100
103
|
stacks.push( @stack_name)
|
101
104
|
AWS.memoize do
|
102
105
|
stacks.each do |stack|
|