inprovise-vbox 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzBhZThhZmE1NGJkNWE3MDg2NDRhYWYwOTNiYmFjZDAxOGVmYTgwOQ==
4
+ MmEzN2Y0NWY5MmZjZWZhZjljMzc1Zjg0OWYwMGM2ZTdjZWI2MWJiOA==
5
5
  data.tar.gz: !binary |-
6
- ZDEwYjczZTNiNWIxNmU2ZDJmOTliN2U3YmNiMDEyMjRmYTY1NWY3Yw==
6
+ NTcyYjg1NWQ0NTdkMWZkYjQ1OTA5YTdmNWFhZjQ3YzdiNGY1MTE4NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjU0NmRhZGMyODM0YjkwOTBiMzFlZWYxZjJlOTZiNTNlZjAzYmM1MTMzZjNm
10
- ZDlhYTFlZmFmZWFiM2ZlNjlkMDc0OGUxNDU5ZDQ1NzBkOWZjNzQwZmQ4ZDNh
11
- MzRiNjJhNjhhNmNhZDMyZTFjOWQ2YTgxNzY2YWVkZDM3NDRlNDA=
9
+ OWVlODJiMzJiZjQ0YTFiOTdiZTJmNjE4ODJlYjkzNTYyMWI5YTdhNTc0Mjlj
10
+ ZGY0ODcwZjRmMjM1ZTBjOThhM2JkYzBmMWFiOTg1N2U3ZGUxNDYwMGU5ZGYy
11
+ YTNjMmQyYTU1OTFhYmI3NjM3ZGE3ODdlYTBkODVmMmFjZGQ1YTA=
12
12
  data.tar.gz: !binary |-
13
- ZDk4NTk0MmEyZjBlMWNiNzJjYzNjYmVmMjU5ZjZjMGYxYTI2Njg1Mzk2Y2U3
14
- ZmE0MDQ2ZjU5YTk4YmE5YTc3NGQ0NGQ1YmQzYjY5ZjZkZTYwNWZmNjU1MGY4
15
- ZmQyNDk3N2UwMmVlM2Q5YjJmNjc4YjgzODU5OWM1NWFiZTM3Nzc=
13
+ ZGUzMzEyM2IzY2RiMDlhNzM0YjhiOGRmNzRkMzNiYTI2Y2Y4NWM2YmU4YjY1
14
+ YjBiMWU5Mjk5ZmMwOTA2N2U4NzE1NDYyYzMwZDIxNjkwMjk0OTZiMjI4NTBm
15
+ YzQ3OTRhNzlhMjEzYmViNWNhYTQxNzAzMGEyODdlMjg0ZWUwOGE=
@@ -97,7 +97,7 @@ module Inprovise::VBox
97
97
 
98
98
  def setup
99
99
  # take care of defaults
100
- @configuration ||= {}
100
+ @configuration ||= Inprovise::Config.new
101
101
  @configuration[:arch] ||= 'x86_64'
102
102
  @configuration[:memory] ||= 1024
103
103
  @configuration[:cpus] ||= 1
@@ -233,17 +233,21 @@ module Inprovise::VBox
233
233
  end
234
234
  Inprovise::Infrastructure.save unless node_group.empty?
235
235
  unless vbs.vbox_no_sniff(self)
236
- # retry on (comm) failure
237
- begin
238
- Inprovise::Sniffer.run_sniffers_for(node)
239
- rescue
240
- sleep(5) # maybe VM needs more time to start up SSH
241
- node.disconnect!
242
- Inprovise::Sniffer.run_sniffers_for(node)
236
+ (1..5).each do |i|
237
+ begin
238
+ Inprovise::Sniffer.run_sniffers_for(node)
239
+ break
240
+ rescue
241
+ raise if i == 5
242
+ sleep(5) # maybe VM needs more time to start up SSH
243
+ node.disconnect!
244
+ # retry on (comm) failure
245
+ end
243
246
  end
244
247
  Inprovise::Infrastructure.save
245
248
  end
246
249
  log("Added new node #{node}", :bold)
250
+ config['vbox'] = node
247
251
  end
248
252
  end
249
253
 
@@ -265,12 +269,25 @@ module Inprovise::VBox
265
269
  end
266
270
 
267
271
  # add dependencies in correct order
268
- # MUST proceed any user defined dependencies
272
+ # MUST preceed any user defined dependencies
269
273
  dependencies.insert(0, @vm_script.name, @node_script.name)
270
274
 
271
275
  self
272
276
  end
273
277
 
278
+ # overload Script#configure
279
+ def configure(cfg=nil, &definition)
280
+ @configuration = Inprovise::Config.new.merge!(cfg) if cfg
281
+ if block_given?
282
+ vbs = self
283
+ command(:configure) do
284
+ self.instance_eval(&definition)
285
+ config['vbox'] = Inprovise::Infrastructure.find(config[vbs.name][:name])
286
+ end
287
+ end
288
+ @configuration
289
+ end
290
+
274
291
  def vbox_name(context)
275
292
  value_for context, context.config[name.to_sym][:name]
276
293
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Inprovise; module VBox
7
7
 
8
- VERSION = '0.2.9'
8
+ VERSION = '0.2.10'
9
9
 
10
10
  end; end
data/test/vbox_test.rb CHANGED
@@ -31,7 +31,7 @@ describe Inprovise::VBox do
31
31
  vbox 'myVbox' do
32
32
  end
33
33
  end
34
- script.configuration.must_be_kind_of Hash
34
+ script.configuration.must_be_kind_of Inprovise::Config
35
35
  script.configuration[:arch].must_equal 'x86_64'
36
36
  script.configuration[:memory].must_equal 1024
37
37
  script.configuration[:cpus].must_equal 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inprovise-vbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inprovise