biosphere 0.2.11 → 0.2.12
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/bin/biosphere +45 -19
- data/lib/biosphere/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 189e28cdc58fbf296bf95ecc2fc6d179781f464a
|
4
|
+
data.tar.gz: 3924f72d34e55d811cd034afd98aab37341f759c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caba813ea80f19c8972bf3aecb98c779b69f3329250f930d36d9ebb33c9ab2e1c44eac0cdf18aa5f18f3a32e029cbac7150560036a611e0ef947304e59dca5c9
|
7
|
+
data.tar.gz: 091e550d18b35fb2787334ea09cb8085ff5cde378183ddec0b3a4b52876a9610dd9a0ed8c771906d8ea832b29ebdfd551ebba894d289fd0302d28c418b2acfee
|
data/bin/biosphere
CHANGED
@@ -16,6 +16,7 @@ class BiosphereOpts
|
|
16
16
|
options = OpenStruct.new
|
17
17
|
options.build_dir = "build"
|
18
18
|
options.src = "./"
|
19
|
+
options.force = false
|
19
20
|
options.version = ::Biosphere::Version
|
20
21
|
|
21
22
|
opt_parser = OptionParser.new do |opts|
|
@@ -51,6 +52,10 @@ class BiosphereOpts
|
|
51
52
|
exit
|
52
53
|
end
|
53
54
|
|
55
|
+
opts.on("--force", "Don't prompt for user input") do
|
56
|
+
options.force = true
|
57
|
+
end
|
58
|
+
|
54
59
|
end
|
55
60
|
|
56
61
|
opt_parser.parse!(args)
|
@@ -136,16 +141,20 @@ if options.src
|
|
136
141
|
|
137
142
|
unless state.node[:deployments][""].nil?
|
138
143
|
answer = ""
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
144
|
+
if !options.force
|
145
|
+
while answer.empty? || (answer != "y" && answer != "n")
|
146
|
+
puts "\e[31mDeployment with an empty name, do you want to clean these out now? [y/n]\e[0m"
|
147
|
+
answer = STDIN.gets.chomp
|
148
|
+
end
|
143
149
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
150
|
+
if answer == "n"
|
151
|
+
puts "Remember to clean these out later, this state won't work with Kubernetes"
|
152
|
+
elsif answer == "y"
|
153
|
+
state.node[:deployments].delete("")
|
154
|
+
puts "\e[32mRemoved deployment with empty name\e[0m"
|
155
|
+
end
|
156
|
+
else
|
157
|
+
puts "Forcing since --force was set"
|
149
158
|
end
|
150
159
|
end
|
151
160
|
end
|
@@ -204,9 +213,13 @@ elsif ARGV[0] == "deployment" && options.src
|
|
204
213
|
elsif ARGV[0] == "statereset" && options.src
|
205
214
|
|
206
215
|
answer = ""
|
207
|
-
|
208
|
-
|
209
|
-
|
216
|
+
if !options.force
|
217
|
+
while answer.empty? || (answer != "y" && answer != "n")
|
218
|
+
print "\nAre you sure you want to do a full state reset for #{options.build_dir} y/n: "
|
219
|
+
answer = STDIN.gets.chomp
|
220
|
+
end
|
221
|
+
else
|
222
|
+
answer = "y"
|
210
223
|
end
|
211
224
|
|
212
225
|
if answer == "n"
|
@@ -244,7 +257,12 @@ elsif ARGV[0] == "commit" && options.src
|
|
244
257
|
|
245
258
|
s3.set_lock()
|
246
259
|
s3.retrieve("#{options.build_dir}/#{deployment}.tfstate")
|
247
|
-
|
260
|
+
begin
|
261
|
+
tf_plan_str = %x( terraform plan -state=#{options.build_dir}/#{deployment}.tfstate -out #{options.build_dir}/plan #{options.build_dir}/#{deployment} )
|
262
|
+
rescue Errno::ENOENT => e
|
263
|
+
STDERR.puts "Could not find terraform. Install with with \"brew install terraform\"".colorize(:red)
|
264
|
+
s3.release_lock()
|
265
|
+
end
|
248
266
|
tfplanning = Biosphere::CLI::TerraformPlanning.new()
|
249
267
|
plan = tfplanning.generate_plan(suite.deployments[deployment], tf_plan_str)
|
250
268
|
if !plan
|
@@ -265,9 +283,13 @@ elsif ARGV[0] == "commit" && options.src
|
|
265
283
|
targets = plan.get_resources.collect { |x| "-target=#{x}" }.join(" ")
|
266
284
|
puts "Targets: #{targets}"
|
267
285
|
answer = ""
|
268
|
-
|
269
|
-
|
270
|
-
|
286
|
+
if !options.force
|
287
|
+
while answer.empty? || (answer != "y" && answer != "n")
|
288
|
+
print "\nDoes the plan look reasonable? (Answering yes will apply the changes) y/n: "
|
289
|
+
answer = STDIN.gets.chomp
|
290
|
+
end
|
291
|
+
else
|
292
|
+
answer = "y"
|
271
293
|
end
|
272
294
|
|
273
295
|
if answer == "n"
|
@@ -331,9 +353,13 @@ elsif ARGV[0] == "destroy" && options.src
|
|
331
353
|
s3.set_lock()
|
332
354
|
s3.retrieve("#{options.build_dir}/#{deployment}.tfstate")
|
333
355
|
answer = ""
|
334
|
-
|
335
|
-
|
336
|
-
|
356
|
+
if !options.force
|
357
|
+
while answer.empty? || (answer != "y" && answer != "n")
|
358
|
+
print "\nYou are about to destroy deployment #{deployment}? (Answering yes will nuke it from the orbit) y/n: "
|
359
|
+
answer = STDIN.gets.chomp
|
360
|
+
end
|
361
|
+
else
|
362
|
+
answer = "y"
|
337
363
|
end
|
338
364
|
|
339
365
|
if answer == "n"
|
data/lib/biosphere/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: biosphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juho Mäkinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|