cloudformation-tool 0.5.6 → 0.6.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c314efbe154da6923670e1db9e1d51dbe11ade89
|
4
|
+
data.tar.gz: 81803828778634c0e7fec5c5efc49f17f5fb5aff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ba0caf5fefe37f31ebfe74bb18537a393a1a163f1ae5fcbd48069e81cfb8e5e201347434ab8481d380d70735a94e0b4bd49300699151bf819f82dcc8ea0a5e7
|
7
|
+
data.tar.gz: 726c7b5c0bafe15e46271b7f11b5b198d99e1a7ad8e8867310bfcd00d095e3407fe0946a47d482ca89da8e1d4b8046728fbb0d7edc6eaba3b4ef12b5238752aa
|
@@ -35,6 +35,7 @@ module CloudFormationTool
|
|
35
35
|
subcommand 'status', "Check the current status of a stack", Status
|
36
36
|
subcommand 'delete', "Delete an existing stack", Delete
|
37
37
|
subcommand 'servers', 'List stack resources', Servers
|
38
|
+
subcommand 'output', 'Retrieve output values from the stack', Output
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
4
|
+
module CloudFormationTool
|
5
|
+
module CLI
|
6
|
+
class Output < Clamp::Command
|
7
|
+
|
8
|
+
parameter 'STACK_NAME', 'Name of the stack to create. Defaults to directory name'
|
9
|
+
|
10
|
+
def execute
|
11
|
+
st = CloudFormation::Stack.new(stack_name)
|
12
|
+
puts st.output
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -45,8 +45,8 @@ module CloudFormationTool
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def create(template, params = {})
|
48
|
-
|
49
|
-
url = upload(make_filename('yaml'),
|
48
|
+
@template = CloudFormation.parse(template).to_yaml(params)
|
49
|
+
url = upload(make_filename('yaml'), @template, gzip: false)
|
50
50
|
return update(url, template, params) if exist?
|
51
51
|
log "Creating stack '#{name}' from '#{template}' params #{params.inspect}"
|
52
52
|
begin
|
@@ -63,12 +63,32 @@ module CloudFormationTool
|
|
63
63
|
}
|
64
64
|
end
|
65
65
|
})
|
66
|
-
resp.stack_id
|
66
|
+
@stack_id = resp.stack_id
|
67
67
|
rescue Aws::CloudFormation::Errors::ValidationError => e
|
68
68
|
raise CloudFormationTool::Errors::ValidationError, "Stack validation error: #{e.message}"
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
def stack_id
|
73
|
+
@stack_id ||= awscf.describe_stacks(stack_name: @name).stacks.first.stack_id
|
74
|
+
end
|
75
|
+
|
76
|
+
def output
|
77
|
+
begin
|
78
|
+
key_width = 0
|
79
|
+
resp = awscf.list_exports
|
80
|
+
resp.exports.select do |exp|
|
81
|
+
exp.exporting_stack_id == stack_id
|
82
|
+
end.each do |exp|
|
83
|
+
key_width = [ key_width, exp.name.length ].max
|
84
|
+
end.collect do |exp|
|
85
|
+
"%-#{key_width}s: %s" % [ exp.name, exp.value ]
|
86
|
+
end
|
87
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
88
|
+
raise CloudFormationTool::Errors::AppError, "Failed to get resources: #{e.message}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
72
92
|
def resources
|
73
93
|
begin
|
74
94
|
resp = awscf.describe_stack_resources stack_name: @name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/cloud_formation_tool/cli/list_stacks.rb
|
73
73
|
- lib/cloud_formation_tool/cli/main.rb
|
74
74
|
- lib/cloud_formation_tool/cli/monitor.rb
|
75
|
+
- lib/cloud_formation_tool/cli/output.rb
|
75
76
|
- lib/cloud_formation_tool/cli/parameters.rb
|
76
77
|
- lib/cloud_formation_tool/cli/servers.rb
|
77
78
|
- lib/cloud_formation_tool/cli/status.rb
|