biosphere 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18516adcf232287623fbc3b0a38a9fcbf3a06467
4
- data.tar.gz: 25b96568a2cbbf6760d4cf8f5ac83c74d0111272
3
+ metadata.gz: 81c2cd041ce9dde3053f5fe132759eb1b613bca0
4
+ data.tar.gz: 3e8b438a25f87f2d0768f95e0b9d869ac4e84e08
5
5
  SHA512:
6
- metadata.gz: a00f8ba95c94a69a16aad64144dbec2e5fecccb40a3a9078110ff3fb73215f0150a2822c1a0b395cac4234072f5fa7f239bfbda0cfec704bf5931367deb7c3ca
7
- data.tar.gz: 1a34d3f63840b2cd4990d686d09cdc0e8cffc10084e35e176f0d1eac01967368b58acc702905c6ab2c68a845585ff86533869e9970e22c4cd34976e96e84431a
6
+ metadata.gz: c860e5fb498ea64939b51c7ff6b224ba8da60c8e81f3b438152f6d1a7ac88edd3b278c95e9edfc39f9719ad30d907276c59010e763701e6f3a6dcf13db33c710
7
+ data.tar.gz: 8e9593ac3d4dad87d535983b2150b5a986c52dc6b16dee8baa7a20a560ea94553de4aced5c91ca42a2fb6a5725aebb5b1981a501fbbad72d5f8675902eaefb9d
data/bin/biosphere CHANGED
@@ -244,6 +244,21 @@ elsif ARGV[0] == "commit" && options.src
244
244
  puts "The child process exited!"
245
245
  end
246
246
 
247
+ # Refresh outputs to make sure they are available in the state file
248
+ command_output = ""
249
+ begin
250
+ puts "Refreshing terraform outputs"
251
+ PTY.spawn("terraform refresh -state=#{state_file} #{options.build_dir}") do |stdout, stdin, pid|
252
+ begin
253
+ stdout.each { |line| command_output << line }
254
+ rescue Errno::EIO
255
+ end
256
+ end
257
+ rescue PTY::ChildExited
258
+ puts "Error executing terraform refresh.:\n"
259
+ puts command_output
260
+ end
261
+
247
262
  puts "Loading outputs for #{deployment} from #{state_file}"
248
263
  suite.deployments[deployment].load_outputs(state_file)
249
264
  state.save()
data/lib/biosphere.rb CHANGED
@@ -12,5 +12,6 @@ require "biosphere/deployment"
12
12
  require "biosphere/terraformproxy"
13
13
  require "biosphere/suite"
14
14
  require "biosphere/cli/terraformplanning"
15
+ require "biosphere/cli/updatemanager"
15
16
  require "biosphere/s3"
16
17
 
@@ -0,0 +1,31 @@
1
+ require 'pp'
2
+ require 'treetop'
3
+ require 'colorize'
4
+ require 'net/http'
5
+
6
+ class Biosphere
7
+
8
+ class CLI
9
+ class UpdateManager
10
+
11
+
12
+ def check_for_update(version = ::Biosphere::Version)
13
+ url = URI('https://rubygems.org/api/v1/versions/biosphere/latest.json')
14
+
15
+ response = get_response_with_redirect(url)
16
+ pp response
17
+
18
+ return info
19
+ end
20
+
21
+ private
22
+ def get_response_with_redirect(uri)
23
+ r = Net::HTTP.get_response(uri)
24
+ if r.code == "301"
25
+ r = Net::HTTP.get_response(URI.parse(r.header['location']))
26
+ end
27
+ r
28
+ end
29
+ end
30
+ end
31
+ end
@@ -169,8 +169,19 @@ class Biosphere
169
169
  end
170
170
 
171
171
  @outputs.each do |output|
172
- value = outputs[output[:resource_name]]
173
- instance_exec(self.name, output[:name], value["value"], value, &output[:block])
172
+ begin
173
+ value = outputs[output[:resource_name]]
174
+ instance_exec(self.name, output[:name], value["value"], value, &output[:block])
175
+ rescue NoMethodError => e
176
+ STDERR.puts "Error evaluating output #{output}. error: #{e}"
177
+ puts "output:"
178
+ pp output
179
+ puts "value:"
180
+ pp value
181
+ puts "outputs:"
182
+ pp outputs
183
+ STDERR.puts "This is an internal error. You should be able to run biosphere commit again to try to fix this."
184
+ end
174
185
  end
175
186
  end
176
187
 
@@ -184,8 +195,12 @@ class Biosphere
184
195
  end
185
196
 
186
197
  outputs = tf_state["modules"].first["outputs"]
187
-
188
- evaluate_outputs(outputs)
198
+ if outputs.length == 0
199
+ STDERR.puts "WARNING: No outputs found from the terraform state file #{tfstate_filename}. This might be a bug in terraform."
200
+ STDERR.puts "Try to run \"biosphere commit\" again."
201
+ else
202
+ evaluate_outputs(outputs)
203
+ end
189
204
  end
190
205
 
191
206
  def evaluate_resources()
@@ -1,3 +1,3 @@
1
1
  class Biosphere
2
- Version = "0.2.1"
2
+ Version = "0.2.2"
3
3
  end
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.1
4
+ version: 0.2.2
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-05-15 00:00:00.000000000 Z
11
+ date: 2017-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -164,6 +164,7 @@ files:
164
164
  - examples/example.rb
165
165
  - lib/biosphere.rb
166
166
  - lib/biosphere/cli/terraformplanning.rb
167
+ - lib/biosphere/cli/updatemanager.rb
167
168
  - lib/biosphere/deployment.rb
168
169
  - lib/biosphere/ipaddressallocator.rb
169
170
  - lib/biosphere/kube.rb