cloudformation-tool 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/cloud_formation_tool/cli/create.rb +15 -2
- data/lib/cloud_formation_tool/version.rb +1 -1
- 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: d9ce0c9c77f57cba29398cb97737457895e0cc14
|
4
|
+
data.tar.gz: 0a7e29cafeac6b00dd9643d1775f330b829ac8c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bd7cce116c116f4a63fb62591b0473c5dba3475be4895eafee62eb05c177652463e7fed2531b13fff82520d35b6be8c0cff14df47da2b16477146f419932384
|
7
|
+
data.tar.gz: e46a024b20d5d9cd93a69c2cb628a499e508b882e589dd12d9368cbbe933948b5d51cf29b744fbc911ae7d710ccc151605244f481eeeabb4c7a70194f10d07c5
|
data/README.md
CHANGED
@@ -204,11 +204,12 @@ The following commands are supported:
|
|
204
204
|
their default values.
|
205
205
|
- `compile` - Compile a CloudFormation template set (including all caching needed) and
|
206
206
|
output the resulting valid CloudFormation template to the console.
|
207
|
-
- `create` - Create or update a CloudFormation stack by compiling the specified template
|
207
|
+
- `create` - Create or update a CloudFormation stack by compiling the specified template
|
208
208
|
set and uploading it to CloudFormation. If no stack with the specified name exists, then
|
209
209
|
a new stack will be created, otherwise the existing stack will be updated. After sending the
|
210
210
|
template to CloudFormation, the tool will immediately start `monitor` mode until the
|
211
|
-
operation has completed successfully or with an error.
|
211
|
+
operation has completed successfully or with an error. Parameters can be specified on the
|
212
|
+
command line - like for the AWS CLI - or loaded from a file or URL.
|
212
213
|
- `monitor` - Track and display ongoing events for the named stack.
|
213
214
|
- `status` - Check if the names stack exists or not
|
214
215
|
- `delete` - Delete the specified stack. After issuing the delete command, the tool will
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
|
1
4
|
module CloudFormationTool
|
2
5
|
module CLI
|
3
6
|
class Create < Clamp::Command
|
@@ -10,15 +13,25 @@ module CloudFormationTool
|
|
10
13
|
"Use multiple times to set multiple parameters.",
|
11
14
|
"See 'parameters' command to list the paramaters supported by the tempalte."
|
12
15
|
].join("\n"), multivalued: true
|
13
|
-
option [ "-i", "--import" ], "FILE", "Import parameters from YAML file.", :attribute_name => :param_file
|
16
|
+
option [ "-i", "--import" ], "FILE", "Import parameters from YAML file or HTTP URL.", :attribute_name => :param_file
|
14
17
|
option [ "-k", "--import-key" ], "KEY", [
|
15
18
|
"When loading parameters from a YAML file, use the specified key to load a named",
|
16
19
|
"map from the file, instead of using just the file itself as the parameter map"
|
17
20
|
].join("\n"), :attribute_name => :param_key
|
18
21
|
|
22
|
+
def read_param_file(file)
|
23
|
+
param_uri = URI(file)
|
24
|
+
case param_uri.scheme
|
25
|
+
when /^http/
|
26
|
+
Net::HTTP.get(param_uri)
|
27
|
+
else
|
28
|
+
File.read(file)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
19
32
|
def get_params
|
20
33
|
params = if param_file
|
21
|
-
yaml = YAML.load(
|
34
|
+
yaml = YAML.load(read_param_file param_file).to_h
|
22
35
|
if param_key
|
23
36
|
raise "Missing parameter section '#{param_key}' in '#{param_file}'!" unless yaml[param_key].is_a? Hash
|
24
37
|
yaml[param_key]
|