SHA256
1
0
forked from pool/vagrant

Accepting request 833750 from home:dancermak:branches:Virtualization:vagrant

switch back to %transfiletrigger & fix addressable have choice & add fix for boxes without a /etc/fstab

OBS-URL: https://build.opensuse.org/request/show/833750
OBS-URL: https://build.opensuse.org/package/show/Virtualization:vagrant/vagrant?expand=0&rev=47
This commit is contained in:
Dan Čermák 2020-09-14 07:18:42 +00:00 committed by Git OBS Bridge
parent 04a9733cbb
commit d876f6f01d
12 changed files with 138 additions and 13 deletions

View File

@ -1,7 +1,7 @@
From 0f5435df3ef882c3da9f098ec83cac1f394a7b4e Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Sat, 11 Oct 2014 16:54:58 -0300
Subject: [PATCH 1/9] bin/vagrant: silence warning about installer
Subject: [PATCH 01/10] bin/vagrant: silence warning about installer
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
---

View File

@ -1,7 +1,7 @@
From 103a3765b331a69b615e47d0e1647e4e42fe9a6a Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terceiro@debian.org>
Date: Wed, 22 Oct 2014 09:40:14 -0200
Subject: [PATCH 2/9] Use a private temporary dir
Subject: [PATCH 02/10] Use a private temporary dir
Without this vagrant will clutter $TMPDIR with dozens of even hundreds
of temporary files (~4 per vagrant invocation).

View File

@ -1,7 +1,7 @@
From 4b3743997f569f268047917a41562831eb09bd1e Mon Sep 17 00:00:00 2001
From: Johannes Kastl <kastl@b1-systems.de>
Date: Wed, 17 May 2017 09:09:57 +0200
Subject: [PATCH 3/9] plugins-don-t-abuse-require_relative.patch
Subject: [PATCH 03/10] plugins-don-t-abuse-require_relative.patch
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
---

View File

@ -1,7 +1,7 @@
From d08f0985884ab4ef45ce9f8f37de1c033283eb2f Mon Sep 17 00:00:00 2001
From: Johannes Kastl <kastl@b1-systems.de>
Date: Fri, 16 Nov 2018 21:12:43 +0100
Subject: [PATCH 4/9] fix vbox package boo#1044087, added by
Subject: [PATCH 04/10] fix vbox package boo#1044087, added by
robert.munteanu@gmail.com on Sun Aug 13 19:07:06 UTC 2017
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>

View File

@ -1,7 +1,7 @@
From 5dc228c3811d429e1d9640bbf4a7a21030b388de Mon Sep 17 00:00:00 2001
From: Johannes Kastl <kastl@b1-systems.de>
Date: Mon, 4 Jun 2018 09:18:23 +0200
Subject: [PATCH 5/9] do not depend on wdm
Subject: [PATCH 05/10] do not depend on wdm
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
---

View File

@ -1,7 +1,7 @@
From ac94bb00341797429f61f6b63377523216217d7e Mon Sep 17 00:00:00 2001
From: Johannes Kastl <kastl@b1-systems.de>
Date: Fri, 16 Nov 2018 21:14:46 +0100
Subject: [PATCH 6/9] do not abuse relative paths in docker plugin to make
Subject: [PATCH 06/10] do not abuse relative paths in docker plugin to make
docker work, added by tmkn@tmkn.uk on Thu Oct 26 19:42:46 UTC 2017
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>

View File

@ -1,7 +1,7 @@
From e5f0f5ee48d7975cf0073a3998a8a11d9e97d797 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Fri, 11 Jan 2019 12:32:28 +0100
Subject: [PATCH 7/9] Don't abuse relative paths in plugins
Subject: [PATCH 07/10] Don't abuse relative paths in plugins
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

View File

@ -1,7 +1,7 @@
From 4ae304867d0e714254cd4130a9a56eb1560da354 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 1 Apr 2019 17:28:31 +0200
Subject: [PATCH 8/9] Skip failing tests
Subject: [PATCH 08/10] Skip failing tests
---
test/unit/bin/vagrant_test.rb | 4 ++--

View File

@ -1,7 +1,7 @@
From 5dc6903fbc40884c5811a71ad43700f7357f7836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Wed, 28 Aug 2019 13:39:58 +0200
Subject: [PATCH 9/9] Disable Subprocess unit test
Subject: [PATCH 09/10] Disable Subprocess unit test
This unit test is *very* flaky on OBS' workers and causes random build
failures. These are probably caused by worker being under high load and then

View File

@ -0,0 +1,82 @@
From 75d617e2fe8d626cf23ac77f1c47cf0be4a1938b Mon Sep 17 00:00:00 2001
From: sophia <scastellarin95@gmail.com>
Date: Thu, 10 Sep 2020 09:50:13 -0500
Subject: [PATCH 10/10] Add check for /etc/fstab
(cherry picked from commit 2297b86790227b6b89a6de6a7a786a726cf56a62)
---
.../guests/linux/cap/persist_mount_shared_folder.rb | 12 ++++++++++++
.../linux/cap/persist_mount_shared_folder_test.rb | 13 +++++++++++++
2 files changed, 25 insertions(+)
diff --git a/plugins/guests/linux/cap/persist_mount_shared_folder.rb b/plugins/guests/linux/cap/persist_mount_shared_folder.rb
index 338d62e07..e0ad08d42 100644
--- a/plugins/guests/linux/cap/persist_mount_shared_folder.rb
+++ b/plugins/guests/linux/cap/persist_mount_shared_folder.rb
@@ -8,6 +8,8 @@ module VagrantPlugins
class PersistMountSharedFolder
extend SyncedFolder::UnixMountHelpers
+ @@logger = Log4r::Logger.new("vagrant::guest::linux::persist_mount_shared_folders")
+
# Inserts fstab entry for a set of synced folders. Will fully replace
# the currently managed group of Vagrant managed entries. Note, passing
# empty list of folders will just remove entries
@@ -15,7 +17,13 @@ module VagrantPlugins
# @param [Machine] machine The machine to run the action on
# @param [Map<String, Map>] A map of folders to add to fstab
def self.persist_mount_shared_folder(machine, folders)
+ unless fstab_exists?(machine)
+ @@logger.info("no fstab file found, not modifying /etc/fstab")
+ return
+ end
+
if folders.nil?
+ @@logger.info("clearing /etc/fstab")
self.remove_vagrant_managed_fstab(machine)
return
end
@@ -53,6 +61,10 @@ module VagrantPlugins
private
+ def self.fstab_exists?(machine)
+ machine.communicate.test("stat /etc/fstab")
+ end
+
def self.remove_vagrant_managed_fstab(machine)
machine.communicate.sudo("sed -i '/\#VAGRANT-BEGIN/,/\#VAGRANT-END/d' /etc/fstab")
end
diff --git a/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb b/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb
index aa65b38b7..31f7ae764 100644
--- a/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb
+++ b/test/unit/plugins/guests/linux/cap/persist_mount_shared_folder_test.rb
@@ -37,6 +37,7 @@ describe "VagrantPlugins::GuestLinux::Cap::PersistMountSharedFolder" do
allow(folder_plugin).to receive(:capability).with(:mount_options, any_args).
and_return(["uid=#{options_uid},gid=#{options_gid}", options_uid, options_gid])
allow(folder_plugin).to receive(:capability).with(:mount_type).and_return("vboxsf")
+ allow(cap).to receive(:fstab_exists?).and_return(true)
end
after do
@@ -78,5 +79,17 @@ describe "VagrantPlugins::GuestLinux::Cap::PersistMountSharedFolder" do
cap.persist_mount_shared_folder(machine, folders)
end
end
+
+ context "fstab does not exist" do
+ before do
+ allow(cap).to receive(:fstab_exists?).and_return(false)
+ end
+
+ it "does not modify /etc/fstab" do
+ expect(cap).not_to receive(:remove_vagrant_managed_fstab)
+ expect(comm).not_to receive(:sudo).with(/echo '' >> \/etc\/fstab/)
+ cap.persist_mount_shared_folder(machine, folders)
+ end
+ end
end
end
--
2.28.0

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Wed Sep 9 12:47:45 UTC 2020 - Dan Čermák <dcermak@suse.com>
- Switch back to using transfiletriggerin/un
- Increase required version of the addressable gem
- Allow to skip tests during development via bcond_without
- Add fix for boxes that don't have a /etc/fstab
Added patch:
* 0010-Add-check-for-etc-fstab.patch
rebased patches:
* 0001-bin-vagrant-silence-warning-about-installer.patch
* 0002-Use-a-private-temporary-dir.patch
* 0003-plugins-don-t-abuse-require_relative.patch.patch
* 0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch
* 0005-do-not-depend-on-wdm.patch
* 0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch
* 0007-Don-t-abuse-relative-paths-in-plugins.patch
* 0008-Skip-failing-tests.patch
* 0009-Disable-Subprocess-unit-test.patch
-------------------------------------------------------------------
Wed Aug 26 15:01:59 UTC 2020 - Dan Čermák <dcermak@suse.com>
@ -6,6 +26,21 @@ Wed Aug 26 15:01:59 UTC 2020 - Dan Čermák <dcermak@suse.com>
* add rsync to BuildRequires
* run fdupes after installation
Remove patches (merged upstream):
* 0010-Bump-version-of-net-ssh-to-6.0-and-net-sftp-to-3.0.patch
* 0011-Fixes-11606-Mock-out-guest-capabilities-instead-of-r.patch
Rebased patches:
* 0001-bin-vagrant-silence-warning-about-installer.patch
* 0002-Use-a-private-temporary-dir.patch
* 0003-plugins-don-t-abuse-require_relative.patch.patch
* 0004-fix-vbox-package-boo-1044087-added-by-robert.muntean.patch
* 0005-do-not-depend-on-wdm.patch
* 0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch
* 0007-Don-t-abuse-relative-paths-in-plugins.patch
* 0008-Skip-failing-tests.patch
* 0009-Disable-Subprocess-unit-test.patch
FEATURES:
- hyperv/disks: Add ability to manage virtual disks for guests [GH-11541]

