vagrant-libvirt 0.6.2 → 0.6.3

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
  SHA256:
3
- metadata.gz: 3e9e48f76c74f80aa79c260ab558d0a72ec8dd3ecc667731ff05bd0a54d8ab8b
4
- data.tar.gz: 8144733ea9d0f2a0a3152d481ab690120017a6767dcee783de8d5ba86d320d62
3
+ metadata.gz: 9cdcf747d5d28e485d660d025beefdd8c3f58c107816ce719bcb0ba14559913a
4
+ data.tar.gz: 71026dbb9ada779894dd0d5136f91e0da2c986ee279c320919817aaea511bdce
5
5
  SHA512:
6
- metadata.gz: a4a81d5cacbee89973ae0dee7eedcc28ccee0a66d9d1139cef7a91ade87b16ca85a91f0cf22e7d8659450114691fc3079b7beef5cb002621683881cc99ca634a
7
- data.tar.gz: 418ed72a453ba03aca7c0cb67d15adc431d37ab5de7c7f0f2d9f9a987f90ad7a88e923249eaf0a324ebc57886dc1b4d9eb23bcf3258254970dc8cdc8ba9a6f90
6
+ metadata.gz: 7dc8d355a72f309322630617dbb3be94536969637bc3f6d7c9fa907aebbbd1b96bcc49aad3501dd5dd3a1220d17d5d12a14f7cd87d57e43c2790238e5099622d
7
+ data.tar.gz: ded86b4e49bfb44e3d257936373b804d918a1eb34b956e2a02c9d99e60a7f5140cdc5241740720461a505897b74690589e0ba8c9a4656ce430be9164b86541c3
@@ -34,10 +34,11 @@ module VagrantPlugins
34
34
  box_format = env[:machine].box.metadata['format']
35
35
  HandleBoxImage.verify_box_format(box_format)
36
36
 
37
+ image_path = HandleBoxImage.get_box_image_path(env[:machine].box, 'box.img')
37
38
  env[:box_volume_number] = 1
38
39
  env[:box_volumes] = [{
39
- :path => HandleBoxImage.get_box_image_path(env[:machine].box, 'box.img'),
40
- :name => HandleBoxImage.get_volume_name(env[:machine].box, 'box'),
40
+ :path => image_path,
41
+ :name => HandleBoxImage.get_volume_name(env[:machine].box, 'box', image_path, env[:ui]),
41
42
  :virtual_size => HandleBoxImage.get_virtual_size(env),
42
43
  :format => box_format,
43
44
  }]
@@ -58,6 +59,8 @@ module VagrantPlugins
58
59
  volume_name = HandleBoxImage.get_volume_name(
59
60
  env[:machine].box,
60
61
  disks[i].fetch('name', disks[i]['path'].sub(/#{File.extname(disks[i]['path'])}$/, '')),
62
+ image_path,
63
+ env[:ui],
61
64
  )
62
65
 
63
66
  # allowing name means needing to check that it doesn't cause a clash
@@ -122,15 +125,21 @@ module VagrantPlugins
122
125
 
123
126
  protected
124
127
 
125
- def self.get_volume_name(box, name)
128
+ def self.get_volume_name(box, name, path, ui)
129
+ version = begin
130
+ box.version.to_s
131
+ rescue
132
+ ''
133
+ end
134
+
135
+ if version.empty?
136
+ ui.warn(I18n.t('vagrant_libvirt.box_version_missing', name: box.name.to_s))
137
+
138
+ version = "0_#{File.mtime(path).to_i}"
139
+ end
140
+
126
141
  vol_name = box.name.to_s.dup.gsub('/', '-VAGRANTSLASH-')
127
- vol_name << "_vagrant_box_image_#{
128
- begin
129
- box.version.to_s
130
- rescue
131
- ''
132
- end
133
- }_#{name.dup.gsub('/', '-SLASH-')}.img"
142
+ vol_name << "_vagrant_box_image_#{version}_#{name.dup.gsub('/', '-SLASH-')}.img"
134
143
  end
135
144
 
136
145
  def self.get_virtual_size(env)
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
data/locales/en.yml CHANGED
@@ -15,6 +15,10 @@ en:
15
15
  manual_resize_required: |-
16
16
  Created volume larger than box defaults, will require manual resizing of
17
17
  filesystems to utilize.
18
+ box_version_missing: |-
19
+ No verison detected for %{name}, using timestamp to watch for modifications. Consider
20
+ generating a local metadata for the box with a version to allow better handling.
21
+ See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details.
18
22
  uploading_volume: |-
19
23
  Uploading base box image as volume into Libvirt storage...
20
24
  creating_domain_volume: |-
@@ -98,6 +98,36 @@ describe VagrantPlugins::ProviderLibvirt::Action::HandleBoxImage do
98
98
  )
