sfn 0.0.1 → 0.3.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 +107 -0
- data/LICENSE +13 -0
- data/README.md +142 -61
- data/bin/sfn +43 -0
- data/lib/chef/knife/knife_plugin_seed.rb +117 -0
- data/lib/sfn.rb +17 -0
- data/lib/sfn/cache.rb +385 -0
- data/lib/sfn/command.rb +45 -0
- data/lib/sfn/command/create.rb +87 -0
- data/lib/sfn/command/describe.rb +87 -0
- data/lib/sfn/command/destroy.rb +74 -0
- data/lib/sfn/command/events.rb +98 -0
- data/lib/sfn/command/export.rb +103 -0
- data/lib/sfn/command/import.rb +117 -0
- data/lib/sfn/command/inspect.rb +160 -0
- data/lib/sfn/command/list.rb +59 -0
- data/lib/sfn/command/promote.rb +17 -0
- data/lib/sfn/command/update.rb +95 -0
- data/lib/sfn/command/validate.rb +34 -0
- data/lib/sfn/command_module.rb +9 -0
- data/lib/sfn/command_module/base.rb +150 -0
- data/lib/sfn/command_module/stack.rb +166 -0
- data/lib/sfn/command_module/template.rb +147 -0
- data/lib/sfn/config.rb +106 -0
- data/lib/sfn/config/create.rb +35 -0
- data/lib/sfn/config/describe.rb +19 -0
- data/lib/sfn/config/destroy.rb +9 -0
- data/lib/sfn/config/events.rb +25 -0
- data/lib/sfn/config/export.rb +29 -0
- data/lib/sfn/config/import.rb +24 -0
- data/lib/sfn/config/inspect.rb +37 -0
- data/lib/sfn/config/list.rb +25 -0
- data/lib/sfn/config/promote.rb +23 -0
- data/lib/sfn/config/update.rb +20 -0
- data/lib/sfn/config/validate.rb +49 -0
- data/lib/sfn/monkey_patch.rb +8 -0
- data/lib/sfn/monkey_patch/stack.rb +200 -0
- data/lib/sfn/provider.rb +224 -0
- data/lib/sfn/utils.rb +23 -0
- data/lib/sfn/utils/debug.rb +31 -0
- data/lib/sfn/utils/json.rb +37 -0
- data/lib/sfn/utils/object_storage.rb +28 -0
- data/lib/sfn/utils/output.rb +79 -0
- data/lib/sfn/utils/path_selector.rb +99 -0
- data/lib/sfn/utils/ssher.rb +29 -0
- data/lib/sfn/utils/stack_exporter.rb +275 -0
- data/lib/sfn/utils/stack_parameter_scrubber.rb +37 -0
- data/lib/sfn/utils/stack_parameter_validator.rb +124 -0
- data/lib/sfn/version.rb +4 -0
- data/sfn.gemspec +19 -0
- metadata +110 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 503fe5b1c6c2b1fd9620fa4031e4f922e7432739
|
4
|
+
data.tar.gz: ce03c4291a2edfb660e7614b7202835f062ee965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ebf8bfb6f17238c53cf49b295e938bacaa04298fa79f9f2b694d8c8fd927ead75c1acf005fd7ebd63f870039bb890e98659395cd6451b83f934800b3a459ded
|
7
|
+
data.tar.gz: bf7061df664df0cec57c29627f57262effe53652f1bd49dc439fe4157983730adacb4831fbfe10750f30764517db8d90716a16410ce383e2f14f045a32ac5bf7
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
## v0.3.0
|
2
|
+
* Conversion from `knife-cloudformation` to `sfn`
|
3
|
+
* Add knife subcommand alias `sparkleformation`
|
4
|
+
* Remove implementation dependency on Chef tooling
|
5
|
+
|
6
|
+
## v0.2.20
|
7
|
+
* Add automatic support for outputs in nested stacks to `--apply-stack`
|
8
|
+
|
9
|
+
## v0.2.18
|
10
|
+
* Fix nested stack URL generation
|
11
|
+
|
12
|
+
## v0.2.16
|
13
|
+
* Fix broken validation command (#12 thanks @JonathanSerafini)
|
14
|
+
* Pad stack name indexes when unpacked
|
15
|
+
|
16
|
+
## v0.2.14
|
17
|
+
* Pass command configuration through when unpacking
|
18
|
+
* Force stack list reload prior to polling to prevent lookup errors
|
19
|
+
* Add glob support on name arguments provided for `destroy`
|
20
|
+
* Add unpacked stack support to `--apply-stack` flag
|
21
|
+
* Retry events polling when started from different command
|
22
|
+
|
23
|
+
## v0.2.12
|
24
|
+
* Use template to provide logical parameter ordering on stack update
|
25
|
+
* Only set parameters when not the default template value
|
26
|
+
* Do not save nested stacks to remote bucket when in print-only mode
|
27
|
+
* Add initial support for un-nested stack create and update
|
28
|
+
* Fix nested stack flagging usage
|
29
|
+
|
30
|
+
## v0.2.10
|
31
|
+
* Add initial nested stack support
|
32
|
+
|
33
|
+
## v0.2.8
|
34
|
+
* Update stack lookup implementation to make faster from CLI
|
35
|
+
* Prevent constant error on exception when Redis is not in use
|
36
|
+
* Provide better error messages on request failures
|
37
|
+
|
38
|
+
## v0.2.6
|
39
|
+
* Update to parameter re-defaults to use correct hash instance
|
40
|
+
|
41
|
+
## v0.2.4
|
42
|
+
* Fix apply stack parameter processing
|
43
|
+
|
44
|
+
## v0.2.2
|
45
|
+
* Fix redis-objects loading in cache helper
|
46
|
+
|
47
|
+
## v0.2.0
|
48
|
+
* This release should be considered "breaking"
|
49
|
+
* Underlying cloud API has been changed from fog to miasma
|
50
|
+
* The `inspect` command has been fully reworked to support `--attribute`
|
51
|
+
* Lots and lots of other changes. See commit log.
|
52
|
+
|
53
|
+
## v0.1.22
|
54
|
+
* Prevent full stack list loading in knife commands
|
55
|
+
* Default logger to INFO level and allow DEBUG level via `ENV['DEBUG']`
|
56
|
+
* Fix assumption of type when accessing cached data (cannot assume availability)
|
57
|
+
|
58
|
+
## v0.1.20
|
59
|
+
* Update some caching behavior
|
60
|
+
* Add more logging especially around remote calls
|
61
|
+
* Add support for request throttling
|
62
|
+
* Disable local caching when stack is in `in_progress` state
|
63
|
+
|
64
|
+
## v0.1.18
|
65
|
+
* Replace constant with inline value to prevent warnings
|
66
|
+
* Explicitly load file to ensure proper load ordering
|
67
|
+
|
68
|
+
## v0.1.16
|
69
|
+
* Fix exit code on stack destroy
|
70
|
+
* Update stack loading for single stack requests
|
71
|
+
* Add import and export functionality
|
72
|
+
|
73
|
+
## v0.1.14
|
74
|
+
* Extract template building tools
|
75
|
+
* Add support for custom CF locations and prompting
|
76
|
+
* Updates in fetching and caching behavior
|
77
|
+
|
78
|
+
## v0.1.12
|
79
|
+
* Use the split value when re-joining parameters
|
80
|
+
|
81
|
+
## v0.1.10
|
82
|
+
* Fix parameter passing via the CLI (data loss issue when value contained ':')
|
83
|
+
|
84
|
+
## v0.1.8
|
85
|
+
* Update event cache handling
|
86
|
+
* Allow multiple users for node connect attempts
|
87
|
+
|
88
|
+
## v0.1.6
|
89
|
+
* Adds inspect action
|
90
|
+
* Updates to commons
|
91
|
+
* Allow multiple stack destroys at once
|
92
|
+
* Updates to options to make consistent
|
93
|
+
|
94
|
+
## v0.1.4
|
95
|
+
* Support outputs on stack creation
|
96
|
+
* Poll on destroy by default
|
97
|
+
* Add inspection helper for failed node inspection
|
98
|
+
* Refactor AWS interactions to common library
|
99
|
+
|
100
|
+
## v0.1.2
|
101
|
+
* Update dependency restriction to get later version
|
102
|
+
|
103
|
+
## v0.1.0
|
104
|
+
* Stable-ish release
|
105
|
+
|
106
|
+
## v0.0.1
|
107
|
+
* Initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2014 Heavy Water Operations LLC.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# SparkleFormation CLI
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
APIs.
|
3
|
+
SparkleFormation command line interface for interacting
|
4
|
+
with orchestration APIs.
|
6
5
|
|
7
6
|
## API Compatibility
|
8
7
|
|
@@ -12,63 +11,77 @@ APIs.
|
|
12
11
|
|
13
12
|
## Configuration
|
14
13
|
|
15
|
-
|
16
|
-
`
|
17
|
-
|
18
|
-
|
14
|
+
Configuration is defined within a `.sfn` file. The
|
15
|
+
`sfn` command will start from the current working
|
16
|
+
directory and work up to the root of the file system
|
17
|
+
to discover this file.
|
19
18
|
|
20
|
-
###
|
19
|
+
### Configuration formats
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
The configuration file can be provided in a variety of
|
22
|
+
formats:
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:
|
24
|
+
#### JSON
|
25
|
+
|
26
|
+
```json
|
27
|
+
{
|
28
|
+
"credentials": {
|
29
|
+
AWS_CREDENTIALS
|
30
|
+
},
|
31
|
+
"options": {
|
32
|
+
"disable_rollback": true
|
33
|
+
}
|
30
34
|
}
|
31
35
|
```
|
32
36
|
|
33
|
-
###
|
37
|
+
### YAML
|
34
38
|
|
35
|
-
```
|
36
|
-
|
39
|
+
```yaml
|
40
|
+
---
|
41
|
+
:credentials:
|
42
|
+
:fubar: true
|
43
|
+
:options:
|
44
|
+
:disable_rollback: true
|
45
|
+
```
|
37
46
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
### XML
|
48
|
+
|
49
|
+
```xml
|
50
|
+
<configuration>
|
51
|
+
<credentials>
|
52
|
+
AWS_CREDENTIALS
|
53
|
+
</credentials>
|
54
|
+
<options>
|
55
|
+
<disable_rollback>
|
56
|
+
true
|
57
|
+
</disable_rollback>
|
58
|
+
</options>
|
59
|
+
</configuration>
|
44
60
|
```
|
45
61
|
|
46
|
-
###
|
62
|
+
### Ruby
|
47
63
|
|
48
64
|
```ruby
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
:open_stack_identity_url => ENV['OPENSTACK_IDENTITY_URL'],
|
56
|
-
:open_stack_tenant_name => ENV['OPENSTACK_TENANT']
|
57
|
-
}
|
65
|
+
Configuration.new do
|
66
|
+
credentials do
|
67
|
+
AWS_CREDENTIALS
|
68
|
+
end
|
69
|
+
options.disable_rollback true
|
70
|
+
end
|
58
71
|
```
|
59
72
|
|
60
73
|
## Commands
|
61
74
|
|
62
|
-
* `
|
63
|
-
* `
|
64
|
-
* `
|
65
|
-
* `
|
66
|
-
* `
|
67
|
-
* `
|
68
|
-
* `
|
69
|
-
* `
|
75
|
+
* `sfn list`
|
76
|
+
* `sfn create`
|
77
|
+
* `sfn update`
|
78
|
+
* `sfn destroy`
|
79
|
+
* `sfn events`
|
80
|
+
* `sfn describe`
|
81
|
+
* `sfn inspect`
|
82
|
+
* `sfn validate`
|
70
83
|
|
71
|
-
### `
|
84
|
+
### `sfn list`
|
72
85
|
|
73
86
|
Provides listing of current stacks and state of each stack.
|
74
87
|
|
@@ -77,7 +90,7 @@ Provides listing of current stacks and state of each stack.
|
|
77
90
|
* `--attribute ATTR` stack attribute to display
|
78
91
|
* `--status STATUS` match stacks with given status
|
79
92
|
|
80
|
-
### `
|
93
|
+
### `sfn validate`
|
81
94
|
|
82
95
|
Validates template with API
|
83
96
|
|
@@ -89,7 +102,7 @@ Validates template with API
|
|
89
102
|
* `--[no-]apply-nesting` apply template nesting logic
|
90
103
|
* `--nesting-bucket BUCKET` asset store bucket to place nested stack templates
|
91
104
|
|
92
|
-
### `
|
105
|
+
### `sfn create NAME`
|
93
106
|
|
94
107
|
Creates a new stack with the provided name (`NAME`).
|
95
108
|
|
@@ -152,7 +165,7 @@ StackB:
|
|
152
165
|
When creating StackB, if we use the `--apply-stack` option:
|
153
166
|
|
154
167
|
```
|
155
|
-
$
|
168
|
+
$ sfn create StackB --apply-stack StackA
|
156
169
|
```
|
157
170
|
|
158
171
|
when prompted for the stack parameters, we will find the parameter
|
@@ -171,13 +184,12 @@ _NOTE: (SparkleFormation Usage Documentation)[]._
|
|
171
184
|
This plugin supports the advanced stack nesting feature provided by
|
172
185
|
the SparkleFormation library.
|
173
186
|
|
174
|
-
|
175
187
|
#### Translations
|
176
188
|
|
177
189
|
Translations are currently an `alpha` feature and only a subset of
|
178
190
|
resources are supported.
|
179
191
|
|
180
|
-
### `
|
192
|
+
### `sfn update STACK`
|
181
193
|
|
182
194
|
Update an existing stack.
|
183
195
|
|
@@ -191,7 +203,7 @@ Update an existing stack.
|
|
191
203
|
* `--[no-]apply-nesting` apply template nesting logic
|
192
204
|
* `--nesting-bucket BUCKET` asset store bucket to place nested stack templates
|
193
205
|
|
194
|
-
### `
|
206
|
+
### `sfn destroy STACK`
|
195
207
|
|
196
208
|
Destroy an existing stack.
|
197
209
|
|
@@ -208,12 +220,12 @@ stacks:
|
|
208
220
|
running the following command:
|
209
221
|
|
210
222
|
```
|
211
|
-
$
|
223
|
+
$ sfn destroy Test*
|
212
224
|
```
|
213
225
|
|
214
226
|
will destroy the `TestStack1` and `TestStack2`
|
215
227
|
|
216
|
-
### `
|
228
|
+
### `sfn events STACK`
|
217
229
|
|
218
230
|
Display the event listing of given stack. If the state of the
|
219
231
|
stack is "in progress", the polling option will result in
|
@@ -224,7 +236,7 @@ completed state.
|
|
224
236
|
|
225
237
|
* `--[no-]poll` poll for new events until completed state reached
|
226
238
|
|
227
|
-
### `
|
239
|
+
### `sfn describe STACK`
|
228
240
|
|
229
241
|
Display resources and outputs of give stack.
|
230
242
|
|
@@ -233,7 +245,7 @@ Display resources and outputs of give stack.
|
|
233
245
|
* `--resources` display resources
|
234
246
|
* `--outputs` display outputs
|
235
247
|
|
236
|
-
### `
|
248
|
+
### `sfn inspect STACK`
|
237
249
|
|
238
250
|
The stack inspection command simply provides a proxy to the
|
239
251
|
underlying resource modeling objects provided via the
|
@@ -268,13 +280,13 @@ called on the `Miasma::Models::Orchestration::Stack` instance.
|
|
268
280
|
For example, to display the JSON template of a stack:
|
269
281
|
|
270
282
|
```
|
271
|
-
$
|
283
|
+
$ sfn inspect STACK -a template
|
272
284
|
```
|
273
285
|
|
274
286
|
To display the resource collection of the stack:
|
275
287
|
|
276
288
|
```
|
277
|
-
$
|
289
|
+
$ sfn inspect STACK -a resources
|
278
290
|
```
|
279
291
|
|
280
292
|
This will provide a list of resources. Now, to make this more
|
@@ -283,7 +295,7 @@ that the 3rd resource in the collection is an auto scaling
|
|
283
295
|
group resource. We can isolate that resource for display:
|
284
296
|
|
285
297
|
```
|
286
|
-
$
|
298
|
+
$ sfn inspect STACK -a "resources.all.at(2)"
|
287
299
|
```
|
288
300
|
|
289
301
|
Note that the resources are an array, and we are using a zero
|
@@ -293,7 +305,7 @@ we already have seen. One of the handy features within the
|
|
293
305
|
So, we can expand this resource:
|
294
306
|
|
295
307
|
```
|
296
|
-
$
|
308
|
+
$ sfn inspect STACK -a "resources.all.at(2).expand"
|
297
309
|
```
|
298
310
|
|
299
311
|
This will expand the resource instance and return the actual
|
@@ -305,16 +317,85 @@ contains a `servers` attribute. The output lists the IDs of the
|
|
305
317
|
instances, but we can expand those as well:
|
306
318
|
|
307
319
|
```
|
308
|
-
$
|
320
|
+
$ sfn inspect STACK -a "resources.all.at(2).expand.servers.map(&:expand)"
|
309
321
|
```
|
310
322
|
|
311
323
|
The attribute string will be minimally processed when proxying calls
|
312
324
|
to the underlying models, which is why we are able to do ruby-ish
|
313
325
|
style things.
|
314
326
|
|
327
|
+
## Chef Knife Integration
|
328
|
+
|
329
|
+
This library will also provide `cloudformation` subcommands
|
330
|
+
to knife.
|
331
|
+
|
332
|
+
### Configuration
|
333
|
+
|
334
|
+
The easiest way to configure the plugin is via the
|
335
|
+
`knife.rb` file. Credentials are the only configuration
|
336
|
+
requirement, and the `Hash` provided is proxied to
|
337
|
+
[Miasma][miasma]. All configuration options provided
|
338
|
+
via the `sfn` command are allowed within the
|
339
|
+
`knife[:cloudformation]` namespace:
|
340
|
+
|
341
|
+
#### AWS
|
342
|
+
|
343
|
+
```ruby
|
344
|
+
# .chef/knife.rb
|
345
|
+
|
346
|
+
knife[:cloudformation][:credentials] = {
|
347
|
+
:provider => :aws,
|
348
|
+
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
349
|
+
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
|
350
|
+
:aws_region => ENV['AWS_REGION']
|
351
|
+
}
|
352
|
+
```
|
353
|
+
|
354
|
+
#### Rackspace
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
# .chef/knife.rb
|
358
|
+
|
359
|
+
knife[:cloudformation][:credentials] = {
|
360
|
+
:provider => :rackspace,
|
361
|
+
:rackspace_username => ENV['RACKSPACE_USERNAME'],
|
362
|
+
:rackspace_api_key => ENV['RACKSPACE_API_KEY'],
|
363
|
+
:rackspace_region => ENV['RACKSPACE_REGION']
|
364
|
+
}
|
365
|
+
```
|
366
|
+
|
367
|
+
#### OpenStack
|
368
|
+
|
369
|
+
```ruby
|
370
|
+
# .chef/knife.rb
|
371
|
+
|
372
|
+
knife[:cloudformation][:credentials] = {
|
373
|
+
:provider => :open_stack,
|
374
|
+
:open_stack_username => ENV['OPENSTACK_USERNAME'],
|
375
|
+
:open_stack_password => ENV['OPENSTACK_PASSWORD'],
|
376
|
+
:open_stack_identity_url => ENV['OPENSTACK_IDENTITY_URL'],
|
377
|
+
:open_stack_tenant_name => ENV['OPENSTACK_TENANT']
|
378
|
+
}
|
379
|
+
```
|
380
|
+
|
381
|
+
### Usage
|
382
|
+
|
383
|
+
All commands available via the `sfn` command are available as
|
384
|
+
knife subcommands under `cloudformation` and `sparkleformation`
|
385
|
+
|
386
|
+
```
|
387
|
+
$ knife cloudformation --help
|
388
|
+
```
|
389
|
+
|
390
|
+
or
|
391
|
+
|
392
|
+
```
|
393
|
+
$ knife sparkleformation --help
|
394
|
+
```
|
395
|
+
|
315
396
|
# Info
|
316
397
|
|
317
|
-
* Repository: https://github.com/
|
318
|
-
* IRC: Freenode @ #
|
398
|
+
* Repository: https://github.com/sparkleformation/sfn
|
399
|
+
* IRC: Freenode @ #sparkleformation
|
319
400
|
|
320
401
|
[miasma]: http://miasma-rb.github.io/miasma/
|