cfncli 1.0.0 → 1.0.1
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 +4 -4
- data/lib/cfncli/cli.rb +26 -8
- data/lib/cfncli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ca8cd69cab57255028fe13c61cf07be2af98b9a7e90daa098703da18a37c0c7
|
4
|
+
data.tar.gz: 6f76676d81fc30fbc176155cc8a0a4ecadaaa4080a02e25ed58674c5f4085039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5314d09ce9efa1bdc909d753042f7078a4fe23ded88012ae234b8536118b12114f2a63101e9d2753ad7ef9aa7d3b35398ae7bdc98e0278d7d38cf01d8f60b0cc
|
7
|
+
data.tar.gz: d74553025f0554aed5309246cc603fdb2eb46663d87ec716efaa68e9511085c2c945f9883fd90a7ba738f268371696d10646e23f36c397f7ca549300b2920ebf
|
data/lib/cfncli/cli.rb
CHANGED
@@ -58,8 +58,8 @@ module CfnCli
|
|
58
58
|
'the stack that you are updating.'
|
59
59
|
|
60
60
|
method_option 'parameters',
|
61
|
-
type: :
|
62
|
-
desc: 'Stack parameters. Pass each parameter in the form --parameters key1
|
61
|
+
type: :array,
|
62
|
+
desc: 'Stack parameters. Pass each parameter in the form --parameters ParameterValue=key1,ParameterValue=value1 ParameterKey=key2,ParameterValue2=value2 or use the @filename syntax to provide a JSON file'
|
63
63
|
|
64
64
|
method_option 'parameters_file',
|
65
65
|
type: :string,
|
@@ -354,12 +354,7 @@ module CfnCli
|
|
354
354
|
return file_or_content(parameters) if file_param? parameters
|
355
355
|
|
356
356
|
# Otherwise convert each param to the cfn structure
|
357
|
-
parameters
|
358
|
-
{
|
359
|
-
parameter_key: param['ParameterKey'],
|
360
|
-
parameter_value: param['ParameterValue']
|
361
|
-
}
|
362
|
-
end
|
357
|
+
parse_cli_params(parameters)
|
363
358
|
end
|
364
359
|
|
365
360
|
def process_stack_tags(tags)
|
@@ -372,6 +367,29 @@ module CfnCli
|
|
372
367
|
real_tags
|
373
368
|
end
|
374
369
|
|
370
|
+
def parse_cli_params(params)
|
371
|
+
validation_failures = []
|
372
|
+
parsed_params = params.map.with_index do |param, i|
|
373
|
+
key, value = param.split(',', 2)
|
374
|
+
if key.to_s.empty? || value.to_s.empty?
|
375
|
+
validation_failures << "- Parameter[#{i}] format invalid: #{param}"
|
376
|
+
next
|
377
|
+
end
|
378
|
+
param_key_key, param_key_value = key.split('=', 2)
|
379
|
+
param_value_key, param_value_value = value.split('=', 2)
|
380
|
+
validation_failures << "- Parameter[#{i}] missing ParameterKey key: #{param}" unless param_key_key.downcase == 'parameterkey'
|
381
|
+
validation_failures << "- Parameter[#{i}] missing ParameterKey value: #{param}" if param_key_value.to_s.empty?
|
382
|
+
validation_failures << "- Parameter[#{i}] missing ParameterValue key: #{param}" unless param_value_key.downcase == 'parametervalue'
|
383
|
+
validation_failures << "- Parameter[#{i}] missing ParameterValue value: #{param}" if param_value_value.to_s.empty?
|
384
|
+
{
|
385
|
+
parameter_key: param_key_value,
|
386
|
+
parameter_value: param_value_value
|
387
|
+
}
|
388
|
+
end
|
389
|
+
raise "Parameter validation failed:\n#{validation_failures.join("\n")}" unless validation_failures.empty?
|
390
|
+
parsed_params
|
391
|
+
end
|
392
|
+
|
375
393
|
# Cloudformation utility object
|
376
394
|
def cfn
|
377
395
|
@cfn ||= CfnCli::CloudFormation.new
|
data/lib/cfncli/version.rb
CHANGED