99
99
  end
100
100
 
101
+ context 'when no box version set' do
102
+ let(:box_mtime) { Time.now }
103
+
104
+ before do
105
+ expect(env[:machine]).to receive_message_chain("box.version") { nil }
106
+ expect(File).to receive(:mtime).and_return(box_mtime)
107
+ end
108
+
109
+ it 'should use the box file timestamp' do
110
+ expect(ui).to receive(:warn).with(
111
+ "No verison detected for test, using timestamp to watch for modifications. Consider\n" +
112
+ "generating a local metadata for the box with a version to allow better handling.\n" +
113
+ 'See https://www.vagrantup.com/docs/boxes/format#box-metadata for further details.'
114
+ )
115
+
116
+ expect(subject.call(env)).to be_nil
117
+ expect(env[:box_volume_number]).to eq(1)
118
+ expect(env[:box_volumes]).to eq(
119
+ [
120
+ {
121
+ :path=>"/test/box.img",
122
+ :name=>"test_vagrant_box_image_0_#{box_mtime.to_i}_box.img",
123
+ :virtual_size=>byte_number_5G,
124
+ :format=>"qcow2"
125
+ }
126
+ ]
127
+ )
128
+ end
129
+ end
130
+
101
131
  context 'When config.machine_virtual_size is set and smaller than box_virtual_size' do
102
132
  before do
103
133
  allow(env[:machine]).to receive_message_chain("provider_config.machine_virtual_size").and_return(1)
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+ require 'support/sharedcontext'
3
+
4
+ describe 'VagrantPlugins::ProviderLibvirt::Provider' do
5
+ require 'vagrant-libvirt/provider'
6
+
7
+ include_context 'unit'
8
+
9
+ describe '#ssh_info' do
10
+ end
11
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Stanek
8
8
  - Dima Vasilets
9
9
  - Brian Pitts
10
10
  - Darragh Bailey
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-10-12 00:00:00.000000000 Z
14
+ date: 2021-10-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec-core
@@ -264,6 +264,7 @@ files:
264
264
  - spec/unit/action_spec.rb
265
265
  - spec/unit/config_spec.rb
266
266
  - spec/unit/driver_spec.rb
267
+ - spec/unit/provider_spec.rb
267
268
  - spec/unit/templates/domain_all_settings.xml
268
269
  - spec/unit/templates/domain_custom_cpu_model.xml
269
270
  - spec/unit/templates/domain_defaults.xml
@@ -275,7 +276,7 @@ homepage: https://github.com/vagrant-libvirt/vagrant-libvirt
275
276
  licenses:
276
277
  - MIT
277
278
  metadata: {}
278
- post_install_message:
279
+ post_install_message:
279
280
  rdoc_options: []
280
281
  require_paths:
281
282
  - lib
@@ -290,50 +291,51 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
291
  - !ruby/object:Gem::Version
291
292
  version: '0'
292
293
  requirements: []
293
- rubygems_version: 3.0.8
294
- signing_key:
294
+ rubygems_version: 3.0.9
295
+ signing_key:
295
296
  specification_version: 4
296
297
  summary: libvirt provider for Vagrant.
297
298
  test_files:
298
- - spec/support/temporary_dir.rb
299
- - spec/support/libvirt_context.rb
300
- - spec/support/binding_proc.rb
301
- - spec/support/sharedcontext.rb
302
299
  - spec/support/matchers/have_file_content.rb
300
+ - spec/support/binding_proc.rb
303
301
  - spec/support/environment_helper.rb
