Ensure box version default of 0 uses mtime (#1512)

If a box is added directly without a version, vagrant will default set
it to 0. When this occurs it is necessary to ensure use of mtime to
distinguish when the disk image in the box was last updated to allow
replacement of the box to trigger a fresh upload.

Fixes: #1382
This commit is contained in:
Darragh Bailey
2022-06-13 10:25:43 +01:00
committed by GitHub
parent 26e25c0191
commit 66e0fa7dda
2 changed files with 18 additions and 1 deletions

View File

@@ -134,7 +134,7 @@ module VagrantPlugins
''
end
if version.empty?
if version.empty? || version == '0'
ui.warn(I18n.t('vagrant_libvirt.box_version_missing', name: box.name.to_s))
version = "0_#{File.mtime(path).to_i}"