inprovise-vbox 0.2.7 → 0.2.8

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
- MDc3MTU3NDE3N2ZjYjZmYzQzNWIxZTlkOGVkZTNiZWE0MjIyZGZjZA==
4
+ NjlhOWU5MzNiNDQ5MThlNTIyNDg0OTI1YzdiYWIxN2RlNTg1MTU2Yw==
5
5
  data.tar.gz: !binary |-
6
- MzNiNDZhNzQ5NjI1OTMyNDY5MTA2MzhiYmM2YzBmZTY5YTQwYjk4Mw==
6
+ YjY3M2IzM2RkYjcyYTNlN2M5MmViYzQ5ZDNiZTljYzhmZjIxNTA4OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTA2ZTk2MGFiNWMzMGFmZWEyYzI5YzE5NmQ2ZDA1NzUwZDg2ZGI1NTM4YTA0
10
- NzA2YzdhYWQxNzQ5ZDFjNzc3OTIzYmI2MTQ0ZGU1MDQyNDE2YTE5NmEzZGY2
11
- ZjViZjA5MjMwNGY3YTE0MzZkN2NhODFiYjNiODIwY2RiNDQ3ZDM=
9
+ ZDE4OWIyN2M2ODU1Njc5ZDIxODRlZjIwNGEwMDYwN2JiN2E2NDY5YjA2NzVk
10
+ OWFhZjYxYzg0NTRkN2ZhZTQ2YTdkNTQ2YzliZmJmZjc4NWExYWU5MzJjMGQw
11
+ MzA4Y2VhMzkzNGQ0YmUwOWJiYzIzYzA1OWE3MTY4NzkxYmYyMWE=
12
12
  data.tar.gz: !binary |-
13
- ZmEwNjUxMzdiYjk0OTVjYjljMjhmYjQwZmY3NDAxMmJiZjk0ODFjZjFhYWMz
14
- NDFkMGZlYjcxODQyYjE1YjYzOWY0N2I3ZWNkNzJlMDk2NzBmYzk0NDYyZDI0
15
- MmY1M2U5MjkwYmYzMmFlMThiODk5YzI1YzMyOGMzM2QzNGY4ZDY=
13
+ NGUxYzI3Y2NmMDUyM2QwMTU4NWQzNTE2ZjEwOTIwZjU2YzcwZmYxZDg5OGI1
14
+ NzZjYTZmNDcxMDM2ZWNmMmQwODQzYTI4NTVlOTdjMmQ1YWYyNzNmN2ZlN2I2
15
+ YTg3YjIyZGI1ODA4YTU4YmUyOGQxN2UzNDRiNjUzZDNhZGMyOTc=
@@ -42,13 +42,20 @@ module Inprovise::VBox
42
42
  cmdline << "--arch #{cfg[:arch]} "
43
43
  cmdline << '--autostart ' if cfg[:autostart]
44
44
  cmdline << "--name #{vboxname} --memory #{cfg[:memory]} --vcpus #{cfg[:cpus]} "
45
- cmdline << "--os-variant #{cfg[:os]} " if cfg[:os]
45
+ # check if os variant defined on this host
46
+ if cfg[:os]
47
+ os_variant = sudo("osinfo-query --fields=short-id os | grep #{cfg[:os]}").strip
48
+ cmdline << "--os-variant #{cfg[:os]} " unless os_variant.empty?
49
+ end
50
+ cmdline << '--network '
46
51
  cmdline << case cfg[:network]
47
52
  when :hostnet
48
- "--network network=#{cfg[:netname] || 'default'} "
53
+ "network=#{cfg[:netname] || 'default'}"
49
54
  when :bridge
50
- "--network bridge=#{cfg[:netname] || 'virbr0' } "
55
+ "bridge=#{cfg[:netname] || 'virbr0' }"
51
56
  end
57
+ cmdline << ",model=#{cfg[:nic]}" if cfg[:nic]
58
+ cmdline << ' '
52
59
  cmdline << "--graphics #{cfg[:graphics] || 'spice'} "
53
60
  cmdline << "--disk path=#{cfg[:image]},device=disk,boot_order=1"
54
61
  cmdline << ",bus=#{cfg[:diskbus]}" if cfg[:diskbus]
@@ -76,6 +83,7 @@ module Inprovise::VBox
76
83
  # :os
77
84
  # :network
78
85
  # :netname
86
+ # :nic
79
87
  # :autostart
80
88
  # :kernel
81
89
  # :kernel_args
@@ -131,6 +139,7 @@ module Inprovise::VBox
131
139
  :os => vbs.vbox_os(self),
132
140
  :network => vbs.vbox_network(self) || :hostnet,
133
141
  :netname => vbs.vbox_netname(self),
142
+ :nic => vbs.vbox_nic(self),
134
143
  :graphics => vbs.vbox_graphics(self),
135
144
  :image => vbs.vbox_image(self),
136
145
  :diskbus => vbs.vbox_diskbus(self),
@@ -174,12 +183,16 @@ module Inprovise::VBox
174
183
  @node_script = Inprovise::DSL.script "#{name}#vbox_node" do
175
184
 
176
185
  validate do
177
- vmname = vbs.vbox_name(self)
178
- if tgt = Inprovise::Infrastructure.find(vmname)
179
- raise ArgumentError, "VBox #{vmname} clashes with existing group" if Inprovise::Infrastructure::Group === tgt
180
- true
186
+ if vbs.vbox_no_node(self)
187
+ config.command != :revert
181
188
  else
182
- false
189
+ vmname = vbs.vbox_name(self)
190
+ if tgt = Inprovise::Infrastructure.find(vmname)
191
+ raise ArgumentError, "VBox #{vmname} clashes with existing group" if Inprovise::Infrastructure::Group === tgt
192
+ true
193
+ else
194
+ false
195
+ end
183
196
  end
184
197
  end
185
198
 
@@ -221,7 +234,13 @@ module Inprovise::VBox
221
234
  Inprovise::Infrastructure.save unless node_group.empty?
222
235
  unless vbs.vbox_no_sniff(self)
223
236
  # retry on (comm) failure
224
- Inprovise::Sniffer.run_sniffers_for(node) rescue Inprovise::Sniffer.run_sniffers_for(node)
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)
243
+ end
225
244
  Inprovise::Infrastructure.save
226
245
  end
227
246
  log("Added new node #{node}", :bold)
@@ -296,6 +315,10 @@ module Inprovise::VBox
296
315
  value_for context, context.config[name.to_sym][:netname]
297
316
  end
298
317
 
318
+ def vbox_nic(context)
319
+ value_for context, context.config[name.to_sym][:nic]
320
+ end
321
+
299
322
  def vbox_graphics(context)
300
323
  value_for context, context.config[name.to_sym][:graphics]
301
324
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Inprovise; module VBox
7
7
 
8
- VERSION = '0.2.7'
8
+ VERSION = '0.2.8'
9
9
 
10
10
  end; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inprovise-vbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino