hygroscope 1.1.3 → 1.1.4
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 +4 -0
- data/README.md +4 -1
- data/hygroscope.gemspec +2 -2
- data/lib/hygroscope/cli.rb +56 -45
- data/lib/hygroscope/template.rb +0 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf292228af925f56215b01c2daecd575b88a870
|
4
|
+
data.tar.gz: e4fba09c4430e6c8842c97b764e578025545bbba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fdf96c83aa5fbec940cbb140d7ac02f8ae11fd38357feed61e41fd6f5a9478ea65f97becefbb2ff6e97e6b29afb34896368dab15ec4fb622db82a920c21a86f
|
7
|
+
data.tar.gz: 53be8f7a4fffd08ef8654bbedf871fdec84594eaaae723a352f8d0f9040f0b415d81860e165d26e1d3a97f23d6abadbfbcfa8b6deea9e735535948567ea2d229
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[](http://badge.fury.io/rb/hygroscope)
|
2
|
+
[](https://codeclimate.com/github/agperson/hygroscope)
|
3
|
+
|
1
4
|
- - -
|
2
5
|
|
3
6
|
> **hy·gro·scope**<br>
|
@@ -22,4 +25,4 @@ Hygroscope aims to solve each of these specific problems in an opinionated way:
|
|
22
25
|
3. A payload directory, if present, will be packaged and uploaded to S3. Hygroscope will generate and pass to CF a signed time-limited URL for accessing and downloading the payload, or the CloudFormation template can manage an instance profile granting indefinite access to the payload.
|
23
26
|
4. If an existing stack is specified, its outputs will be fetched and passed through as input parameters when launching a new stack.
|
24
27
|
|
25
|
-
Hygroscope
|
28
|
+
Hygroscope can be installed via RubyGems. Run `hygroscope help` to view inline command documentation and options. See [template structure](https://github.com/agperson/hygroscope/wiki/Structure-of-a-Hygroscopic-Template) for information about the format of hygroscopic templates.
|
data/hygroscope.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'hygroscope'
|
3
|
-
s.version = '1.1.
|
3
|
+
s.version = '1.1.4'
|
4
4
|
s.summary = 'CloudFormation launcher'
|
5
5
|
s.description = 'A tool for managing the launch of complex CloudFormation stacks'
|
6
6
|
s.authors = ['Daniel Silverman']
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.add_dependency 'thor'
|
15
15
|
s.add_dependency 'cfoo', '>= 0.0.5'
|
16
|
-
s.add_dependency 'aws-sdk', '
|
16
|
+
s.add_dependency 'aws-sdk', '~> 2'
|
17
17
|
s.add_dependency 'archive-zip'
|
18
18
|
s.add_dependency 'json_color'
|
19
19
|
|
data/lib/hygroscope/cli.rb
CHANGED
@@ -52,6 +52,30 @@ module Hygroscope
|
|
52
52
|
def template_path
|
53
53
|
File.join(hygro_path, 'template')
|
54
54
|
end
|
55
|
+
|
56
|
+
def say_paramset(name)
|
57
|
+
begin
|
58
|
+
p = Hygroscope::ParamSet.new(name)
|
59
|
+
rescue Hygroscope::ParamSetNotFoundError
|
60
|
+
say_fail("Paramset #{name} does not exist!")
|
61
|
+
end
|
62
|
+
|
63
|
+
say "Parameters for '#{File.basename(Dir.pwd)}' paramset '#{p.name}':", :yellow
|
64
|
+
print_table p.parameters, indent: 2
|
65
|
+
say "\nTo edit existing parameters, use the 'create' command with the --ask flag."
|
66
|
+
end
|
67
|
+
|
68
|
+
def say_paramset_list
|
69
|
+
files = Dir.glob(File.join(hygro_path, 'paramsets', '*.{yml,yaml}'))
|
70
|
+
|
71
|
+
say_fail("No saved paramsets for #{hygro_name}.") if files.empty?
|
72
|
+
|
73
|
+
say "Saved paramsets for '#{hygro_name}':", :yellow
|
74
|
+
files.map do |f|
|
75
|
+
say ' ' + File.basename(f, File.extname(f))
|
76
|
+
end
|
77
|
+
say "\nTo list parameters in a set, use the --name option."
|
78
|
+
end
|
55
79
|
end
|
56
80
|
|
57
81
|
desc 'prepare', 'Prepare to create or update a stack by generating the template, assembling parameters, and managing payload upload', hide: true
|
@@ -154,15 +178,6 @@ module Hygroscope
|
|
154
178
|
say_status('', "s3://#{payload.bucket}/#{payload.key}")
|
155
179
|
end
|
156
180
|
|
157
|
-
# Set some additional parameters, if present
|
158
|
-
# HygroscopeAccountAzList
|
159
|
-
# HygroscopeAccountAzCount
|
160
|
-
#if missing.include?('HygroscopeAccountAzList') ||
|
161
|
-
# misisng.include?('HygroscopeAccountAzCount')
|
162
|
-
# p.set('HygroscopeAccountAzList', azlist) if missing.include?('HygroscopeAccountAzList')
|
163
|
-
# p.set('HygroscopeAccountAzCount', azlist) if missing.include?('HygroscopeAccountAzCount')
|
164
|
-
#end
|
165
|
-
|
166
181
|
[t, p]
|
167
182
|
end
|
168
183
|
|
@@ -185,6 +200,11 @@ module Hygroscope
|
|
185
200
|
type: :boolean,
|
186
201
|
default: false,
|
187
202
|
desc: 'Still prompt for parameters even when using a paramset'
|
203
|
+
method_option :tags,
|
204
|
+
aliases: '-t',
|
205
|
+
type: :array,
|
206
|
+
required: false,
|
207
|
+
desc: 'One or more parameters to apply as tags to all stack resources'
|
188
208
|
def create
|
189
209
|
check_path
|
190
210
|
validate
|
@@ -195,7 +215,16 @@ module Hygroscope
|
|
195
215
|
s = Hygroscope::Stack.new(options[:name])
|
196
216
|
s.parameters = paramset.parameters
|
197
217
|
s.template = template.compress
|
198
|
-
|
218
|
+
|
219
|
+
s.tags['X-Hygroscope-Template'] = hygro_name
|
220
|
+
options[:tags].each do |tag|
|
221
|
+
if paramset.get(tag)
|
222
|
+
s.tags[tag] = paramset.get(tag)
|
223
|
+
else
|
224
|
+
say_status('info', "Skipping tag #{tag} because it does not exist", :blue)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
199
228
|
s.capabilities = ['CAPABILITY_IAM']
|
200
229
|
|
201
230
|
s.create!
|
@@ -249,12 +278,13 @@ module Hygroscope
|
|
249
278
|
desc: 'Delete without asking for confirmation'
|
250
279
|
def delete
|
251
280
|
check_path
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
281
|
+
abort unless options[:force] ||
|
282
|
+
yes?("Really delete stack #{options[:name]} [y/N]?")
|
283
|
+
|
284
|
+
say('Deleting stack!')
|
285
|
+
stack = Hygroscope::Stack.new(options[:name])
|
286
|
+
stack.delete!
|
287
|
+
status
|
258
288
|
end
|
259
289
|
|
260
290
|
desc 'status', 'View status of stack create/update/delete action.\nUse the --name option to change which stack is reported upon.'
|
@@ -284,7 +314,7 @@ module Hygroscope
|
|
284
314
|
|
285
315
|
# Fancy acrobatics to fit output to terminal width. If the terminal
|
286
316
|
# window is too small, fallback to something appropriate for ~80 chars
|
287
|
-
term_width =
|
317
|
+
term_width = `stty size 2>/dev/null`.split[1].to_i || `tput cols 2>/dev/null`.to_i
|
288
318
|
type_width = term_width < 80 ? 30 : term_width - 50
|
289
319
|
output_width = term_width < 80 ? 54 : term_width - 31
|
290
320
|
|
@@ -321,7 +351,9 @@ module Hygroscope
|
|
321
351
|
end while true
|
322
352
|
end
|
323
353
|
|
324
|
-
desc 'generate',
|
354
|
+
desc 'generate',
|
355
|
+
"Generate and display JSON output from template files.\n" \
|
356
|
+
"To validate that the template is well-formed use the 'validate' command."
|
325
357
|
method_option :color,
|
326
358
|
aliases: '-c',
|
327
359
|
type: :boolean,
|
@@ -341,21 +373,16 @@ module Hygroscope
|
|
341
373
|
desc 'validate', "Generate JSON from template files and validate that it is well-formed.\nThis utilzies the CloudFormation API to validate the template but does not detect logical errors."
|
342
374
|
def validate
|
343
375
|
check_path
|
376
|
+
|
344
377
|
begin
|
345
378
|
t = Hygroscope::Template.new(template_path)
|
346
379
|
t.validate
|
347
380
|
rescue Aws::CloudFormation::Errors::ValidationError => e
|
348
|
-
|
349
|
-
print_wrapped e.message, indent: 2
|
350
|
-
abort
|
381
|
+
say_fail("Validation error: #{e.message}")
|
351
382
|
rescue Hygroscope::TemplateYamlParseError => e
|
352
|
-
|
353
|
-
puts e
|
354
|
-
abort
|
383
|
+
say_fail("YAML parsing error: #{e.message}")
|
355
384
|
rescue => e
|
356
|
-
|
357
|
-
print_wrapped e.message, indent: 2
|
358
|
-
abort
|
385
|
+
say_fail(e.message)
|
359
386
|
else
|
360
387
|
say_status('ok', 'Template is valid', :green)
|
361
388
|
end
|
@@ -368,25 +395,9 @@ module Hygroscope
|
|
368
395
|
desc: 'Name of a paramset'
|
369
396
|
def paramset
|
370
397
|
if options[:name]
|
371
|
-
|
372
|
-
p = Hygroscope::ParamSet.new(options[:name])
|
373
|
-
rescue Hygroscope::ParamSetNotFoundError
|
374
|
-
raise("Paramset #{options[:name]} does not exist!")
|
375
|
-
end
|
376
|
-
say "Parameters for '#{hygro_name}' paramset '#{p.name}':", :yellow
|
377
|
-
print_table p.parameters, indent: 2
|
378
|
-
say "\nTo edit existing parameters, use the 'create' command with the --ask flag."
|
398
|
+
say_paramset(options[:name])
|
379
399
|
else
|
380
|
-
|
381
|
-
if files.empty?
|
382
|
-
say "No saved paramsets for '#{hygro_name}'.", :red
|
383
|
-
else
|
384
|
-
say "Saved paramsets for '#{hygro_name}':", :yellow
|
385
|
-
files.map do |f|
|
386
|
-
say ' ' + File.basename(f, File.extname(f))
|
387
|
-
end
|
388
|
-
say "\nTo list parameters in a set, use the --name option."
|
389
|
-
end
|
400
|
+
say_paramset_list
|
390
401
|
end
|
391
402
|
end
|
392
403
|
end
|
data/lib/hygroscope/template.rb
CHANGED
@@ -28,9 +28,6 @@ module Hygroscope
|
|
28
28
|
|
29
29
|
fail(TemplateYamlParseError, err.string) unless err.string.empty?
|
30
30
|
|
31
|
-
# Substitute
|
32
|
-
# APP_CONFIG = YAML.load(ERB.new(File.read("#{Rails.root}/config/app_config.yml")).result)[Rails.env]
|
33
|
-
#
|
34
31
|
@template = out.string
|
35
32
|
@template
|
36
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hygroscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Silverman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: aws-sdk
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2
|
47
|
+
version: '2'
|
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: 2
|
54
|
+
version: '2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: archive-zip
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.2.0
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: CloudFormation launcher
|