View File

@ -17,6 +17,8 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# disable tests if you want to just run a quick build
%{bcond_without tests}
%global mod_name vagrant
%global mod_full_name %{mod_name}-%{version}
@ -55,6 +57,7 @@ Patch6: 0006-do-not-abuse-relative-paths-in-docker-plugin-to-make.patch
Patch7: 0007-Don-t-abuse-relative-paths-in-plugins.patch
Patch8: 0008-Skip-failing-tests.patch
Patch9: 0009-Disable-Subprocess-unit-test.patch
Patch10: 0010-Add-check-for-etc-fstab.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -151,7 +154,7 @@ BuildRequires: %{rubygem ffi >= 1.9 }
# Prevent have choice for rubygem(ruby:2.5.0:thor:0) >= 0.18
BuildRequires: %{rubygem thor:0.19}
# Prevent have choice for rubygem(ruby:2.5.0:addressable) >= 2.3.6
BuildRequires: %{rubygem addressable >= 2.6}
BuildRequires: %{rubygem addressable >= 2.7}
# Prevent have choice for rubygem(ruby:2.5.0:public_suffix) >= 2.0.2
BuildRequires: %{rubygem public_suffix:4}
@ -161,11 +164,13 @@ BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
# for the test
%if %{with tests}
BuildRequires: openssh
BuildRequires: curl
BuildRequires: bsdtar
BuildRequires: %{rubygem vagrant-spec}
BuildRequires: rsync
%endif
BuildRequires: fdupes
@ -378,12 +383,16 @@ rm -f %{buildroot}%{vagrant_dir}/.runner.sh
%fdupes %{buildroot}%{dirname:%vagrant_plugin_dir}
%check
%if %{with tests}
# remove the git reference to vagrant-spec
# -> don't have to cleanup, the Gemfile is excluded anyway
sed -i "s|gem 'vagrant-spec', git.*$|gem 'vagrant-spec'|" Gemfile
export GEM_PATH=%{buildroot}%{vagrant_plugin_dir}:$(ruby.%{rb_ruby_suffix} -e "print Gem.path.reject{|path| path.include? 'home'}.join(':')")
bundle exec rake test:unit
%endif
# with tests
%pre
getent group vagrant >/dev/null || groupadd -r vagrant
@ -391,11 +400,10 @@ getent group vagrant >/dev/null || groupadd -r vagrant
%post
%{post_rb}
#FIXME: use %%transfiletriggerin/-un once boo#1041742 gets resolved
%filetriggerin -- %{dirname:%{vagrant_plugin_spec}}/
%transfiletriggerin -- %{dirname:%{vagrant_plugin_spec}}/
%{transfiletriggerin_rb}
%filetriggerun -- %{dirname:%{vagrant_plugin_spec}}/
%transfiletriggerun -- %{dirname:%{vagrant_plugin_spec}}/
%{transfiletriggerun_rb}
%files