sfn 0.3.8 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/sfn/command.rb +10 -0
- data/lib/sfn/command_module/stack.rb +39 -28
- data/lib/sfn/config.rb +19 -10
- data/lib/sfn/config/describe.rb +1 -1
- data/lib/sfn/config/destroy.rb +1 -1
- data/lib/sfn/config/events.rb +1 -1
- data/lib/sfn/config/export.rb +1 -1
- data/lib/sfn/config/import.rb +1 -1
- data/lib/sfn/config/inspect.rb +1 -1
- data/lib/sfn/config/list.rb +1 -1
- data/lib/sfn/config/promote.rb +1 -1
- data/lib/sfn/config/update.rb +8 -0
- data/lib/sfn/config/validate.rb +1 -1
- data/lib/sfn/version.rb +1 -1
- data/sfn.gemspec +2 -2
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3196ce66fd00b722a64b80efff9ed0cdd47103
|
4
|
+
data.tar.gz: 4a1d7fb290a7908253b92f4c822f70f5f0463b11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaec77115434aa9b9c984b7148e4cdd691838ccc97843b9a1ca323cd1beb2fcd552f82f39713f2cbad054771ba204b50a7bd2deca8cae22cf723771e9ae03fdf
|
7
|
+
data.tar.gz: 14110bca18d73ca198d2f1514be1446710283e6efbddada42fe75299cbf6ae73fba4fd7ca45ba0d20c240de897685f8aa9b26b0bdcd5e280075663bd2ccf1623
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## v0.4.0
|
2
|
+
* Fix parameters passed on CLI (#11)
|
3
|
+
* Fix credential overrides from the CLI (#14)
|
4
|
+
* Properly process CLI options through custom config classes
|
5
|
+
* Include AWS STS support via miasma-aws version bump
|
6
|
+
|
7
|
+
***NOTE***: Some CLI **short** flags have changed in this release. This is due to
|
8
|
+
some updates on flag generation to help keep things more
|
9
|
+
consistent now and into the future. Please refer to the help
|
10
|
+
output for a given command to view short flags.
|
11
|
+
|
1
12
|
## v0.3.8
|
2
13
|
* Fix result output from `update` command (#9)
|
3
14
|
* Fix `inspect` command to properly support multiple attribute flags
|
data/lib/sfn/command.rb
CHANGED
@@ -48,5 +48,15 @@ module Sfn
|
|
48
48
|
opts
|
49
49
|
end
|
50
50
|
|
51
|
+
# @return [Class] attempt to return customized configuration class
|
52
|
+
def config_class
|
53
|
+
klass_name = self.class.name.split('::').last
|
54
|
+
if(Sfn::Config.const_defined?(klass_name))
|
55
|
+
Sfn::Config.const_get(klass_name)
|
56
|
+
else
|
57
|
+
super
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
51
61
|
end
|
52
62
|
end
|
@@ -107,39 +107,50 @@ module Sfn
|
|
107
107
|
# @param stack [Hash] stack template
|
108
108
|
# @return [Hash]
|
109
109
|
def populate_parameters!(stack, current_params={})
|
110
|
-
if(
|
111
|
-
if(
|
112
|
-
|
113
|
-
config.
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
110
|
+
if(stack['Parameters'])
|
111
|
+
if(config.get(:parameter).is_a?(Array))
|
112
|
+
config[:parameter] = Smash[
|
113
|
+
*config.get(:parameter).map(&:to_a)
|
114
|
+
]
|
115
|
+
end
|
116
|
+
if(config.get(:parameters))
|
117
|
+
config.set(:parameters,
|
118
|
+
config.get(:parameters).merge(config[:parameter])
|
119
|
+
)
|
120
|
+
else
|
121
|
+
config.set(:parameters, config.fetch(:parameter, Smash.new))
|
122
|
+
end
|
123
|
+
stack.fetch('Parameters', {}).each do |k,v|
|
124
|
+
next if config[:parameters][k]
|
125
|
+
attempt = 0
|
126
|
+
valid = false
|
127
|
+
until(valid)
|
128
|
+
attempt += 1
|
129
|
+
default = config[:parameters].fetch(
|
130
|
+
k, current_params.fetch(
|
131
|
+
k, v['Default']
|
125
132
|
)
|
133
|
+
)
|
134
|
+
if(config[:interactive_parameters])
|
126
135
|
answer = ui.ask_question("#{k.split(/([A-Z]+[^A-Z]*)/).find_all{|s|!s.empty?}.join(' ')}", :default => default)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
validation.each do |validation_error|
|
135
|
-
ui.error validation_error.last
|
136
|
-
end
|
136
|
+
else
|
137
|
+
answer = default
|
138
|
+
end
|
139
|
+
validation = Sfn::Utils::StackParameterValidator.validate(answer, v)
|
140
|
+
if(validation == true)
|
141
|
+
unless(answer == v['Default'])
|
142
|
+
config[:parameters][k] = answer
|
137
143
|
end
|
138
|
-
|
139
|
-
|
140
|
-
|
144
|
+
valid = true
|
145
|
+
else
|
146
|
+
validation.each do |validation_error|
|
147
|
+
ui.error validation_error.last
|
141
148
|
end
|
142
149
|
end
|
150
|
+
if(attempt > MAX_PARAMETER_ATTEMPTS)
|
151
|
+
ui.fatal 'Failed to receive allowed parameter!'
|
152
|
+
exit 1
|
153
|
+
end
|
143
154
|
end
|
144
155
|
end
|
145
156
|
end
|
data/lib/sfn/config.rb
CHANGED
@@ -22,11 +22,22 @@ module Sfn
|
|
22
22
|
autoload :Update, 'sfn/config/update'
|
23
23
|
autoload :Validate, 'sfn/config/validate'
|
24
24
|
|
25
|
+
attribute(
|
26
|
+
:config, String,
|
27
|
+
:description => 'Configuration file path'
|
28
|
+
)
|
29
|
+
|
25
30
|
attribute(
|
26
31
|
:credentials, Smash,
|
27
32
|
:coerce => proc{|v|
|
28
|
-
|
29
|
-
|
33
|
+
case v
|
34
|
+
when String
|
35
|
+
Smash[v.split(',').map{|x| v.split(/[=:]/)}]
|
36
|
+
when Hash
|
37
|
+
v.to_smash
|
38
|
+
else
|
39
|
+
v
|
40
|
+
end
|
30
41
|
},
|
31
42
|
:description => 'Provider credentials'
|
32
43
|
)
|
@@ -53,10 +64,6 @@ module Sfn
|
|
53
64
|
:yes, [TrueClass, FalseClass],
|
54
65
|
:description => 'Automatically accept any requests for confirmation'
|
55
66
|
)
|
56
|
-
attribute(
|
57
|
-
:config, String,
|
58
|
-
:description => 'Configuration file path'
|
59
|
-
)
|
60
67
|
|
61
68
|
attribute :create, Create, :coerce => proc{|v| Create.new(v)}
|
62
69
|
attribute :update, Update, :coerce => proc{|v| Update.new(v)}
|
@@ -76,9 +83,7 @@ module Sfn
|
|
76
83
|
# @return [Smash]
|
77
84
|
def self.options_for(klass)
|
78
85
|
shorts = ['h'] # always reserve `-h` for help
|
79
|
-
_options_for(
|
80
|
-
_options_for(klass, shorts)
|
81
|
-
)
|
86
|
+
_options_for(klass, shorts)
|
82
87
|
end
|
83
88
|
|
84
89
|
# Provide options for config class
|
@@ -88,7 +93,11 @@ module Sfn
|
|
88
93
|
# @return [Smash]
|
89
94
|
def self._options_for(klass, shorts)
|
90
95
|
Smash[
|
91
|
-
klass.
|
96
|
+
([klass] + klass.ancestors).map do |a|
|
97
|
+
if(a.ancestors.include?(Bogo::Config) && !a.attributes.empty?)
|
98
|
+
a.attributes
|
99
|
+
end
|
100
|
+
end.compact.reverse.inject(Smash.new){|m, n| m.deep_merge(n)}.map do |name, info|
|
92
101
|
next unless info[:description]
|
93
102
|
short = name.chars.zip(name.chars.map(&:upcase)).flatten.detect do |c|
|
94
103
|
!shorts.include?(c)
|
data/lib/sfn/config/describe.rb
CHANGED
data/lib/sfn/config/destroy.rb
CHANGED
data/lib/sfn/config/events.rb
CHANGED
data/lib/sfn/config/export.rb
CHANGED
data/lib/sfn/config/import.rb
CHANGED
data/lib/sfn/config/inspect.rb
CHANGED
data/lib/sfn/config/list.rb
CHANGED
data/lib/sfn/config/promote.rb
CHANGED
data/lib/sfn/config/update.rb
CHANGED
@@ -14,6 +14,14 @@ module Sfn
|
|
14
14
|
:multiple => true,
|
15
15
|
:description => 'Apply outputs from stack to input parameters'
|
16
16
|
)
|
17
|
+
attribute(
|
18
|
+
:parameter, Smash,
|
19
|
+
:multiple => true,
|
20
|
+
:description => 'Pass template parameters directly (ParamName:ParamValue)',
|
21
|
+
:coerce => lambda{|v|
|
22
|
+
v.is_a?(String) ? Smash[*v.split(/[=:]/, 2)] : v
|
23
|
+
}
|
24
|
+
)
|
17
25
|
|
18
26
|
end
|
19
27
|
end
|
data/lib/sfn/config/validate.rb
CHANGED
data/lib/sfn/version.rb
CHANGED
data/sfn.gemspec
CHANGED
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = 'SparkleFormation CLI'
|
11
11
|
s.license = 'Apache-2.0'
|
12
12
|
s.require_path = 'lib'
|
13
|
-
s.add_dependency 'bogo-cli', '~> 0.1.
|
13
|
+
s.add_dependency 'bogo-cli', '~> 0.1.21'
|
14
14
|
s.add_dependency 'miasma', '~> 0.2.20'
|
15
|
-
s.add_dependency 'miasma-aws', '~> 0.1.
|
15
|
+
s.add_dependency 'miasma-aws', '~> 0.1.16'
|
16
16
|
s.add_dependency 'net-ssh'
|
17
17
|
s.add_dependency 'sparkle_formation', '>= 0.2.8'
|
18
18
|
s.executables << 'sfn'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo-cli
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.21
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.21
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: miasma
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.1.
|
47
|
+
version: 0.1.16
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.16
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: net-ssh
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,4 +162,3 @@ signing_key:
|
|
162
162
|
specification_version: 4
|
163
163
|
summary: SparkleFormation CLI
|
164
164
|
test_files: []
|
165
|
-
has_rdoc:
|