304
- - spec/unit/action_spec.rb
305
- - spec/unit/templates/domain_all_settings.xml
306
- - spec/unit/templates/domain_custom_cpu_model.xml
307
- - spec/unit/templates/domain_defaults.xml
308
- - spec/unit/templates/domain_spec.rb
309
- - spec/unit/templates/tpm/version_1.2.xml
310
- - spec/unit/templates/tpm/version_2.0.xml
311
- - spec/unit/action/create_domain_spec/additional_disks_domain.xml
312
- - spec/unit/action/create_domain_spec/default_domain.xml
302
+ - spec/support/libvirt_context.rb
303
+ - spec/support/temporary_dir.rb
304
+ - spec/support/sharedcontext.rb
313
305
  - spec/unit/action/create_domain_spec/default_system_storage_pool.xml
314
306
  - spec/unit/action/create_domain_spec/default_user_storage_pool.xml
315
- - spec/unit/action/create_domain_spec.rb
316
- - spec/unit/action/wait_till_up_spec.rb
317
- - spec/unit/action/package_domain_spec.rb
318
- - spec/unit/action/forward_ports_spec.rb
319
- - spec/unit/action/destroy_domain_spec.rb
320
- - spec/unit/action/halt_domain_spec.rb
321
- - spec/unit/action/start_domain_spec.rb
322
- - spec/unit/action/shutdown_domain_spec.rb
323
- - spec/unit/action/clean_machine_folder_spec.rb
324
- - spec/unit/action/create_domain_volume_spec.rb
325
- - spec/unit/action/set_name_of_domain_spec.rb
326
- - spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_1.xml
307
+ - spec/unit/action/create_domain_spec/additional_disks_domain.xml
308
+ - spec/unit/action/create_domain_spec/default_domain.xml
309
+ - spec/unit/action/create_domain_volume_spec/one_disk_in_storage.xml
327
310
  - spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_0.xml
311
+ - spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_1.xml
328
312
  - spec/unit/action/create_domain_volume_spec/three_disks_in_storage_disk_2.xml
329
- - spec/unit/action/create_domain_volume_spec/one_disk_in_storage.xml
330
- - spec/unit/action/start_domain_spec/default_added_tpm_path.xml
331
313
  - spec/unit/action/start_domain_spec/clock_timer_rtc.xml
332
314
  - spec/unit/action/start_domain_spec/default.xml
333
- - spec/unit/action/start_domain_spec/existing.xml
315
+ - spec/unit/action/start_domain_spec/default_added_tpm_path.xml
334
316
  - spec/unit/action/start_domain_spec/default_added_tpm_version.xml
317
+ - spec/unit/action/start_domain_spec/existing.xml
318
+ - spec/unit/action/clean_machine_folder_spec.rb
319
+ - spec/unit/action/forward_ports_spec.rb
320
+ - spec/unit/action/set_name_of_domain_spec.rb
321
+ - spec/unit/action/wait_till_up_spec.rb
322
+ - spec/unit/action/create_domain_volume_spec.rb
323
+ - spec/unit/action/start_domain_spec.rb
324
+ - spec/unit/action/destroy_domain_spec.rb
325
+ - spec/unit/action/halt_domain_spec.rb
326
+ - spec/unit/action/create_domain_spec.rb
327
+ - spec/unit/action/package_domain_spec.rb
328
+ - spec/unit/action/shutdown_domain_spec.rb
335
329
  - spec/unit/action/handle_box_image_spec.rb
336
- - spec/unit/config_spec.rb
330
+ - spec/unit/templates/tpm/version_1.2.xml
331
+ - spec/unit/templates/tpm/version_2.0.xml
332
+ - spec/unit/templates/domain_custom_cpu_model.xml
333
+ - spec/unit/templates/domain_defaults.xml
334
+ - spec/unit/templates/domain_spec.rb
335
+ - spec/unit/templates/domain_all_settings.xml
337
336
  - spec/unit/util/byte_number_spec.rb
337
+ - spec/unit/provider_spec.rb
338
+ - spec/unit/config_spec.rb
338
339
  - spec/unit/driver_spec.rb
340
+ - spec/unit/action_spec.rb
339
341
  - spec/spec_helper.rb