sfn 1.1.16 → 1.2.0
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/CHANGELOG.md +54 -48
- data/docs/configuration.md +8 -0
- data/lib/sfn/command/update.rb +3 -1
- data/lib/sfn/command_module/template.rb +13 -2
- data/lib/sfn/config.rb +44 -19
- data/lib/sfn/config/conf.rb +2 -1
- data/lib/sfn/config/create.rb +11 -10
- data/lib/sfn/config/describe.rb +6 -3
- data/lib/sfn/config/diff.rb +2 -1
- data/lib/sfn/config/events.rb +6 -3
- data/lib/sfn/config/inspect.rb +11 -5
- data/lib/sfn/config/list.rb +6 -3
- data/lib/sfn/config/update.rb +28 -6
- data/lib/sfn/config/validate.rb +22 -11
- data/lib/sfn/planner/aws.rb +29 -11
- data/lib/sfn/version.rb +1 -1
- data/sfn.gemspec +3 -0
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb52f9ec870e82eaf0e32aaba64f4c4ea05badf8
|
4
|
+
data.tar.gz: 54939ef76128913964444beb09d72d8c4c4b1447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6727eeb62882084fab9f4207f2ccea58160155a16410c6051ff1970e35a70702af087020c972c1c5d40941a5c5917a4fe0b3f5e8351f11aa70574b85ba1d830e
|
7
|
+
data.tar.gz: c7390a1b826f92b231e0b2d6df9f97258a9381824d5e6826d58496ee5044b7c5e9d322f77da7f8c0e878c98ffcfb72c888ef73186826453ad8419628823832ca
|
data/CHANGELOG.md
CHANGED
@@ -1,52 +1,58 @@
|
|
1
|
-
|
1
|
+
# v1.2.0
|
2
|
+
* [fix] Always require packs when loading
|
3
|
+
* [fix] Prevent stale output display on update
|
4
|
+
* [enhancement] Coerce hash type configurations consistently
|
5
|
+
* [enhancement] Force short flags to prevent change
|
6
|
+
|
7
|
+
# v1.1.16
|
2
8
|
* [fix] Duplicate template when dereferencing within planner
|
3
9
|
|
4
|
-
|
10
|
+
# v1.1.14
|
5
11
|
* [fix] Use correct name part for building callback name
|
6
12
|
|
7
|
-
|
13
|
+
# v1.1.12
|
8
14
|
* [enhancement] Include updated time information on stack list
|
9
15
|
* [enhancement] Support pseudo-parameters in update planning
|
10
16
|
* AWS only as it is currently the only implementation
|
11
17
|
|
12
|
-
|
18
|
+
# v1.1.10
|
13
19
|
* [enhancement] Better configuration related errors
|
14
20
|
* [fix] Planning display on stack removal (#75)
|
15
21
|
* [fix] Remove stack properties on update request (#76)
|
16
22
|
* [enhancement] Add `retries` config alias for `retry` (#77)
|
17
23
|
|
18
|
-
|
24
|
+
# v1.1.8
|
19
25
|
* [fix] Disable knife config mashing to get expected values (#72)
|
20
26
|
* [feature] Add new `conf` command (#72)
|
21
27
|
* [feature] Add planning support for stack updates (#69)
|
22
28
|
|
23
|
-
|
29
|
+
# v1.1.6
|
24
30
|
* [fix] set proper parameter hash on apply stack (#67)
|
25
31
|
|
26
|
-
|
32
|
+
# v1.1.4
|
27
33
|
* [feature] Add new `diff` command
|
28
34
|
|
29
|
-
|
35
|
+
# v1.1.2
|
30
36
|
* [fix] stack update when extracting compile time state
|
31
37
|
* [fix] remove use of `root_path` method when shallow nesting is in use
|
32
38
|
|
33
|
-
|
39
|
+
# v1.1.0
|
34
40
|
* Add support for compile time parameters
|
35
41
|
* Fix valid stack type check on child stack connections
|
36
42
|
* Provide output context for template location when prompting parameters
|
37
43
|
* Use full stack path naming for bucket file names when storing
|
38
44
|
|
39
|
-
|
45
|
+
# v1.0.4
|
40
46
|
* [fix] Set template prior to apply on update to find new parameters
|
41
47
|
* Disable parameter validation warning on deep nesting
|
42
48
|
* Update parameter detection on updates when using deep nesting
|
43
49
|
|
44
|
-
|
50
|
+
# v1.0.2
|
45
51
|
* [fix] Properly detect local pack directory if available
|
46
52
|
* Add `print` command for printing generated templates
|
47
53
|
* Add support for custom stack resource types
|
48
54
|
|
49
|
-
|
55
|
+
# v1.0.0
|
50
56
|
|
51
57
|
_NOTE: This release contains breaking changes! Please review the
|
52
58
|
changes in this release and test your configuration and
|
@@ -66,28 +72,28 @@ _NOTE: This release contains breaking changes! Please review the
|
|
66
72
|
* Add support for AWS stack policies via optional callback
|
67
73
|
* And lots of internal refactors!
|
68
74
|
|
69
|
-
|
75
|
+
# v0.4.12
|
70
76
|
* Fix transient uninitialized constant error for update command
|
71
77
|
|
72
|
-
|
78
|
+
# v0.4.10
|
73
79
|
* Fix error when no options are provided within config (#18)
|
74
80
|
* Fix error when parameters originate from config only (#20)
|
75
81
|
|
76
|
-
|
82
|
+
# v0.4.8
|
77
83
|
* Disable delimiter on `:multiple` options (must specify multiple flags)
|
78
84
|
* Update types allowed by inspect for instance failure option
|
79
85
|
* Parameter hash is now always fully set based on template parameters
|
80
86
|
|
81
|
-
|
87
|
+
# v0.4.6
|
82
88
|
* Fix parameter generation from CLI
|
83
89
|
|
84
|
-
|
90
|
+
# v0.4.4
|
85
91
|
* Add a few more config fixes to properly validate
|
86
92
|
|
87
|
-
|
93
|
+
# v0.4.2
|
88
94
|
* Fix config types defined
|
89
95
|
|
90
|
-
|
96
|
+
# v0.4.0
|
91
97
|
* Fix parameters passed on CLI (#11)
|
92
98
|
* Fix credential overrides from the CLI (#14)
|
93
99
|
* Properly process CLI options through custom config classes
|
@@ -98,18 +104,18 @@ _NOTE: This release contains breaking changes! Please review the
|
|
98
104
|
consistent now and into the future. Please refer to the help
|
99
105
|
output for a given command to view short flags.
|
100
106
|
|
101
|
-
|
107
|
+
# v0.3.8
|
102
108
|
* Fix result output from `update` command (#9)
|
103
109
|
* Fix `inspect` command to properly support multiple attribute flags
|
104
110
|
* Only output JSON when using `--print-only` flag with `create` command (#10)
|
105
111
|
|
106
|
-
|
112
|
+
# v0.3.6
|
107
113
|
* Set options correctly on `sfn` executable (#7)
|
108
114
|
* Update cli library dependency to provide better error messages (#6)
|
109
115
|
* Update cloud library dependencies to support new options (:on_failure and :tags)
|
110
116
|
* Cloud library update also adds support for aws credentials file
|
111
117
|
|
112
|
-
|
118
|
+
# v0.3.4
|
113
119
|
* Default column widths when no output is available
|
114
120
|
* Display stack tags on `describe` command
|
115
121
|
* Fix apply stack reference to access via hash
|
@@ -117,115 +123,115 @@ _NOTE: This release contains breaking changes! Please review the
|
|
117
123
|
* Fix path prompting (#5 thanks @JonathanSerafini)
|
118
124
|
* Update minimum CLI lib dependency to provide correct configuration merging (#4)
|
119
125
|
|
120
|
-
|
126
|
+
# v0.3.2
|
121
127
|
* Validate stack name prior to discovery on apply
|
122
128
|
* Update configuration usage to allow runtime modification
|
123
129
|
* Allow `create` command to print-only without requiring API credentials
|
124
130
|
|
125
|
-
|
131
|
+
# v0.3.0
|
126
132
|
* Conversion from `knife-cloudformation` to `sfn`
|
127
133
|
* Add knife subcommand alias `sparkleformation`
|
128
134
|
* Remove implementation dependency on Chef tooling
|
129
135
|
|
130
|
-
|
136
|
+
# v0.2.20
|
131
137
|
* Add automatic support for outputs in nested stacks to `--apply-stack`
|
132
138
|
|
133
|
-
|
139
|
+
# v0.2.18
|
134
140
|
* Fix nested stack URL generation
|
135
141
|
|
136
|
-
|
142
|
+
# v0.2.16
|
137
143
|
* Fix broken validation command (#12 thanks @JonathanSerafini)
|
138
144
|
* Pad stack name indexes when unpacked
|
139
145
|
|
140
|
-
|
146
|
+
# v0.2.14
|
141
147
|
* Pass command configuration through when unpacking
|
142
148
|
* Force stack list reload prior to polling to prevent lookup errors
|
143
149
|
* Add glob support on name arguments provided for `destroy`
|
144
150
|
* Add unpacked stack support to `--apply-stack` flag
|
145
151
|
* Retry events polling when started from different command
|
146
152
|
|
147
|
-
|
153
|
+
# v0.2.12
|
148
154
|
* Use template to provide logical parameter ordering on stack update
|
149
155
|
* Only set parameters when not the default template value
|
150
156
|
* Do not save nested stacks to remote bucket when in print-only mode
|
151
157
|
* Add initial support for un-nested stack create and update
|
152
158
|
* Fix nested stack flagging usage
|
153
159
|
|
154
|
-
|
160
|
+
# v0.2.10
|
155
161
|
* Add initial nested stack support
|
156
162
|
|
157
|
-
|
163
|
+
# v0.2.8
|
158
164
|
* Update stack lookup implementation to make faster from CLI
|
159
165
|
* Prevent constant error on exception when Redis is not in use
|
160
166
|
* Provide better error messages on request failures
|
161
167
|
|
162
|
-
|
168
|
+
# v0.2.6
|
163
169
|
* Update to parameter re-defaults to use correct hash instance
|
164
170
|
|
165
|
-
|
171
|
+
# v0.2.4
|
166
172
|
* Fix apply stack parameter processing
|
167
173
|
|
168
|
-
|
174
|
+
# v0.2.2
|
169
175
|
* Fix redis-objects loading in cache helper
|
170
176
|
|
171
|
-
|
177
|
+
# v0.2.0
|
172
178
|
* This release should be considered "breaking"
|
173
179
|
* Underlying cloud API has been changed from fog to miasma
|
174
180
|
* The `inspect` command has been fully reworked to support `--attribute`
|
175
181
|
* Lots and lots of other changes. See commit log.
|
176
182
|
|
177
|
-
|
183
|
+
# v0.1.22
|
178
184
|
* Prevent full stack list loading in knife commands
|
179
185
|
* Default logger to INFO level and allow DEBUG level via `ENV['DEBUG']`
|
180
186
|
* Fix assumption of type when accessing cached data (cannot assume availability)
|
181
187
|
|
182
|
-
|
188
|
+
# v0.1.20
|
183
189
|
* Update some caching behavior
|
184
190
|
* Add more logging especially around remote calls
|
185
191
|
* Add support for request throttling
|
186
192
|
* Disable local caching when stack is in `in_progress` state
|
187
193
|
|
188
|
-
|
194
|
+
# v0.1.18
|
189
195
|
* Replace constant with inline value to prevent warnings
|
190
196
|
* Explicitly load file to ensure proper load ordering
|
191
197
|
|
192
|
-
|
198
|
+
# v0.1.16
|
193
199
|
* Fix exit code on stack destroy
|
194
200
|
* Update stack loading for single stack requests
|
195
201
|
* Add import and export functionality
|
196
202
|
|
197
|
-
|
203
|
+
# v0.1.14
|
198
204
|
* Extract template building tools
|
199
205
|
* Add support for custom CF locations and prompting
|
200
206
|
* Updates in fetching and caching behavior
|
201
207
|
|
202
|
-
|
208
|
+
# v0.1.12
|
203
209
|
* Use the split value when re-joining parameters
|
204
210
|
|
205
|
-
|
211
|
+
# v0.1.10
|
206
212
|
* Fix parameter passing via the CLI (data loss issue when value contained ':')
|
207
213
|
|
208
|
-
|
214
|
+
# v0.1.8
|
209
215
|
* Update event cache handling
|
210
216
|
* Allow multiple users for node connect attempts
|
211
217
|
|
212
|
-
|
218
|
+
# v0.1.6
|
213
219
|
* Adds inspect action
|
214
220
|
* Updates to commons
|
215
221
|
* Allow multiple stack destroys at once
|
216
222
|
* Updates to options to make consistent
|
217
223
|
|
218
|
-
|
224
|
+
# v0.1.4
|
219
225
|
* Support outputs on stack creation
|
220
226
|
* Poll on destroy by default
|
221
227
|
* Add inspection helper for failed node inspection
|
222
228
|
* Refactor AWS interactions to common library
|
223
229
|
|
224
|
-
|
230
|
+
# v0.1.2
|
225
231
|
* Update dependency restriction to get later version
|
226
232
|
|
227
|
-
|
233
|
+
# v0.1.0
|
228
234
|
* Stable-ish release
|
229
235
|
|
230
|
-
|
236
|
+
# v0.0.1
|
231
237
|
* Initial release
|
data/docs/configuration.md
CHANGED
@@ -73,6 +73,14 @@ $ knife sparkleformation --help
|
|
73
73
|
| | Valid | `String`
|
74
74
|
| | Default | none
|
75
75
|
|----------------------------|---------------|---------------------------------------------------------------
|
76
|
+
| `sparkle_pack` | Description | SparklePacks to load
|
77
|
+
| | Valid | `Array<String>`
|
78
|
+
| | Default | none
|
79
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
80
|
+
| `parameters` | Description | Stack runtime parameters
|
81
|
+
| | Valid | `Hash`
|
82
|
+
| | Default | none
|
83
|
+
|----------------------------|---------------|---------------------------------------------------------------
|
76
84
|
| `credentials` | Description | API credentials for target orchestration API
|
77
85
|
| | Valid | `Hash`
|
78
86
|
| | Default | none
|
data/lib/sfn/command/update.rb
CHANGED
@@ -122,6 +122,7 @@ module Sfn
|
|
122
122
|
poll_stack(stack.name)
|
123
123
|
if(stack.reload.state == :update_complete)
|
124
124
|
ui.info "Stack update complete: #{ui.color('SUCCESS', :green)}"
|
125
|
+
stack.resources.reload
|
125
126
|
namespace.const_get(:Describe).new({:outputs => true}, [name]).execute!
|
126
127
|
else
|
127
128
|
ui.fatal "Update of stack #{ui.color(name, :bold)}: #{ui.color('FAILED', :red, :bold)}"
|
@@ -167,7 +168,7 @@ module Sfn
|
|
167
168
|
said_any_things = false
|
168
169
|
unless(info[:stacks].empty?)
|
169
170
|
info[:stacks].each do |s_name, s_info|
|
170
|
-
|
171
|
+
said_any_things ||= print_plan_result(s_info, [*names, s_name].compact)
|
171
172
|
end
|
172
173
|
end
|
173
174
|
unless(names.flatten.compact.empty?)
|
@@ -213,6 +214,7 @@ module Sfn
|
|
213
214
|
unless(said_things)
|
214
215
|
ui.puts " #{ui.color('No resource lifecycle changes detected!', :green)}"
|
215
216
|
ui.puts
|
217
|
+
said_any_things = true
|
216
218
|
end
|
217
219
|
end
|
218
220
|
said_any_things
|
@@ -80,8 +80,19 @@ module Sfn
|
|
80
80
|
# @return [Array<SparkleFormation::SparklePack>]
|
81
81
|
def sparkle_packs
|
82
82
|
memoize(:sparkle_packs) do
|
83
|
-
config.fetch(:sparkle_pack, []).map do |sparkle_name|
|
84
|
-
|
83
|
+
[config.fetch(:sparkle_pack, [])].flatten.compact.map do |sparkle_name|
|
84
|
+
begin
|
85
|
+
require sparkle_name
|
86
|
+
rescue LoadError
|
87
|
+
ui.fatal "Failed to locate sparkle pack `#{sparkle_name}` for loading!"
|
88
|
+
raise
|
89
|
+
end
|
90
|
+
begin
|
91
|
+
SparkleFormation::Sparkle.new(:name => sparkle_name)
|
92
|
+
rescue ArgumentError
|
93
|
+
ui.fatal "Failed to properly setup sparkle pack `#{sparkle_pack}`. Check implementation."
|
94
|
+
raise
|
95
|
+
end
|
85
96
|
end
|
86
97
|
end
|
87
98
|
end
|
data/lib/sfn/config.rb
CHANGED
@@ -6,6 +6,33 @@ module Sfn
|
|
6
6
|
# Top level configuration
|
7
7
|
class Config < Bogo::Config
|
8
8
|
|
9
|
+
# Override attribute helper to detect Hash types and automatically
|
10
|
+
# add type conversion for CLI provided values + description update
|
11
|
+
#
|
12
|
+
# @param name [String, Symbol] name of attribute
|
13
|
+
# @param type [Class, Array<Class>] valid types
|
14
|
+
# @param info [Hash] attribute information
|
15
|
+
# @return [Hash]
|
16
|
+
def self.attribute(name, type, info=Smash.new)
|
17
|
+
if([type].flatten.any?{|t| t.ancestors.include?(Hash)})
|
18
|
+
unless(info[:coerce])
|
19
|
+
info[:coerce] = lambda do |v|
|
20
|
+
case v
|
21
|
+
when String
|
22
|
+
Smash[v.split(',').map{|x| v.split(/[=:]/, 2)}]
|
23
|
+
when Hash
|
24
|
+
v.to_smash
|
25
|
+
else
|
26
|
+
v
|
27
|
+
end
|
28
|
+
end
|
29
|
+
info[:description] ||= ''
|
30
|
+
info[:description] << ' (Key:Value[,Key:Value,...])'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
super(name, type, info)
|
34
|
+
end
|
35
|
+
|
9
36
|
# Only values allowed designating bool type
|
10
37
|
BOOLEAN_VALUES = [TrueClass, FalseClass]
|
11
38
|
|
@@ -27,45 +54,42 @@ module Sfn
|
|
27
54
|
|
28
55
|
attribute(
|
29
56
|
:config, String,
|
30
|
-
:description => 'Configuration file path'
|
57
|
+
:description => 'Configuration file path',
|
58
|
+
:short_flag => 'c'
|
31
59
|
)
|
32
60
|
|
33
61
|
attribute(
|
34
62
|
:credentials, Smash,
|
35
|
-
:
|
36
|
-
|
37
|
-
when String
|
38
|
-
Smash[v.split(',').map{|x| v.split(/[=:]/, 2)}]
|
39
|
-
when Hash
|
40
|
-
v.to_smash
|
41
|
-
else
|
42
|
-
v
|
43
|
-
end
|
44
|
-
},
|
45
|
-
:description => 'Provider credentials'
|
63
|
+
:description => 'Provider credentials',
|
64
|
+
:short_flag => 'C'
|
46
65
|
)
|
47
66
|
attribute(
|
48
67
|
:ignore_parameters, String,
|
49
68
|
:multiple => true,
|
50
|
-
:description => 'Parameters to ignore during modifications'
|
69
|
+
:description => 'Parameters to ignore during modifications',
|
70
|
+
:short_flag => 'i'
|
51
71
|
)
|
52
72
|
attribute(
|
53
73
|
:interactive_parameters, [TrueClass, FalseClass],
|
54
74
|
:default => true,
|
55
|
-
:description => 'Prompt for template parameters'
|
75
|
+
:description => 'Prompt for template parameters',
|
76
|
+
:short_flag => 'I'
|
56
77
|
)
|
57
78
|
attribute(
|
58
79
|
:poll, [TrueClass, FalseClass],
|
59
80
|
:default => true,
|
60
|
-
:description => 'Poll stack events on modification actions'
|
81
|
+
:description => 'Poll stack events on modification actions',
|
82
|
+
:short_flag => 'p'
|
61
83
|
)
|
62
84
|
attribute(
|
63
85
|
:defaults, [TrueClass, FalseClass],
|
64
|
-
:description => 'Automatically accept default values'
|
86
|
+
:description => 'Automatically accept default values',
|
87
|
+
:short_flag => 'd'
|
65
88
|
)
|
66
89
|
attribute(
|
67
90
|
:yes, [TrueClass, FalseClass],
|
68
|
-
:description => 'Automatically accept any requests for confirmation'
|
91
|
+
:description => 'Automatically accept any requests for confirmation',
|
92
|
+
:short_flag => 'y'
|
69
93
|
)
|
70
94
|
|
71
95
|
attribute :conf, Conf, :coerce => proc{|v| Conf.new(v)}
|
@@ -103,8 +127,9 @@ module Sfn
|
|
103
127
|
end
|
104
128
|
end.compact.reverse.inject(Smash.new){|m, n| m.deep_merge(n)}.map do |name, info|
|
105
129
|
next unless info[:description]
|
106
|
-
short =
|
107
|
-
|
130
|
+
short = info[:short_flag]
|
131
|
+
if(!short.to_s.empty? && shorts.include?(short))
|
132
|
+
raise ArgumentError.new "Short flag already in use! (`#{short}` not available for `#{klass}`)"
|
108
133
|
end
|
109
134
|
shorts << short
|
110
135
|
info[:short] = short
|
data/lib/sfn/config/conf.rb
CHANGED
data/lib/sfn/config/create.rb
CHANGED
@@ -8,29 +8,30 @@ module Sfn
|
|
8
8
|
attribute(
|
9
9
|
:timeout, Integer,
|
10
10
|
:coerce => proc{|v| v.to_i},
|
11
|
-
:description => 'Seconds to wait for stack to complete'
|
11
|
+
:description => 'Seconds to wait for stack to complete',
|
12
|
+
:short_flag => 'M'
|
12
13
|
)
|
13
14
|
attribute(
|
14
15
|
:rollback, [TrueClass, FalseClass],
|
15
|
-
:description => 'Rollback stack on failure'
|
16
|
+
:description => 'Rollback stack on failure',
|
17
|
+
:short_flag => 'O'
|
16
18
|
)
|
17
19
|
attribute(
|
18
20
|
:capabilities, String,
|
19
21
|
:multiple => true,
|
20
|
-
:description => 'Capabilities to allow the stack'
|
22
|
+
:description => 'Capabilities to allow the stack',
|
23
|
+
:short_flag => 'B'
|
21
24
|
)
|
22
25
|
attribute(
|
23
26
|
:options, Smash,
|
24
|
-
:description => 'Extra options to apply to the API call'
|
27
|
+
:description => 'Extra options to apply to the API call',
|
28
|
+
:short_flag => 'S'
|
25
29
|
)
|
26
30
|
attribute(
|
27
|
-
:
|
31
|
+
:notification_topics, String,
|
28
32
|
:multiple => true,
|
29
|
-
:description => 'Notification endpoints for stack events'
|
30
|
-
|
31
|
-
attribute(
|
32
|
-
:plan, FalseClass,
|
33
|
-
:default => false
|
33
|
+
:description => 'Notification endpoints for stack events',
|
34
|
+
:short_flag => 'z'
|
34
35
|
)
|
35
36
|
|
36
37
|
end
|
data/lib/sfn/config/describe.rb
CHANGED
@@ -6,17 +6,20 @@ module Sfn
|
|
6
6
|
|
7
7
|
attribute(
|
8
8
|
:resources, [TrueClass, FalseClass],
|
9
|
-
:description => 'Display stack resource list'
|
9
|
+
:description => 'Display stack resource list',
|
10
|
+
:short_flag => 'r'
|
10
11
|
)
|
11
12
|
|
12
13
|
attribute(
|
13
14
|
:outputs, [TrueClass, FalseClass],
|
14
|
-
:description => 'Display stack outputs'
|
15
|
+
:description => 'Display stack outputs',
|
16
|
+
:short_flag => 'o'
|
15
17
|
)
|
16
18
|
|
17
19
|
attribute(
|
18
20
|
:tags, [TrueClass, FalseClass],
|
19
|
-
:description => 'Display stack tags'
|
21
|
+
:description => 'Display stack tags',
|
22
|
+
:short_flag => 't'
|
20
23
|
)
|
21
24
|
|
22
25
|
end
|
data/lib/sfn/config/diff.rb
CHANGED
data/lib/sfn/config/events.rb
CHANGED
@@ -8,17 +8,20 @@ module Sfn
|
|
8
8
|
attribute(
|
9
9
|
:attribute, String,
|
10
10
|
:multiple => true,
|
11
|
-
:description => 'Event attribute to display'
|
11
|
+
:description => 'Event attribute to display',
|
12
|
+
:short_flag => 'a'
|
12
13
|
)
|
13
14
|
attribute(
|
14
15
|
:poll_delay, Integer,
|
15
16
|
:default => 20,
|
16
17
|
:description => 'Seconds to pause between each event poll',
|
17
|
-
:coerce => lambda{|v| v.to_i}
|
18
|
+
:coerce => lambda{|v| v.to_i},
|
19
|
+
:short_flag => 'P'
|
18
20
|
)
|
19
21
|
attribute(
|
20
22
|
:all_attributes, [TrueClass, FalseClass],
|
21
|
-
:description => 'Display all event attributes'
|
23
|
+
:description => 'Display all event attributes',
|
24
|
+
:short_flag => 'A'
|
22
25
|
)
|
23
26
|
|
24
27
|
end
|
data/lib/sfn/config/inspect.rb
CHANGED
@@ -8,28 +8,34 @@ module Sfn
|
|
8
8
|
attribute(
|
9
9
|
:attribute, String,
|
10
10
|
:multiple => true,
|
11
|
-
:description => 'Dot delimited attribute to view'
|
11
|
+
:description => 'Dot delimited attribute to view',
|
12
|
+
:short_flag => 'a'
|
12
13
|
)
|
13
14
|
attribute(
|
14
15
|
:nodes, [TrueClass, FalseClass],
|
15
|
-
:description => 'Locate all instances and display addresses'
|
16
|
+
:description => 'Locate all instances and display addresses',
|
17
|
+
:short_flag => 'n'
|
16
18
|
)
|
17
19
|
attribute(
|
18
20
|
:instance_failure, [TrueClass, FalseClass],
|
19
21
|
:description => 'Display log file error from failed not if possible',
|
22
|
+
:short_flag => 'N'
|
20
23
|
)
|
21
24
|
attribute(
|
22
25
|
:failure_log_path, String,
|
23
26
|
:description => 'Path to remote log file for display on failure',
|
24
|
-
:default => '/var/log/chef/client.log'
|
27
|
+
:default => '/var/log/chef/client.log',
|
28
|
+
:short_flag => 'f'
|
25
29
|
)
|
26
30
|
attribute(
|
27
31
|
:identity_file, String,
|
28
|
-
:description => 'SSH identity file for authentication'
|
32
|
+
:description => 'SSH identity file for authentication',
|
33
|
+
:short_flag => 'D'
|
29
34
|
)
|
30
35
|
attribute(
|
31
36
|
:ssh_user, String,
|
32
|
-
:description => 'SSH username for inspection connect'
|
37
|
+
:description => 'SSH username for inspection connect',
|
38
|
+
:short_flag => 's'
|
33
39
|
)
|
34
40
|
|
35
41
|
end
|
data/lib/sfn/config/list.rb
CHANGED
@@ -8,16 +8,19 @@ module Sfn
|
|
8
8
|
attribute(
|
9
9
|
:attribute, String,
|
10
10
|
:multiple => true,
|
11
|
-
:description => 'Attribute of stack to print'
|
11
|
+
:description => 'Attribute of stack to print',
|
12
|
+
:short_flag => 'a'
|
12
13
|
)
|
13
14
|
attribute(
|
14
15
|
:all_attributes, [TrueClass, FalseClass],
|
15
|
-
:description => 'Print all available attributes'
|
16
|
+
:description => 'Print all available attributes',
|
17
|
+
:short_flag => 'A'
|
16
18
|
)
|
17
19
|
attribute(
|
18
20
|
:status, String,
|
19
21
|
:multiple => true,
|
20
|
-
:description => 'Match stacks with given status. Use "none" to disable.'
|
22
|
+
:description => 'Match stacks with given status. Use "none" to disable.',
|
23
|
+
:short_flag => 's'
|
21
24
|
)
|
22
25
|
|
23
26
|
end
|
data/lib/sfn/config/update.rb
CHANGED
@@ -8,20 +8,42 @@ module Sfn
|
|
8
8
|
attribute(
|
9
9
|
:apply_stack, String,
|
10
10
|
:multiple => true,
|
11
|
-
:description => 'Apply outputs from stack to input parameters'
|
11
|
+
:description => 'Apply outputs from stack to input parameters',
|
12
|
+
:short_flag => 'A'
|
12
13
|
)
|
13
14
|
attribute(
|
14
15
|
:parameter, Smash,
|
15
16
|
:multiple => true,
|
16
|
-
:description => 'Pass template parameters directly (ParamName:ParamValue)',
|
17
|
-
:coerce => lambda{|v|
|
18
|
-
|
19
|
-
|
17
|
+
:description => '[DEPRECATED - use `parameters`] Pass template parameters directly (ParamName:ParamValue)',
|
18
|
+
:coerce => lambda{|v, inst|
|
19
|
+
result = inst.data[:parameter] || Array.new
|
20
|
+
case v
|
21
|
+
when String
|
22
|
+
v.split(',').each do |item|
|
23
|
+
result.push(Smash[*item.split(/[=:]/, 2)])
|
24
|
+
end
|
25
|
+
else
|
26
|
+
result.push(v.to_smash)
|
27
|
+
end
|
28
|
+
{:bogo_multiple => result}
|
29
|
+
},
|
30
|
+
:short_flag => 'R'
|
31
|
+
)
|
32
|
+
attribute(
|
33
|
+
:parameters, Smash,
|
34
|
+
:description => 'Pass template parameters directly',
|
35
|
+
:short_flag => 'm'
|
20
36
|
)
|
21
37
|
attribute(
|
22
38
|
:plan, [TrueClass, FalseClass],
|
23
39
|
:default => true,
|
24
|
-
:description => 'Provide planning information prior to update'
|
40
|
+
:description => 'Provide planning information prior to update',
|
41
|
+
:short_flag => 'l'
|
42
|
+
)
|
43
|
+
attribute(
|
44
|
+
:compile_parameters, Smash,
|
45
|
+
:description => 'Pass template compile time parameters directly',
|
46
|
+
:short_flag => 'o'
|
25
47
|
)
|
26
48
|
|
27
49
|
end
|
data/lib/sfn/config/validate.rb
CHANGED
@@ -8,53 +8,64 @@ module Sfn
|
|
8
8
|
attribute(
|
9
9
|
:processing, [TrueClass, FalseClass],
|
10
10
|
:description => 'Call the unicorns and explode the glitter bombs',
|
11
|
-
:default => true
|
11
|
+
:default => true,
|
12
|
+
:short_flag => 'P'
|
12
13
|
)
|
13
14
|
attribute(
|
14
15
|
:file, String,
|
15
16
|
:description => 'Path to template file',
|
16
|
-
:default => nil
|
17
|
+
:default => nil,
|
18
|
+
:short_flag => 'f'
|
17
19
|
)
|
18
20
|
attribute(
|
19
21
|
:file_path_prompt, [TrueClass, FalseClass],
|
20
22
|
:default => true,
|
21
|
-
:description => 'Enable interactive prompt for template path discovery'
|
23
|
+
:description => 'Enable interactive prompt for template path discovery',
|
24
|
+
:short_flag => 'F'
|
22
25
|
)
|
23
26
|
attribute(
|
24
27
|
:base_directory, String,
|
25
|
-
:description => 'Path to root of of templates directory'
|
28
|
+
:description => 'Path to root of of templates directory',
|
29
|
+
:short_flag => 'b'
|
26
30
|
)
|
27
31
|
attribute(
|
28
32
|
:no_base_directory, [TrueClass, FalseClass],
|
29
|
-
:description => 'Unset any value used for the template root directory path'
|
33
|
+
:description => 'Unset any value used for the template root directory path',
|
34
|
+
:short_flag => 'n'
|
30
35
|
)
|
31
36
|
attribute(
|
32
37
|
:translate, String,
|
33
|
-
:description => 'Translate generated template to given
|
38
|
+
:description => 'Translate generated template to given provider',
|
39
|
+
:short_flag => 't'
|
34
40
|
)
|
35
41
|
attribute(
|
36
42
|
:translate_chunk, Integer,
|
37
43
|
:description => 'Chunk length for serialization',
|
38
|
-
:coerce => lambda{|v| v.to_i}
|
44
|
+
:coerce => lambda{|v| v.to_i},
|
45
|
+
:short_flag => 'T'
|
39
46
|
)
|
40
47
|
attribute(
|
41
48
|
:apply_nesting, [String, Symbol],
|
42
49
|
:default => 'deep',
|
43
|
-
:description => 'Apply stack nesting'
|
50
|
+
:description => 'Apply stack nesting',
|
51
|
+
:short_flag => 'a'
|
44
52
|
)
|
45
53
|
attribute(
|
46
54
|
:nesting_bucket, String,
|
47
|
-
:description => 'Bucket to use for storing nested stack templates'
|
55
|
+
:description => 'Bucket to use for storing nested stack templates',
|
56
|
+
:short_flag => 'N'
|
48
57
|
)
|
49
58
|
attribute(
|
50
59
|
:print_only, [TrueClass, FalseClass],
|
51
|
-
:description => 'Print the resulting stack template'
|
60
|
+
:description => 'Print the resulting stack template',
|
61
|
+
:short_flag => 'r'
|
52
62
|
)
|
53
63
|
attribute(
|
54
64
|
:sparkle_pack, String,
|
55
65
|
:multiple => true,
|
56
66
|
:description => 'Load SparklePack gem',
|
57
|
-
:coerce => lambda{|s|
|
67
|
+
:coerce => lambda{|s| s.to_s},
|
68
|
+
:short_flag => 's'
|
58
69
|
)
|
59
70
|
|
60
71
|
end
|
data/lib/sfn/planner/aws.rb
CHANGED
@@ -240,10 +240,12 @@ module Sfn
|
|
240
240
|
translator = translator_for(t_key)
|
241
241
|
|
242
242
|
new_parameters = new_parameters.dup
|
243
|
-
stack.parameters
|
244
|
-
|
245
|
-
|
246
|
-
|
243
|
+
if(stack.parameters)
|
244
|
+
stack.parameters.each do |k,v|
|
245
|
+
if(new_parameters[k].is_a?(Hash))
|
246
|
+
val = translator.dereference(new_parameters[k])
|
247
|
+
new_parameters[k] = val == new_parameters[k] ? v : val
|
248
|
+
end
|
247
249
|
end
|
248
250
|
end
|
249
251
|
|
@@ -251,10 +253,10 @@ module Sfn
|
|
251
253
|
|
252
254
|
new_template_hash = new_template.to_smash
|
253
255
|
|
254
|
-
o_nested_stacks = origin_template
|
256
|
+
o_nested_stacks = origin_template.fetch('Resources', {}).find_all do |s_name, s_val|
|
255
257
|
is_stack?(s_val['Type'])
|
256
258
|
end.map(&:first)
|
257
|
-
n_nested_stacks = new_template_hash
|
259
|
+
n_nested_stacks = new_template_hash.fetch('Resources', {}).find_all do |s_name, s_val|
|
258
260
|
is_stack?(s_val['Type'])
|
259
261
|
end.map(&:first)
|
260
262
|
[o_nested_stacks + n_nested_stacks].flatten.compact.uniq.each do |n_name|
|
@@ -334,7 +336,7 @@ module Sfn
|
|
334
336
|
property_name = p_path[3].sub(/\[\d+\]$/, '')
|
335
337
|
type = templates[:origin]['Resources'][resource_name]['Type']
|
336
338
|
info = SfnAws.registry[type]
|
337
|
-
effect = info[:full_properties].fetch(property_name, {}).fetch(:update_causes, :unknown)
|
339
|
+
effect = info[:full_properties].fetch(property_name, {}).fetch(:update_causes, :unknown).to_sym
|
338
340
|
resource = Smash.new(
|
339
341
|
:name => resource_name,
|
340
342
|
:type => type,
|
@@ -367,7 +369,13 @@ module Sfn
|
|
367
369
|
end
|
368
370
|
end
|
369
371
|
elsif(path.start_with?('Outputs'))
|
370
|
-
|
372
|
+
o_resource_name = path.split('.')[1]
|
373
|
+
if(o_resource_name)
|
374
|
+
set_resource(
|
375
|
+
:outputs, results, o_resource_name,
|
376
|
+
:properties => []
|
377
|
+
)
|
378
|
+
end
|
371
379
|
end
|
372
380
|
end
|
373
381
|
|
@@ -403,11 +411,21 @@ module Sfn
|
|
403
411
|
end
|
404
412
|
template.keys.each do |t_key|
|
405
413
|
next if ['Outputs', 'Resources'].include?(t_key)
|
406
|
-
template[t_key] = translator.dereference_processor(
|
414
|
+
template[t_key] = translator.dereference_processor(
|
415
|
+
template[t_key], ['Ref', 'Fn', 'DEREF', 'Fn::FindInMap']
|
416
|
+
)
|
407
417
|
end
|
408
418
|
translator.original.replace(template)
|
409
|
-
|
410
|
-
|
419
|
+
if(template['Resources'])
|
420
|
+
template['Resources'] = translator.dereference_processor(
|
421
|
+
template['Resources'], ['Ref', 'Fn', 'DEREF', 'Fn::FindInMap']
|
422
|
+
)
|
423
|
+
end
|
424
|
+
if(template['Outputs'])
|
425
|
+
template['Outputs'] = translator.dereference_processor(
|
426
|
+
template['Outputs'], ['Ref', 'Fn', 'DEREF', 'Fn::FindInMap']
|
427
|
+
)
|
428
|
+
end
|
411
429
|
translator.original.replace({})
|
412
430
|
template
|
413
431
|
end
|
data/lib/sfn/version.rb
CHANGED
data/sfn.gemspec
CHANGED
@@ -16,6 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency 'net-ssh'
|
17
17
|
s.add_dependency 'sparkle_formation', '~> 1.1'
|
18
18
|
s.add_dependency 'hashdiff', '~> 0.2.2'
|
19
|
+
s.add_development_dependency 'rake'
|
20
|
+
s.add_development_dependency 'minitest'
|
21
|
+
s.add_development_dependency 'mocha'
|
19
22
|
s.executables << 'sfn'
|
20
23
|
s.files = Dir['{lib,bin,docs}/**/*'] + %w(sfn.gemspec README.md CHANGELOG.md LICENSE)
|
21
24
|
s.post_install_message = <<-EOF
|
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: 1.
|
4
|
+
version: 1.2.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:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo-cli
|
@@ -94,6 +94,48 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.2.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: mocha
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
97
139
|
description: SparkleFormation CLI
|
98
140
|
email: code@chrisroberts.org
|
99
141
|
executables:
|