Compare commits

..

2 commits

Author SHA1 Message Date
Pavel Valena
a2139f839b Update restart logic in redhat change_host_name cap
https://github.com/hashicorp/vagrant/pull/10223
2018-10-29 16:09:16 +01:00
Pavel Valena
c9f394fb1c Fix the change in packaging for nfs in Fedora.
Forwardport https://src.fedoraproject.org/rpms/vagrant/pull-request/11
Resolves: rhbz#1620074
2018-09-19 12:23:44 +02:00
19 changed files with 802 additions and 809 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
/v*.tar.gz
/vagrant-*.tar.gz
/vagrant-spec-*.tar.gz

View file

@ -51,9 +51,6 @@ if [ -z ${VAGRANT_PREFERRED_PROVIDERS+empty} ]; then
fi
export VAGRANT_PREFERRED_PROVIDERS
# Disable Vagrant's built-in version check.
export VAGRANT_CHECKPOINT_DISABLE=yes
# Call the actual Vagrant bin with our arguments
exec ruby "${VAGRANT_EXECUTABLE}" "$@"

View file

@ -18,17 +18,13 @@
%vagrant_plugin_conf_link %{vagrant_embedded_dir}/plugins.json
%vagrant_plugin_conf %{vagrant_plugin_conf_dir}/plugins.json
# %vagrant_plugin_install - Install vagrant_plugin into appropriate directory.
#
# Usage: %vagrant_plugin_install [options]
#
# -n <gem_file> Overrides gem file name for installation.
# -d <install_dir> Set installation directory.
#
# Install gem into appropriate directory.
# -n<vagrant_plugin_file> Overrides gem file name for installation.
# -d<install_dir> Set installation directory.
%vagrant_plugin_install(d:n:) \
mkdir -p %{-d*}%{!?-d:.%{vagrant_plugin_dir}} \
\
CONFIGURE_ARGS="--with-cflags='%{optflags}' --with-cxxflags='%{optflags}' $CONFIGURE_ARGS" \\\
CONFIGURE_ARGS="--with-cflags='%{optflags}' $CONFIGURE_ARGS" \\\
gem install \\\
-V \\\
--local \\\

View file

@ -1,2 +1,2 @@
SHA512 (v2.3.4.tar.gz) = 0d47e57c3c190743b4d0484ba1e48e3aad73ced3b356f0a4e54b66649eab2bd5d3fc57a06c62b4cc7d6c8e4617ef18a283c03d01553cc575c0884e464a27b501
SHA512 (vagrant-spec-a88825f4cb254b703d0f9235667223f02ad5c600.tar.gz) = 50e4e2c9e69ccb0309876d204d8d66f606188e1d11853071a74819fe75126ed65fa3d02a31bdf2f8e29679a81d12fa2daed806eba034532c8150fe53d749fb84
SHA512 (vagrant-2.1.2.tar.gz) = d9a2612697842885d23d1a9a452ef9d8b03defa4e6f7a808725ac7c3a87300affcfdd89ee3a42334259601e19f1e56bfd86a5aa7b404eac26bc22dcfd4a57751
SHA512 (vagrant-spec-9413ab298407114528766efefd1fb1ff24589636.tar.gz) = 4dc502e75bb8795953c8c338892346431bbd3120239fa7a25175becf148c999293c264a6bb24c52c2821071303e2b20a8353b197370d595cf2e6bc00569cb631

View file

@ -0,0 +1,32 @@
From a102bc064f2b0d97cc6e67bb4f5e4a1bd951e311 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Wed, 31 Jan 2018 19:08:35 +0100
Subject: [PATCH] Use 127.0.0.1 instead of localhost
in test is_port_open_test.rb
---
test/unit/vagrant/util/is_port_open_test.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/unit/vagrant/util/is_port_open_test.rb b/test/unit/vagrant/util/is_port_open_test.rb
index 71ee1db3b7..ea70425755 100644
--- a/test/unit/vagrant/util/is_port_open_test.rb
+++ b/test/unit/vagrant/util/is_port_open_test.rb
@@ -36,7 +36,7 @@
end
# Verify that we report the port is open
- expect(klass.is_port_open?("localhost", open_port)).to be
+ expect(klass.is_port_open?("127.0.0.1", open_port)).to be
# Kill the thread
thr[:die] = true
@@ -47,7 +47,7 @@
# This CAN fail, since port 52811 might actually be in use, but I'm
# not sure what to do except choose some random port and hope for the
# best, really.
- expect(klass.is_port_open?("localhost", closed_port)).not_to be
+ expect(klass.is_port_open?("127.0.0.1", closed_port)).not_to be
end
end

View file

@ -0,0 +1,65 @@
From 7486aa2ce950f55a4be9049d514c412d7e45ddef Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Thu, 20 Jul 2017 15:01:06 +0200
Subject: [PATCH] Fix dependencies for Vagrant 2.0.4.
---
vagrant.gemspec | 25 ++++++++++++++++-------------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/vagrant.gemspec b/vagrant.gemspec
index c92ca17..aeee52f 100644
--- a/vagrant.gemspec
+++ b/vagrant.gemspec
@@ -12,35 +12,38 @@ Gem::Specification.new do |s|
s.summary = "Build and distribute virtualized development environments."
s.description = "Vagrant is a tool for building and distributing virtualized development environments."
- s.required_ruby_version = "~> 2.2", "< 2.6"
+ s.required_ruby_version = "~> 2.2"
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "vagrant"
- s.add_dependency "childprocess", "~> 0.6.0"
+ s.add_dependency "childprocess", "~> 0.5.0"
s.add_dependency "erubis", "~> 2.7.0"
- s.add_dependency "i18n", ">= 0.6.0", "<= 0.8.0"
+ s.add_dependency "i18n", ">= 0.6.0"
s.add_dependency "listen", "~> 3.1.5"
s.add_dependency "hashicorp-checkpoint", "~> 0.1.5"
s.add_dependency "log4r", "~> 1.1.9", "< 1.1.11"
s.add_dependency "net-ssh", "~> 4.2.0"
s.add_dependency "net-sftp", "~> 2.1"
- s.add_dependency "net-scp", "~> 1.2.0"
- s.add_dependency "rb-kqueue", "~> 0.2.0"
+ s.add_dependency "net-scp", ">= 1.2.0"
+ # Remove Windows specific dependency.
+ # s.add_dependency "rb-kqueue", "~> 0.2.0"
s.add_dependency "rest-client", ">= 1.6.0", "< 3.0"
- s.add_dependency "wdm", "~> 0.1.0"
- s.add_dependency "winrm", "~> 2.1"
- s.add_dependency "winrm-fs", "~> 1.0"
- s.add_dependency "winrm-elevated", "~> 1.1"
+ # s.add_dependency "wdm", "~> 0.1.0"
+ # s.add_dependency "winrm", "~> 2.1"
+ # s.add_dependency "winrm-fs", "~> 1.0"
+ # s.add_dependency "winrm-elevated", "~> 1.1"
# NOTE: The ruby_dep gem is an implicit dependency from the listen gem. Later versions
# of the ruby_dep gem impose an aggressive constraint on the required ruby version (>= 2.2.5).
# Explicit constraint is defined to provide required dependency to listen without imposing
# tighter restrictions on valid ruby versions
- s.add_dependency "ruby_dep", "<= 1.3.1"
+ #
+ # Do not impose any Ruby version restrictions on Fedora.
+ # s.add_dependency "ruby_dep", "<= 1.3.1"
# Constraint rake to properly handle deprecated method usage
# from within rspec
- s.add_development_dependency "rake", "~> 12.0.0"
+ s.add_development_dependency "rake", "~> 12.2.0"
s.add_development_dependency "rspec", "~> 3.5.0"
s.add_development_dependency "rspec-its", "~> 1.2.0"
s.add_development_dependency "webmock", "~> 2.3.1"
--
2.13.6

View file

@ -0,0 +1,42 @@
From f0b9d025e481eaf03db9a92ed51f3fe07541fa76 Mon Sep 17 00:00:00 2001
From: langdon <langdon@fedoraproject.org>
Date: Thu, 14 Jun 2018 15:48:13 -0400
Subject: [PATCH] Fixes the change in packaging for nfs in f28 (#9878).
However, removed part of the unit test which will be very difficult to fix (I
expect). The unit test is still doing a good test that nfs and rpcbind work
though. If you go far enough back, you need to bury the error out too.
---
plugins/guests/redhat/cap/nfs_client.rb | 6 +++++-
test/unit/plugins/guests/redhat/cap/nfs_client_test.rb | 1 -
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/plugins/guests/redhat/cap/nfs_client.rb b/plugins/guests/redhat/cap/nfs_client.rb
index b1eb4c6e4b..f28a043464 100644
--- a/plugins/guests/redhat/cap/nfs_client.rb
+++ b/plugins/guests/redhat/cap/nfs_client.rb
@@ -5,7 +5,11 @@ class NFSClient
def self.nfs_client_install(machine)
machine.communicate.sudo <<-EOH.gsub(/^ {12}/, '')
if command -v dnf; then
- dnf -y install nfs-utils nfs-utils-lib portmap
+ if `dnf info -q libnfs-utils > /dev/null 2>&1` ; then
+ dnf -y install nfs-utils libnfs-utils portmap
+ else
+ dnf -y install nfs-utils nfs-utils-lib portmap
+ fi
else
yum -y install nfs-utils nfs-utils-lib portmap
fi
diff --git a/test/unit/plugins/guests/redhat/cap/nfs_client_test.rb b/test/unit/plugins/guests/redhat/cap/nfs_client_test.rb
index a86136e19a..38a9efa69e 100644
--- a/test/unit/plugins/guests/redhat/cap/nfs_client_test.rb
+++ b/test/unit/plugins/guests/redhat/cap/nfs_client_test.rb
@@ -23,7 +23,6 @@
it "installs rsync" do
cap.nfs_client_install(machine)
- expect(comm.received_commands[0]).to match(/install nfs-utils nfs-utils-lib portmap/)
expect(comm.received_commands[0]).to match(/\/bin\/systemctl restart rpcbind nfs/)
end
end

View file

@ -0,0 +1,594 @@
From 80006251f422a8d534ff9bafa0e0c45d9c98143c Mon Sep 17 00:00:00 2001
From: Joe Doss <jdoss@kennasecurity.com>
Date: Mon, 17 Sep 2018 13:30:55 -0500
Subject: [PATCH 01/10] Add in logic to restart NetworkManager if it is
enabled.
---
plugins/guests/redhat/cap/change_host_name.rb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index 55fcdc4b48..8f32650035 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -29,7 +29,13 @@ def self.change_host_name(machine, name)
}
# Restart network
- service network restart
+ if (test -f /etc/init.d/network && /etc/init.d/network status &> /dev/null ); then
+ service network restart
+ elif (test -f /usr/lib/systemd/system/NetworkManager.service && systemctl is-enabled NetworkManager.service &> /dev/null ); then
+ systemctl restart NetworkManager.service
+ else
+ printf "Could not restart the network to set the new hostname!\n"
+ fi
EOH
end
end
From 94954739b53ee4c6741a35c366c2fe5c9853e0ed Mon Sep 17 00:00:00 2001
From: Joe Doss <jdoss@kennasecurity.com>
Date: Mon, 17 Sep 2018 14:30:57 -0500
Subject: [PATCH 02/10] Simplified if statements.
---
plugins/guests/redhat/cap/change_host_name.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index 8f32650035..e9c0b1d80e 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -29,9 +29,9 @@ def self.change_host_name(machine, name)
}
# Restart network
- if (test -f /etc/init.d/network && /etc/init.d/network status &> /dev/null ); then
+ if test -f /etc/init.d/network; then
service network restart
- elif (test -f /usr/lib/systemd/system/NetworkManager.service && systemctl is-enabled NetworkManager.service &> /dev/null ); then
+ elif systemctl -q is-enabled NetworkManager.service; then
systemctl restart NetworkManager.service
else
printf "Could not restart the network to set the new hostname!\n"
From c14a4a09f723230682c5ef5f9dc53662e2968b92 Mon Sep 17 00:00:00 2001
From: Joe Doss <jdoss@kennasecurity.com>
Date: Mon, 17 Sep 2018 14:56:06 -0500
Subject: [PATCH 03/10] Switch if statements, check for systemctl, and switch
to is-active.
---
plugins/guests/redhat/cap/change_host_name.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index e9c0b1d80e..70bd496943 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -29,10 +29,10 @@ def self.change_host_name(machine, name)
}
# Restart network
- if test -f /etc/init.d/network; then
- service network restart
- elif systemctl -q is-enabled NetworkManager.service; then
+ if (test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service); then
systemctl restart NetworkManager.service
+ elif test -f /etc/init.d/network; then
+ service network restart
else
printf "Could not restart the network to set the new hostname!\n"
fi
From 19aa9578c797c99a8632955a703490d5e6b50a26 Mon Sep 17 00:00:00 2001
From: Joe Doss <jdoss@kennasecurity.com>
Date: Tue, 18 Sep 2018 13:15:26 -0500
Subject: [PATCH 04/10] Exit 1 if we cannot set the hostname.
---
plugins/guests/redhat/cap/change_host_name.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index 70bd496943..ae02460156 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -35,6 +35,7 @@ def self.change_host_name(machine, name)
service network restart
else
printf "Could not restart the network to set the new hostname!\n"
+ exit 1
fi
EOH
end
From 86ab4533b180009ed476026374110fc0bd79f522 Mon Sep 17 00:00:00 2001
From: Joe Doss <jdoss@kennasecurity.com>
Date: Tue, 18 Sep 2018 13:16:12 -0500
Subject: [PATCH 05/10] Fix the test to check for systemctl restart
NetworkManager.service too.
---
test/unit/plugins/guests/redhat/cap/change_host_name_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
index 7662935458..10f43a3593 100644
--- a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
+++ b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
@@ -31,7 +31,7 @@
expect(comm.received_commands[1]).to match(/\/etc\/sysconfig\/network-scripts\/ifcfg/)
expect(comm.received_commands[1]).to match(/hostnamectl set-hostname --static '#{name}'/)
expect(comm.received_commands[1]).to match(/hostnamectl set-hostname --transient '#{name}'/)
- expect(comm.received_commands[1]).to match(/service network restart/)
+ expect(comm.received_commands[1]).to match(/service network restart|systemctl restart NetworkManager.service/)
end
it "does not change the hostname if already set" do
From a12b09b098ea87eec815e166d0e1395f6f47f937 Mon Sep 17 00:00:00 2001
From: shotop <samuel.j.hotop@gmail.com>
Date: Thu, 20 Sep 2018 14:21:40 -0500
Subject: [PATCH 06/10] add specs around network restart logic
---
.../redhat/cap/change_host_name_test.rb | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
index 10f43a3593..b85802e947 100644
--- a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
+++ b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
@@ -39,5 +39,32 @@
cap.change_host_name(machine, name)
expect(comm.received_commands.size).to eq(1)
end
+
+ context "restarts the network" do
+ it "uses systemctl and NetworkManager.service" do
+ comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
+ comm.stub_command("test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service", exit_code: 0)
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[1]).to match(/systemctl restart NetworkManager.service/)
+ end
+
+ it "uses the service command" do
+ comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
+ comm.stub_command("test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service", exit_code: 1)
+ comm.stub_command("test -f /etc/init.d/network", exit_code: 0)
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[1]).to match(/service network restart/)
+ end
+ end
+
+ context "cannot restart the network" do
+ it "prints cannot restart message" do
+ comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
+ comm.stub_command("test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service", exit_code: 1)
+ comm.stub_command("test -f /etc/init.d/network", exit_code: 1)
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[1]).to match(/printf "Could not restart the network to set the new hostname!/)
+ end
+ end
end
end
From fb5fc0e657a10ee1eaf046980827cc1802c4d0f9 Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Thu, 20 Sep 2018 16:42:39 -0700
Subject: [PATCH 07/10] Update guest inspection utility module
Use sudo option for communicator test command instead of inline sudo
to properly use configured sudo value. Use command for checking
availability of hostnamectl. Use is-active for determining if a
service is being actively managed by systemd.
---
lib/vagrant/util/guest_inspection.rb | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/vagrant/util/guest_inspection.rb b/lib/vagrant/util/guest_inspection.rb
index 86ab1dc69e..5a1902d8da 100644
--- a/lib/vagrant/util/guest_inspection.rb
+++ b/lib/vagrant/util/guest_inspection.rb
@@ -17,22 +17,34 @@ module Linux
# systemd-networkd.service is in use
#
+ # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @return [Boolean]
def systemd_networkd?(comm)
- comm.test("sudo systemctl status systemd-networkd.service")
+ comm.test("systemctl -q is-active systemd-networkd.service", sudo: true)
+ end
+
+ # Check if given service is controlled by systemd
+ #
+ # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
+ # @param [String] service_name Name of the service to check
+ # @return [Boolean]
+ def systemd_controlled?(comm, service_name)
+ comm.test("systemctl -q is-active #{service_name}", sudo: true)
end
# systemd hostname set is via hostnamectl
#
+ # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @return [Boolean]
def hostnamectl?(comm)
- comm.test("hostnamectl")
+ comm.test("command -v hostnamectl")
end
## netplan helpers
# netplan is installed
#
+ # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @return [Boolean]
def netplan?(comm)
comm.test("netplan -h")
@@ -42,6 +54,7 @@ def netplan?(comm)
# nmcli is installed
#
+ # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @return [Boolean]
def nmcli?(comm)
comm.test("nmcli")
@@ -49,7 +62,7 @@ def nmcli?(comm)
# NetworkManager currently controls device
#
- # @param comm [Communicator]
+ # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @param device_name [String]
# @return [Boolean]
def nm_controlled?(comm, device_name)
From ff021fcab404c95e52566bfca4207da9c0101e01 Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Thu, 20 Sep 2018 16:44:08 -0700
Subject: [PATCH 08/10] Update redhat change host name capability to support
systemd
Update capability to use guest inspection module for determining
correct actions to execute. When systemd is in use restart the
correct active service, either NetworkManager or networkd. Default
to using the original service restart when systemd service is not
found.
---
plugins/guests/redhat/cap/change_host_name.rb | 41 ++++++++++---------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index ae02460156..5da660df05 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -2,6 +2,9 @@ module VagrantPlugins
module GuestRedHat
module Cap
class ChangeHostName
+
+ extend Vagrant::Util::GuestInspection
+
def self.change_host_name(machine, name)
comm = machine.communicate
@@ -10,34 +13,32 @@ def self.change_host_name(machine, name)
comm.sudo <<-EOH.gsub(/^ {14}/, '')
# Update sysconfig
sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
-
# Update DNS
sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/' /etc/sysconfig/network-scripts/ifcfg-*
-
# Set the hostname - use hostnamectl if available
echo '#{name}' > /etc/hostname
- if command -v hostnamectl; then
- hostnamectl set-hostname --static '#{name}'
- hostnamectl set-hostname --transient '#{name}'
- else
- hostname -F /etc/hostname
- fi
-
- # Prepend ourselves to /etc/hosts
grep -w '#{name}' /etc/hosts || {
sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
}
-
- # Restart network
- if (test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service); then
- systemctl restart NetworkManager.service
- elif test -f /etc/init.d/network; then
- service network restart
- else
- printf "Could not restart the network to set the new hostname!\n"
- exit 1
- fi
EOH
+
+ if hostnamectl?(comm)
+ comm.sudo("hostnamectl set-hostname --static '#{name}' ; " \
+ "hostnamectl set-hostname --transient '#{name}'")
+ else
+ comm.sudo("hostname -F /etc/hostname")
+ end
+
+ restart_command = "service network restart"
+
+ if systemd?
+ if systemd_networkd?(comm)
+ restart_command = "systemctl restart systemd-networkd.service"
+ elsif systemd_controlled?(comm, "NetworkManager.service")
+ restart_command = "systemctl restart NetworkManager.service"
+ end
+ end
+ comm.sudo(restart_command)
end
end
end
From bc217d5e577457df5ac4ecdfffa17fd0a8c85b18 Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Thu, 20 Sep 2018 16:46:45 -0700
Subject: [PATCH 09/10] Update redhat change host name capability tests for
systemd/NetworkManger updates
---
.../redhat/cap/change_host_name_test.rb | 95 +++++++++++++------
1 file changed, 68 insertions(+), 27 deletions(-)
diff --git a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
index b85802e947..8d0c9ebd4b 100644
--- a/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
+++ b/test/unit/plugins/guests/redhat/cap/change_host_name_test.rb
@@ -20,50 +20,91 @@
describe ".change_host_name" do
let(:cap) { caps.get(:change_host_name) }
-
let(:name) { "banana-rama.example.com" }
+ let(:hostname_changed) { true }
+ let(:systemd) { true }
+ let(:hostnamectl) { true }
+ let(:networkd) { true }
+ let(:network_manager) { false }
- it "sets the hostname" do
- comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
+ before do
+ comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: hostname_changed ? 1 : 0)
+ allow(cap).to receive(:systemd?).and_return(systemd)
+ allow(cap).to receive(:hostnamectl?).and_return(hostnamectl)
+ allow(cap).to receive(:systemd_networkd?).and_return(networkd)
+ allow(cap).to receive(:systemd_controlled?).with(anything, /NetworkManager/).and_return(network_manager)
+ end
+ it "sets the hostname" do
cap.change_host_name(machine, name)
expect(comm.received_commands[1]).to match(/\/etc\/sysconfig\/network/)
expect(comm.received_commands[1]).to match(/\/etc\/sysconfig\/network-scripts\/ifcfg/)
- expect(comm.received_commands[1]).to match(/hostnamectl set-hostname --static '#{name}'/)
- expect(comm.received_commands[1]).to match(/hostnamectl set-hostname --transient '#{name}'/)
- expect(comm.received_commands[1]).to match(/service network restart|systemctl restart NetworkManager.service/)
end
- it "does not change the hostname if already set" do
- comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 0)
- cap.change_host_name(machine, name)
- expect(comm.received_commands.size).to eq(1)
- end
+ context "when hostnamectl is in use" do
+ let(:hostnamectl) { true }
- context "restarts the network" do
- it "uses systemctl and NetworkManager.service" do
- comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
- comm.stub_command("test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service", exit_code: 0)
+ it "sets hostname with hostnamectl" do
cap.change_host_name(machine, name)
- expect(comm.received_commands[1]).to match(/systemctl restart NetworkManager.service/)
+ expect(comm.received_commands[2]).to match(/hostnamectl/)
end
+ end
+
+ context "when hostnamectl is not in use" do
+ let(:hostnamectl) { false }
- it "uses the service command" do
- comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
- comm.stub_command("test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service", exit_code: 1)
- comm.stub_command("test -f /etc/init.d/network", exit_code: 0)
+ it "sets hostname with hostname command" do
cap.change_host_name(machine, name)
- expect(comm.received_commands[1]).to match(/service network restart/)
+ expect(comm.received_commands[2]).to match(/hostname -F/)
end
end
- context "cannot restart the network" do
- it "prints cannot restart message" do
- comm.stub_command("hostname -f | grep '^#{name}$'", exit_code: 1)
- comm.stub_command("test -f /usr/bin/systemctl && systemctl -q is-active NetworkManager.service", exit_code: 1)
- comm.stub_command("test -f /etc/init.d/network", exit_code: 1)
+ context "when host name is already set" do
+ let(:hostname_changed) { false }
+
+ it "does not change the hostname" do
cap.change_host_name(machine, name)
- expect(comm.received_commands[1]).to match(/printf "Could not restart the network to set the new hostname!/)
+ expect(comm.received_commands.size).to eq(1)
+ end
+ end
+
+ context "restarts the network" do
+ context "when networkd is in use" do
+ let(:networkd) { true }
+
+ it "restarts networkd with systemctl" do
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[3]).to match(/systemctl restart systemd-networkd/)
+ end
+ end
+
+ context "when NetworkManager is in use" do
+ let(:networkd) { false }
+ let(:network_manager) { true }
+
+ it "restarts NetworkManager with systemctl" do
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[3]).to match(/systemctl restart NetworkManager/)
+ end
+ end
+
+ context "when networkd and NetworkManager are not in use" do
+ let(:networkd) { false }
+ let(:network_manager) { false }
+
+ it "restarts the network using service" do
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[3]).to match(/service network restart/)
+ end
+ end
+
+ context "when systemd is not in use" do
+ let(:systemd) { false }
+
+ it "restarts the network using service" do
+ cap.change_host_name(machine, name)
+ expect(comm.received_commands[3]).to match(/service network restart/)
+ end
end
end
end
From 8fd05fe3c1b773777f08ca50dd651cbaf33838d3 Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Fri, 21 Sep 2018 09:19:40 -0700
Subject: [PATCH 10/10] Use `command -v` for checks in all inspection helpers.
Fix stubs in tests.
---
lib/vagrant/util/guest_inspection.rb | 4 ++--
.../guests/debian/cap/configure_networks_test.rb | 14 +++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/vagrant/util/guest_inspection.rb b/lib/vagrant/util/guest_inspection.rb
index 5a1902d8da..cd0a96d3ef 100644
--- a/lib/vagrant/util/guest_inspection.rb
+++ b/lib/vagrant/util/guest_inspection.rb
@@ -47,7 +47,7 @@ def hostnamectl?(comm)
# @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @return [Boolean]
def netplan?(comm)
- comm.test("netplan -h")
+ comm.test("command -v netplan")
end
## nmcli helpers
--- a/lib/vagrant/util/guest_inspection.rb
+++ b/lib/vagrant/util/guest_inspection.rb
@@ -57,7 +57,7 @@ def netplan?(comm)
# @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator
# @return [Boolean]
def nmcli?(comm)
- comm.test("nmcli")
+ comm.test("command -v nmcli")
end
# NetworkManager currently controls device
diff --git a/test/unit/plugins/guests/debian/cap/configure_networks_test.rb b/test/unit/plugins/guests/debian/cap/configure_networks_test.rb
index b4691d0fd4..d3a523c95b 100644
--- a/test/unit/plugins/guests/debian/cap/configure_networks_test.rb
+++ b/test/unit/plugins/guests/debian/cap/configure_networks_test.rb
@@ -67,9 +67,9 @@
before do
allow(comm).to receive(:test).with("nmcli d show eth1").and_return(false)
allow(comm).to receive(:test).with("nmcli d show eth2").and_return(false)
- allow(comm).to receive(:test).with("ps -o comm= 1 | grep systemd").and_return(false)
- allow(comm).to receive(:test).with("sudo systemctl status systemd-networkd.service").and_return(false)
- allow(comm).to receive(:test).with("netplan -h").and_return(false)
+ allow(comm).to receive(:test).with("ps -o comm= 1 | grep systemd").and_return(false)
+ allow(comm).to receive(:test).with("systemctl -q is-active systemd-networkd.service", anything).and_return(false)
+ allow(comm).to receive(:test).with("command -v netplan").and_return(false)
end
it "creates and starts the networks using net-tools" do
@@ -85,8 +85,8 @@
context "with systemd" do
before do
- expect(comm).to receive(:test).with("ps -o comm= 1 | grep systemd").and_return(true)
- allow(comm).to receive(:test).with("netplan -h").and_return(false)
+ expect(comm).to receive(:test).with("ps -o comm= 1 | grep systemd").and_return(true)
+ allow(comm).to receive(:test).with("command -v netplan").and_return(false)
end
it "creates and starts the networks using net-tools" do
@@ -102,7 +102,7 @@
context "with systemd-networkd" do
before do
- expect(comm).to receive(:test).with("sudo systemctl status systemd-networkd.service").and_return(true)
+ expect(comm).to receive(:test).with("systemctl -q is-active systemd-networkd.service", anything).and_return(true)
end
it "creates and starts the networks using systemd-networkd" do
@@ -117,7 +117,7 @@
context "with netplan" do
before do
- expect(comm).to receive(:test).with("netplan -h").and_return(true)
+ expect(comm).to receive(:test).with("command -v netplan").and_return(true)
end
let(:nm_yml) { "---\nnetwork:\n version: 2\n renderer: NetworkManager\n ethernets:\n eth1:\n dhcp4: true\n eth2:\n addresses:\n - 33.33.33.10/16\n gateway4: 33.33.0.1\n" }
From 1797798760eb72d6b02724f75bc54dd83815e986 Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Fri, 28 Sep 2018 07:59:39 -0700
Subject: [PATCH] Fix module name
---
plugins/guests/redhat/cap/change_host_name.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index 5da660df05..37c8912a80 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -3,7 +3,7 @@ module GuestRedHat
module Cap
class ChangeHostName
- extend Vagrant::Util::GuestInspection
+ extend Vagrant::Util::GuestInspection::Linux
def self.change_host_name(machine, name)
comm = machine.communicate
From 11b0d58fa081cd9a27c272244a0d119acc81f32e Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Mon, 1 Oct 2018 08:43:49 -0700
Subject: [PATCH] Include communicator on call
---
plugins/guests/redhat/cap/change_host_name.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb
index 37c8912a80..5ceb63665a 100644
--- a/plugins/guests/redhat/cap/change_host_name.rb
+++ b/plugins/guests/redhat/cap/change_host_name.rb
@@ -31,7 +31,7 @@ def self.change_host_name(machine, name)
restart_command = "service network restart"
- if systemd?
+ if systemd?(comm)
if systemd_networkd?(comm)
restart_command = "systemctl restart systemd-networkd.service"
elsif systemd_controlled?(comm, "NetworkManager.service")

View file

@ -1,38 +0,0 @@
From 2fe4056a7dcf96dd894875b02032a988777e05d4 Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Mon, 14 Nov 2022 10:11:00 -0800
Subject: [PATCH] Fix test using `File.exists?` to use non-deprecated name
---
test/unit/vagrant/util/install_cli_autocomplete_test.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/unit/vagrant/util/install_cli_autocomplete_test.rb b/test/unit/vagrant/util/install_cli_autocomplete_test.rb
index a62c065ddce..330b8b44805 100644
--- a/test/unit/vagrant/util/install_cli_autocomplete_test.rb
+++ b/test/unit/vagrant/util/install_cli_autocomplete_test.rb
@@ -12,7 +12,7 @@
describe "#shell_installed" do
it "should return path to config file if exists" do
- allow(File).to receive(:exists?).with(target_file).and_return(true)
+ allow(File).to receive(:exist?).with(target_file).and_return(true)
expect(subject.shell_installed(home)).to eq(target_file)
end
@@ -36,7 +36,7 @@
describe "#install" do
it "installs autocomplete" do
- allow(File).to receive(:exists?).with(target_file).and_return(true)
+ allow(File).to receive(:exist?).with(target_file).and_return(true)
allow(File).to receive(:foreach).with(target_file).and_yield("nothing")
expect(File).to receive(:open).with(target_file, "a")
subject.install(home)
@@ -67,4 +67,4 @@
expect{ subject.install(["oops"]) }.to raise_error(ArgumentError)
end
end
-end
\ No newline at end of file
+end

View file

@ -1,24 +0,0 @@
From 068df794f81fb7ec410595d85ca9b4841a6034ec Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Thu, 7 May 2020 22:40:54 +0200
Subject: [PATCH] Do not activate gems if gemspec is not found
diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb
index eb2caab..bd9f8a0 100644
--- a/lib/vagrant/bundler.rb
+++ b/lib/vagrant/bundler.rb
@@ -645,12 +645,10 @@ module Vagrant
if !self_spec
@logger.warn("Failed to locate activated vagrant specification. Activating...")
self_spec = Gem::Specification.find { |s| s.name == "vagrant" }
- if !self_spec
- @logger.error("Failed to locate Vagrant RubyGem specification")
- raise Vagrant::Errors::SourceSpecNotFound
- end
+ if self_spec
self_spec.activate
@logger.info("Activated vagrant specification version - #{self_spec.version}")
+ end
end
# discover all the gems we have available
list = {}

View file

@ -1,21 +0,0 @@
From c7ef689d86294bcdb8ae5d31ddabcba416e3382d Mon Sep 17 00:00:00 2001
From: Chris Roberts <croberts@hashicorp.com>
Date: Wed, 28 Sep 2022 13:51:54 -0700
Subject: [PATCH] Prevent trailing space character on user agent
---
lib/vagrant/util/downloader.rb | 2 +-
diff --git a/lib/vagrant/util/downloader.rb b/lib/vagrant/util/downloader.rb
index eee9744e74f..a7daf9684b7 100644
--- a/lib/vagrant/util/downloader.rb
+++ b/lib/vagrant/util/downloader.rb
@@ -21,7 +21,7 @@ class Downloader
# are properly tracked.
#
# Vagrant/1.7.4 (+https://www.vagrantup.com; ruby2.1.0)
- USER_AGENT = "Vagrant/#{VERSION} (+https://www.vagrantup.com; #{RUBY_ENGINE}#{RUBY_VERSION}) #{ENV['VAGRANT_USER_AGENT_PROVISIONAL_STRING']}".freeze
+ USER_AGENT = "Vagrant/#{VERSION} (+https://www.vagrantup.com; #{RUBY_ENGINE}#{RUBY_VERSION}) #{ENV['VAGRANT_USER_AGENT_PROVISIONAL_STRING']}".strip.freeze
# Hosts that do not require notification on redirect
SILENCED_HOSTS = [

View file

@ -1,41 +0,0 @@
From aa62e1be219a129efe09464981bd3ae1f7b31282 Mon Sep 17 00:00:00 2001
From: Jarek Prokop <jprokop@redhat.com>
Date: Tue, 9 May 2023 19:41:28 +0200
Subject: [PATCH] Disable loading of direct_conversions file.
plugins/commands/serve/util/direct_conversions.rb file contains
logic for Protobuf related code. It needs related google/protobuf
dependencies, therefore it is better to remove the file and
prevent loading it until we have google/protobuf components available
in Fedora.
---
plugins/commands/serve/command.rb | 2 +-
plugins/commands/serve/util.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/commands/serve/command.rb b/plugins/commands/serve/command.rb
index 9948f28bd..65d74f5d2 100644
--- a/plugins/commands/serve/command.rb
+++ b/plugins/commands/serve/command.rb
@@ -138,4 +138,4 @@ module VagrantPlugins
end
# Load in our conversions down here so all the autoload stuff is in place
-require Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions.rb").to_s
+#require Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions.rb").to_s
diff --git a/plugins/commands/serve/util.rb b/plugins/commands/serve/util.rb
index a8f963df7..930d023a6 100644
--- a/plugins/commands/serve/util.rb
+++ b/plugins/commands/serve/util.rb
@@ -4,7 +4,7 @@ module VagrantPlugins
autoload :Cacher, Vagrant.source_root.join("plugins/commands/serve/util/cacher").to_s
autoload :ClientSetup, Vagrant.source_root.join("plugins/commands/serve/util/client_setup").to_s
autoload :Connector, Vagrant.source_root.join("plugins/commands/serve/util/connector").to_s
- autoload :DirectConversion, Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions").to_s
+ # autoload :DirectConversion, Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions").to_s
autoload :ExceptionTransformer, Vagrant.source_root.join("plugins/commands/serve/util/exception_transformer").to_s
autoload :FuncSpec, Vagrant.source_root.join("plugins/commands/serve/util/func_spec").to_s
autoload :HasBroker, Vagrant.source_root.join("plugins/commands/serve/util/has_broker").to_s
--
2.40.1

View file

@ -1,23 +0,0 @@
From 7661eba89a5786a1b0826dbb2f45f8827d9a5103 Mon Sep 17 00:00:00 2001
From: sophia <scastellarin95@gmail.com>
Date: Tue, 3 Jan 2023 12:23:37 -0800
Subject: [PATCH] Environment home dir is also not accessible if EROFS error
occurs
---
lib/vagrant/environment.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb
index de99cbf3ba5..8b2531182ca 100644
--- a/lib/vagrant/environment.rb
+++ b/lib/vagrant/environment.rb
@@ -846,7 +846,7 @@ def setup_home_path
begin
@logger.info("Creating: #{dir}")
FileUtils.mkdir_p(dir)
- rescue Errno::EACCES
+ rescue Errno::EACCES, Errno::EROFS
raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s
end
end

View file

@ -1,22 +0,0 @@
From 27440fdd8cebf57882e3672376d409b139cc1e86 Mon Sep 17 00:00:00 2001
From: Jarek Prokop <jprokop@redhat.com>
Date: Thu, 16 Jan 2025 13:36:05 +0100
Subject: [PATCH] Fix the default vagrant URL for pulling boxes.
---
lib/vagrant/shared_helpers.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/vagrant/shared_helpers.rb b/lib/vagrant/shared_helpers.rb
index b07c89a48..3c57cad6d 100644
--- a/lib/vagrant/shared_helpers.rb
+++ b/lib/vagrant/shared_helpers.rb
@@ -10,7 +10,7 @@ module Vagrant
# of Vagrant that may require remote access.
#
# @return [String]
- DEFAULT_SERVER_URL = "https://vagrantcloud.com".freeze
+ DEFAULT_SERVER_URL = "https://vagrantcloud.com/api/v2/vagrant".freeze
# Max number of seconds to wait for joining an active thread.
#

View file

@ -1,39 +0,0 @@
From 9743c857481556838ee417a0033efdee3fb0c7fc Mon Sep 17 00:00:00 2001
From: sophia <scastellarin95@gmail.com>
Date: Tue, 3 Jan 2023 13:20:14 -0800
Subject: [PATCH] Only check for arguments matching test string if the argument
is a string
This issue surfaced in the tests after updating to Ruby 3.2.0 where
the =~ operator has been removed.
ref: https://github.com/ruby/ruby/blob/cca54c8b1b71072bb07850c9d3f20b261d3b312c/NEWS.md?plain=1#L498
---
test/unit/plugins/provisioners/ansible/provisioner_test.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb
index f5828f14340..fdf9aa67eaa 100644
--- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb
+++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb
@@ -91,7 +91,7 @@ def self.it_should_set_arguments_and_environment_variables(
expect(args[1]).to eq("--connection=ssh")
expect(args[2]).to eq("--timeout=30")
- inventory_count = args.count { |x| x =~ /^--inventory-file=.+$/ }
+ inventory_count = args.count { |x| x.match(/^--inventory-file=.+$/) if x.is_a?(String) }
expect(inventory_count).to be > 0
expect(args[args.length-2]).to eq("playbook.yml")
@@ -100,9 +100,9 @@ def self.it_should_set_arguments_and_environment_variables(
it "sets --limit argument" do
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args) { |*args|
- all_limits = args.select { |x| x =~ /^(--limit=|-l)/ }
+ all_limits = args.select { |x| x.match(/^(--limit=|-l)/) if x.is_a?(String) }
if config.raw_arguments
- raw_limits = config.raw_arguments.select { |x| x =~ /^(--limit=|-l)/ }
+ raw_limits = config.raw_arguments.select { |x| x.match(/^(--limit=|-l)/) if x.is_a?(String) }
expect(all_limits.length - raw_limits.length).to eq(1)
expect(all_limits.last).to eq(raw_limits.last)
else

View file

@ -1,70 +0,0 @@
diff '--color=auto' -Naur /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/lib/vagrant.rb /var/lib/mock/vagrant-rebase/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/lib/vagrant.rb
--- /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/lib/vagrant.rb 2023-02-16 13:41:49.267357857 +0100
+++ /var/lib/mock/vagrant-rebase/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/lib/vagrant.rb 2023-03-17 16:47:49.956035219 +0100
@@ -46,19 +46,19 @@
require "vagrant/plugin/manager"
# Update the load path so our protos can be located
-$LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs").to_s
-$LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto").to_s
-$LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto/vagrant_plugin_sdk").to_s
+# $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs").to_s
+# $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto").to_s
+# $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto/vagrant_plugin_sdk").to_s
# Load our protos so they are available
-require 'vagrant/protobufs/proto/vagrant_server/server_pb'
-require 'vagrant/protobufs/proto/vagrant_server/server_services_pb'
-require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb'
-require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_services_pb'
-require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb'
-require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb'
-require 'vagrant/protobufs/proto/plugin/grpc_broker_pb'
-require 'vagrant/protobufs/proto/plugin/grpc_broker_services_pb'
+# require 'vagrant/protobufs/proto/vagrant_server/server_pb'
+# require 'vagrant/protobufs/proto/vagrant_server/server_services_pb'
+# require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_pb'
+# require 'vagrant/protobufs/proto/ruby_vagrant/ruby-server_services_pb'
+# require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb'
+# require 'vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb'
+# require 'vagrant/protobufs/proto/plugin/grpc_broker_pb'
+# require 'vagrant/protobufs/proto/plugin/grpc_broker_services_pb'
# Enable logging if it is requested. We do this before
# anything else so that we can setup the output before
diff '--color=auto' -Naur /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/commands/serve/command.rb /var/lib/mock/vagrant-rebase/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/commands/serve/command.rb
--- /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/commands/serve/command.rb 2023-02-16 13:41:49.358357676 +0100
+++ /var/lib/mock/vagrant-rebase/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/commands/serve/command.rb 2023-03-17 16:57:02.859959067 +0100
@@ -3,9 +3,9 @@
module VagrantPlugins
module CommandServe
# Simple constant aliases to reduce namespace typing
- SDK = Hashicorp::Vagrant::Sdk
- SRV = Hashicorp::Vagrant
- Empty = ::Google::Protobuf::Empty
+ # SDK = Hashicorp::Vagrant::Sdk
+ # SRV = Hashicorp::Vagrant
+ Empty = []
autoload :Broker, Vagrant.source_root.join("plugins/commands/serve/broker").to_s
autoload :Client, Vagrant.source_root.join("plugins/commands/serve/client").to_s
diff '--color=auto' -Naur /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/kernel_v2/config/vm.rb /var/lib/mock/vagrant-rebase/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/kernel_v2/config/vm.rb
--- /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/kernel_v2/config/vm.rb 2023-02-16 13:41:49.475357444 +0100
+++ /var/lib/mock/vagrant-rebase/root/builddir/build/BUILDROOT/vagrant-2.3.4-1.fc39.x86_64/usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/kernel_v2/config/vm.rb 2023-03-17 16:48:26.940189713 +0100
@@ -11,11 +11,11 @@
require "vagrant/util/map_command_options"
require "vagrant/util/map_command_options"
-$LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto").to_s
-
-require "vagrant/protobufs/proto/protostructure_pb"
-require "vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb"
-require "vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb"
+# $LOAD_PATH << Vagrant.source_root.join("lib/vagrant/protobufs/proto").to_s
+#
+# require "vagrant/protobufs/proto/protostructure_pb"
+# require "vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_pb"
+# require "vagrant/protobufs/proto/vagrant_plugin_sdk/plugin_services_pb"
# Include mappers
require Vagrant.source_root.join("plugins/commands/serve/command").to_s

View file

@ -1,110 +0,0 @@
From 6f9f88e05557d40570a3885b6d3d3a6a24c06090 Mon Sep 17 00:00:00 2001
From: Nicolas St-Laurent <stlaurent.nicolas@gmail.com>
Date: Thu, 22 Sep 2022 08:54:46 -0400
Subject: [PATCH] Replace deprecated File.exists? with File.exist?.
---
lib/vagrant/util/install_cli_autocomplete.rb | 2 +-
plugins/hosts/gentoo/host.rb | 2 +-
plugins/hosts/slackware/host.rb | 2 +-
plugins/provisioners/ansible/provisioner/host.rb | 2 +-
plugins/provisioners/chef/config/chef_zero.rb | 2 +-
test/unit/plugins/provisioners/ansible/provisioner_test.rb | 6 +++---
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/vagrant/util/install_cli_autocomplete.rb b/lib/vagrant/util/install_cli_autocomplete.rb
index 9aaf61a1de2..119749e0f08 100644
--- a/lib/vagrant/util/install_cli_autocomplete.rb
+++ b/lib/vagrant/util/install_cli_autocomplete.rb
@@ -29,7 +29,7 @@ def shell_installed(home)
@logger.info("Searching for config in home #{home}")
@config_paths.each do |path|
config_file = File.join(home, path)
- if File.exists?(config_file)
+ if File.exist?(config_file)
@logger.info("Found config file #{config_file}")
return config_file
end
diff --git a/plugins/hosts/gentoo/host.rb b/plugins/hosts/gentoo/host.rb
index ac7e019d045..6d8b88a6a35 100644
--- a/plugins/hosts/gentoo/host.rb
+++ b/plugins/hosts/gentoo/host.rb
@@ -4,7 +4,7 @@ module VagrantPlugins
module HostGentoo
class Host < Vagrant.plugin("2", :host)
def detect?(env)
- File.exists?("/etc/gentoo-release")
+ File.exist?("/etc/gentoo-release")
end
end
end
diff --git a/plugins/hosts/slackware/host.rb b/plugins/hosts/slackware/host.rb
index ec3503ac02e..bea7cab7476 100644
--- a/plugins/hosts/slackware/host.rb
+++ b/plugins/hosts/slackware/host.rb
@@ -4,7 +4,7 @@ module VagrantPlugins
module HostSlackware
class Host < Vagrant.plugin("2", :host)
def detect?(env)
- return File.exists?("/etc/slackware-version") ||
+ return File.exist?("/etc/slackware-version") ||
!Dir.glob("/usr/lib/setup/Plamo-*").empty?
end
end
diff --git a/plugins/provisioners/ansible/provisioner/host.rb b/plugins/provisioners/ansible/provisioner/host.rb
index 3e594b83c11..f2a57133c79 100644
--- a/plugins/provisioners/ansible/provisioner/host.rb
+++ b/plugins/provisioners/ansible/provisioner/host.rb
@@ -185,7 +185,7 @@ def ship_generated_inventory(inventory_content)
inventory_file = Pathname.new(File.join(inventory_path, 'vagrant_ansible_inventory'))
@@lock.synchronize do
- if !File.exists?(inventory_file) or inventory_content != File.read(inventory_file)
+ if !File.exist?(inventory_file) or inventory_content != File.read(inventory_file)
begin
# ansible dir inventory will ignore files starting with '.'
inventory_tmpfile = Tempfile.new('.vagrant_ansible_inventory', inventory_path)
diff --git a/plugins/provisioners/chef/config/chef_zero.rb b/plugins/provisioners/chef/config/chef_zero.rb
index c19485f882e..84ed08cf5b2 100644
--- a/plugins/provisioners/chef/config/chef_zero.rb
+++ b/plugins/provisioners/chef/config/chef_zero.rb
@@ -81,7 +81,7 @@ def validate(machine)
errors << I18n.t("vagrant.config.chef.nodes_path_empty")
else
missing_paths = Array.new
- nodes_path.each { |dir| missing_paths << dir[1] if !File.exists? dir[1] }
+ nodes_path.each { |dir| missing_paths << dir[1] if !File.exist? dir[1] }
# If it exists at least one path on disk it's ok for Chef provisioning
if missing_paths.size == nodes_path.size
errors << I18n.t("vagrant.config.chef.nodes_path_missing", path: missing_paths.to_s)
diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb
index 180f26869bb..f5828f14340 100644
--- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb
+++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb
@@ -181,7 +181,7 @@ def self.it_should_create_and_use_generated_inventory(with_user = true)
it "generates an inventory with all active machines" do
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args) { |*args|
expect(config.inventory_path).to be_nil
- expect(File.exists?(generated_inventory_file)).to be(true)
+ expect(File.exist?(generated_inventory_file)).to be(true)
inventory_content = File.read(generated_inventory_file)
_ssh = config.compatibility_mode == VagrantPlugins::Ansible::COMPATIBILITY_MODE_V2_0 ? "" : "_ssh"
if with_user
@@ -697,7 +697,7 @@ def ensure_that_config_is_valid
it "generates an inventory with winrm connection settings" do
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args) { |*args|
expect(config.inventory_path).to be_nil
- expect(File.exists?(generated_inventory_file)).to be(true)
+ expect(File.exist?(generated_inventory_file)).to be(true)
inventory_content = File.read(generated_inventory_file)
expect(inventory_content).to include("machine1 ansible_connection=winrm ansible_ssh_host=127.0.0.1 ansible_ssh_port=55986 ansible_ssh_user='winner' ansible_ssh_pass='winword'\n")
@@ -731,7 +731,7 @@ def ensure_that_config_is_valid
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args) { |*args|
expect(args).to include("--inventory-file=#{existing_file}")
expect(args).not_to include("--inventory-file=#{generated_inventory_file}")
- expect(File.exists?(generated_inventory_file)).to be(false)
+ expect(File.exist?(generated_inventory_file)).to be(false)
}.and_return(default_execute_result)
end

View file

@ -1,41 +0,0 @@
From 9743c857481556838ee417a0033efdee3fb0c7fc Mon Sep 17 00:00:00 2001
From: sophia <scastellarin95@gmail.com>
Date: Tue, 3 Jan 2023 13:20:14 -0800
Subject: [PATCH 4/5] Only check for arguments matching test string if the
argument is a string
This issue surfaced in the tests after updating to Ruby 3.2.0 where
the =~ operator has been removed.
ref: https://github.com/ruby/ruby/blob/cca54c8b1b71072bb07850c9d3f20b261d3b312c/NEWS.md?plain=1#L498
---
test/unit/plugins/provisioners/ansible/provisioner_test.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb
index f5828f14340..fdf9aa67eaa 100644
--- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb
+++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb
@@ -91,7 +91,7 @@ def self.it_should_set_arguments_and_environment_variables(
expect(args[1]).to eq("--connection=ssh")
expect(args[2]).to eq("--timeout=30")
- inventory_count = args.count { |x| x =~ /^--inventory-file=.+$/ }
+ inventory_count = args.count { |x| x.match(/^--inventory-file=.+$/) if x.is_a?(String) }
expect(inventory_count).to be > 0
expect(args[args.length-2]).to eq("playbook.yml")
@@ -100,9 +100,9 @@ def self.it_should_set_arguments_and_environment_variables(
it "sets --limit argument" do
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args) { |*args|
- all_limits = args.select { |x| x =~ /^(--limit=|-l)/ }
+ all_limits = args.select { |x| x.match(/^(--limit=|-l)/) if x.is_a?(String) }
if config.raw_arguments
- raw_limits = config.raw_arguments.select { |x| x =~ /^(--limit=|-l)/ }
+ raw_limits = config.raw_arguments.select { |x| x.match(/^(--limit=|-l)/) if x.is_a?(String) }
expect(all_limits.length - raw_limits.length).to eq(1)
expect(all_limits.last).to eq(raw_limits.last)
else

View file

@ -1,53 +1,41 @@
%global bashcompletion_dir %(pkg-config --variable=completionsdir bash-completion 2> /dev/null || :)
%global vagrant_spec_commit a88825f4cb254b703d0f9235667223f02ad5c600
%bcond_without help2man
%bcond_without ed25519
%global vagrant_spec_commit 9413ab298407114528766efefd1fb1ff24589636
Name: vagrant
Version: 2.3.4
Release: 9%{?dist}
Version: 2.1.2
Release: 3%{?dist}
Summary: Build and distribute virtualized development environments
Group: Development/Languages
License: MIT
URL: http://vagrantup.com
Source0: https://github.com/hashicorp/%{name}/archive/refs/tags/v%{version}.tar.gz
Source0: https://github.com/mitchellh/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
# Upstream binstub with adjusted paths, the offical way how to run vagrant
Source1: binstub
# The library has no official release yet. But since it is just test
# dependency, it should be fine to include the source right here.
# wget https://github.com/hashicorp/vagrant-spec/archive/03d88fe2467716b072951c2b55d78223130851a6/vagrant-spec-03d88fe2467716b072951c2b55d78223130851a6.tar.gz
Source2: https://github.com/hashicorp/%{name}-spec/archive/%{vagrant_spec_commit}/%{name}-spec-%{vagrant_spec_commit}.tar.gz
# wget https://github.com/mitchellh/vagrant-spec/archive/9413ab298407114528766efefd1fb1ff24589636/vagrant-spec-9413ab298407114528766efefd1fb1ff24589636.tar.gz
Source2: https://github.com/mitchellh/%{name}-spec/archive/%{vagrant_spec_commit}/%{name}-spec-%{vagrant_spec_commit}.tar.gz
# Monkey-patching needed for Vagrant to work until the respective patches
# for RubyGems and Bundler are in place
Source4: macros.vagrant
# Do not load runtime dependencies in %%check if vagrant is not loaded
# https://github.com/hashicorp/vagrant/pull/10945
Patch1: vagrant-2.2.9-do-not-load-dependencies.patch
# Remove GRPC dependencies for Fedora. It seems that it will serve
# for communication with upcoming Golang backend, however
# it is only in tech-preview now and grpc is not simple to package.
# Let's remove it for now and revisit in the future.
Patch2: vagrant-2.3.4-remove_grpc.patch
# Ruby 3.2 compatibility for tests.
# Commits are cherry-picked instead of a whole PR as it also edits .github
# files that we do not care about.
# https://github.com/hashicorp/vagrant/pull/13043
Patch3: vagrant-2.3.4-Environment-home-dir-is-also-not-accessible-if-EROFS-error-occurs.patch
Patch4: vagrant-2.3.4-Only-check-for-arguments-matching-test-string.patch
# Disable loading of direc_conversions.rb in other files.
# The file is removed as it requires protobuf components not yet
# packaged in Fedora.
Patch5: vagrant-2.3.4-Disable-loading-of-direct_conversions-file.patch
# Default URL for pulling boxes seems to have changed.
# This fix allows vagrant to pull boxes again.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2337302
Patch6: vagrant-2.3.4-Fix-the-default-vagrant-URL-for-pulling-boxes.patch
# The load directive is supported since RPM 4.12, i.e. F21+. The build process
# fails on older Fedoras.
%{load:%{SOURCE4}}
%{?load:%{SOURCE4}}
Patch0: vagrant-2.1.2-fix-dependencies.patch
# Handle rename of nfs-utils-lib to libnfs-utils in F28
# https://github.com/hashicorp/vagrant/pull/9935/commits/f0b9d025e481eaf03db9a92ed51f3fe07541fa76
Patch1: vagrant-2.1.3-Fix-change-in-packaging-for-nfs-in-Fedora.patch
# Update restart logic in redhat change_host_name cap
# https://bugzilla.redhat.com/show_bug.cgi?id=1624068
# https://github.com/hashicorp/vagrant/pull/10223
# https://github.com/hashicorp/vagrant/commit/11b0d58fa081cd9a27c272244a0d119acc81f32e
# https://github.com/hashicorp/vagrant/commit/1797798760eb72d6b02724f75bc54dd83815e986
Patch2: vagrant-2.1.6-update-restart-logic-in-redhat.patch
Requires: ruby(release)
Requires: ruby(rubygems) >= 1.3.6
@ -55,38 +43,24 @@ Requires: ruby(rubygems) >= 1.3.6
Requires: ruby
Requires: rubygem(hashicorp-checkpoint) >= 0.1.5
Requires: rubygem(childprocess) >= 0.5.0
Requires: rubygem(erubi)
Requires: (rubygem(i18n) >= 1.8 with rubygem(i18n) < 2.0)
Requires: rubygem(erubis) >= 2.7.0
Requires: rubygem(i18n) >= 0.6.0
Requires: rubygem(json)
Requires: (rubygem(listen) >= 3.2 with rubygem(listen) < 4)
Requires: rubygem(listen) >= 3.1.5
Requires: rubygem(log4r) >= 1.1.9
Requires: (rubygem(net-ssh) >= 5.2.0 with rubygem(net-ssh) < 8)
Requires: rubygem(net-ssh) >= 4.2.0
Requires: rubygem(net-scp) >= 1.2.0
Requires: rubygem(net-sftp) >= 2.1
Requires: rubygem(rubyzip) >= 1.1.7
Requires: rubygem(net-ftp)
Requires: rubygem(rexml)
Requires: rubygem(mime-types)
Requires: rubygem(rest-client) >= 1.6.0
Requires: bsdtar
Requires: curl
Requires: %{_bindir}/ps
Recommends: vagrant(vagrant-libvirt)
Recommends: (podman-docker if podman)
%if %{with ed25519}
Requires: rubygem(ed25519)
Requires: rubygem(bcrypt_pbkdf)
BuildRequires: rubygem(ed25519)
BuildRequires: rubygem(bcrypt_pbkdf)
%else
Recommends: rubygem(ed25519)
Recommends: rubygem(bcrypt_pbkdf)
%endif
Requires(pre): shadow-utils
BuildRequires: bsdtar
BuildRequires: ruby
BuildRequires: rubygems-devel
BuildRequires: rubygem(listen)
BuildRequires: rubygem(childprocess)
BuildRequires: rubygem(hashicorp-checkpoint)
@ -95,26 +69,24 @@ BuildRequires: rubygem(net-ssh)
BuildRequires: rubygem(net-scp)
BuildRequires: rubygem(i18n)
BuildRequires: rubygem(json)
BuildRequires: rubygem(erubi)
BuildRequires: rubygem(erubis)
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rspec-its)
BuildRequires: rubygem(net-sftp)
BuildRequires: rubygem(rubyzip)
BuildRequires: rubygem(rest-client)
BuildRequires: rubygem(thor)
BuildRequires: rubygem(webmock)
BuildRequires: rubygem(webrick)
BuildRequires: rubygem(fake_ftp)
BuildRequires: rubygem(rake)
BuildRequires: rubygem(net-ftp)
BuildRequires: rubygem(rexml)
BuildRequires: rubygem(mime-types)
BuildRequires: pkgconfig(bash-completion)
%if %{with help2man}
BuildRequires: help2man
%endif
BuildRequires: %{_bindir}/ssh
BuildArch: noarch
# vagrant-atomic was retired in F26, since it was merged into Vagrant.
# https://github.com/projectatomic/vagrant-atomic/issues/5
# https://github.com/mitchellh/vagrant/pull/5847
Obsoletes: vagrant-atomic <= 0.1.0-4
# Since Vagrant itself is installed on the same place as its plugins
# the vagrant_plugin macros can be reused in the spec file, but the plugin
# name must be specified.
@ -126,6 +98,7 @@ environments.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
@ -135,88 +108,9 @@ Documentation for %{name}.
%prep
%setup -q -b2
# TODO: package vagrant_cloud, as it is not in Fedora yet
%gemspec_remove_dep -s %{name}.gemspec -g vagrant_cloud
# Remove `cloud` command and references to it
%gemspec_remove_file -s %{name}.gemspec Dir.glob('plugins/commands/cloud/**/*.*')
rm -rf ./plugins/commands/cloud/
sed -i '/^\s*I18n\..*$/ s/^/#/g' plugins/commands/login/plugin.rb
sed -i '/^\s*command(:login) do$/,/\s*end$/ s/^/#/g' plugins/commands/login/plugin.rb
# Expand required Ruby compatibility, otherwise RubyGems throws exceptions.
# Relevant rhbz: https://bugzilla.redhat.com/show_bug.cgi?id=2053476#c0
# Relevant RubyGems issue: https://github.com/rubygems/rubygems/issues/4338
sed -i -e '/required_ruby_version/ s/, "< 3.2"//' %{name}.gemspec
# We have older version in Fedora
%gemspec_remove_dep -s %{name}.gemspec -g net-sftp '~> 4.0'
%gemspec_add_dep -s %{name}.gemspec -g net-sftp '>= 2.1.2'
%gemspec_remove_dep -s %{name}.gemspec -g net-scp '~> 4.0'
%gemspec_add_dep -s %{name}.gemspec -g net-scp '>= 1.2.0'
# We have newer version in Fedora
%gemspec_remove_dep -s %{name}.gemspec -g listen
%gemspec_add_dep -s %{name}.gemspec -g listen '>= 3.5.1'
%gemspec_remove_dep -s %{name}.gemspec -g rubyzip '~> 2.0'
%gemspec_add_dep -s %{name}.gemspec -g rubyzip '>= 2.0.0'
# Remove Windows specific dependencies
%gemspec_remove_dep -s %{name}.gemspec -g wdm
%gemspec_remove_dep -s %{name}.gemspec -g winrm
%gemspec_remove_dep -s %{name}.gemspec -g winrm-fs
%gemspec_remove_dep -s %{name}.gemspec -g winrm-elevated
# Remove BSD dependency
%gemspec_remove_dep -s %{name}.gemspec -g rb-kqueue
# Allow older childprocess version
%gemspec_remove_dep -s %{name}.gemspec -g childprocess
%gemspec_add_dep -s %{name}.gemspec -g childprocess '>= 1.0.1'
# Relax net-ssh dependency. We have newer net-ssh in Fedora
%gemspec_remove_dep -s %{name}.gemspec -g net-ssh
%gemspec_add_dep -s %{name}.gemspec -g net-ssh ['>= 5.2.0', '< 8']
# Remove "optional" dependencies
# This seems like prelude for the in-development golang backend.
# Nothing runtime critical.
%gemspec_remove_dep -s %{name}.gemspec -g googleapis-common-protos-types
%gemspec_remove_dep -s %{name}.gemspec -g grpc
%gemspec_remove_dep -s %{name}.gemspec -g rgl
# Load missing dependency Vagrant::Util::MapCommandOptions
# https://github.com/hashicorp/vagrant/pull/11609
sed -i '/^\s*require..vagrant.util.experimental.\s*$/ a\require "vagrant/util/map_command_options"' \
plugins/kernel_v2/config/vm.rb
%if %{without ed25519}
# Remove optional dependencies
%gemspec_remove_dep -s %{name}.gemspec -g bcrypt_pbkdf
%gemspec_remove_dep -s %{name}.gemspec -g ed25519
# Disable patch for ed25519
sed -i '/^ require .net\/ssh\/authentication\/ed25519.$/,/^ end$/ s/^/#/' \
lib/vagrant/patches/net-ssh.rb
%else
%gemspec_remove_dep -s %{name}.gemspec -g ed25519
%gemspec_add_dep -s %{name}.gemspec -g ed25519 ['>= 1.2.4', '< 1.4']
%endif
# Let's get rid of protobuf related components
%patch 2 -p16
%gemspec_remove_file -s %{name}.gemspec Dir.glob('lib/vagrant/protobufs/**/*.*')
# This file contains monkey patching and compatibility for Protobuf serialization.
# We do not need that as we skip protobuf related parts completely.
%gemspec_remove_file -s %{name}.gemspec "plugins/commands/serve/util/direct_conversions.rb"
rm -rf plugins/commands/serve/util/direct_conversions.rb
# Patch out related requires in code.
%patch 5 -p1
%patch 3 -p1
%patch 6 -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
gem build %{name}.gemspec
@ -246,9 +140,6 @@ install -D -m 0644 %{buildroot}%{vagrant_plugin_instdir}/contrib/bash/completion
%{buildroot}%{bashcompletion_dir}/%{name}
sed -i '/#!\// d' %{buildroot}%{bashcompletion_dir}/%{name}
install -D -m 0644 %{buildroot}%{vagrant_plugin_instdir}/contrib/zsh/_%{name} \
%{buildroot}%{_datadir}/zsh/site-functions/_%{name}
# Install Vagrant macros
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d/
@ -268,28 +159,27 @@ install -d -m 755 %{buildroot}%{vagrant_plugin_conf_dir}
touch %{buildroot}%{vagrant_plugin_conf}
ln -s -t %{buildroot}%{vagrant_embedded_dir}/ %{vagrant_plugin_conf}
%if %{with help2man}
# !!! Backward compatibility hack, introduced in F26 timeframe !!!
# It allows to (un)register old Vagrant plugins via newer Vagrant.
# This should be possible to remove at F29, when there is chance everybody is
# using more recent versions of Vagrant.
install -d -m 755 %{buildroot}%{vagrant_embedded_dir}/lib/vagrant/plugin
cat > %{buildroot}%{vagrant_embedded_dir}/lib/vagrant/plugin/manager.rb << 'EOF'
$LOAD_PATH.shift
$LOAD_PATH.unshift '%{vagrant_dir}/lib'
require 'vagrant/plugin/manager'
EOF
# Turn `vagrant --help` into man page.
export GEM_PATH="%{gem_dir}:%{buildroot}/usr/share/vagrant/gems"
# Needed to display help page without a warning.
export VAGRANT_INSTALLER_ENV=1
mkdir -p %{buildroot}%{_mandir}/man1
help2man -N -s1 -o %{buildroot}%{_mandir}/man1/%{name}.1 \
%{buildroot}/usr/share/%{name}/gems/gems/%{name}-%{version}/bin/%{name} || \
help2man --no-discard-stderr -N -s1 -o %{buildroot}%{_mandir}/man1/%{name}.1 \
%{buildroot}/usr/share/%{name}/gems/gems/%{name}-%{version}/bin/%{name}
%endif
%check
# Do not load dependencies from gemspec
cat %{PATCH1} | patch -p1
# Ruby 3.2 compatibility fix
cat %{PATCH4} | patch -p1
sed -i '/^\s*context "when vagrant specification is not found" do$/,/^ end$/ s/^/#/' \
test/unit/vagrant/bundler_test.rb
sed -i '/^\s*it "should init the bundler instance with plugins" do$/,/^ end$/ s/^/#/' \
test/unit/vagrant/plugin/manager_test.rb
# Adjust the vagrant-spec directory name.
rm -rf ../vagrant-spec
mv ../vagrant-spec{-%{vagrant_spec_commit},}
@ -301,7 +191,8 @@ sed -i '/git/ s/^/#/' ../vagrant-spec/vagrant-spec.gemspec
sed -i '/thor/ s/~>/>=/' ../vagrant-spec/vagrant-spec.gemspec
sed -i '/rspec/ s/~>/>=/' ./vagrant.gemspec
sed -i '/rspec/ s/~>/>=/' ../vagrant-spec/vagrant-spec.gemspec
sed -i '/childprocess/ s/~>/>=/' ../vagrant-spec/vagrant-spec.gemspec
# TODO: package newer childproccess
sed -i '/childprocess/ s/~>/<=/' ../vagrant-spec/vagrant-spec.gemspec
#Insert new test dependencies
sed -i '25 i\ spec.add_dependency "webmock"' ../vagrant-spec/vagrant-spec.gemspec
@ -318,59 +209,12 @@ sed -i '/^ context "with winrm communicator" do$/,/^ end$/ s/^/#/' \
# https://github.com/hashicorp/vagrant/issues/9273
mv test/unit/vagrant/util/env_test.rb{,.disable}
# vagrant_cloud is not in Fedora yet; login command is deprecated
# in favor of vagrant_cloud
rm -r test/unit/plugins/commands/cloud/
# Disable test that requires network
sed -i '/^ it "generates a network name and configuration" do$/,/^ end/ s/^/#/' \
test/unit/plugins/providers/docker/action/prepare_networks_test.rb
# Remove failing BSD-host tests, as we don't care about those.
rm -rf test/unit/plugins/hosts/bsd
# Export the OS as an environment variable that Vagrant can access, so the
# test suite is executed with same host it will be run (also avoids docker
# installer_test issue).
export VAGRANT_DETECTED_OS="$(uname -s 2>/dev/null)"
# Disable tests concerning protobuf
mv ./test/unit/plugins/commands/serve/service/guest_service_test.rb{,.disabled}
mv ./test/unit/plugins/commands/serve/service/host_service_test.rb{,.disabled}
mv ./test/unit/plugins/commands/serve/util/exception_transformer_test.rb{,.disabled}
mv ./test/unit/plugins/commands/serve/mappers_test.rb{,.disabled}
sed -i -e '/ it "uses a directory within the home directory by default" do/a\
skip "Requires protobuf"' ./test/unit/vagrant/environment_test.rb
# Put gem load path on top of the load path, so they are loaded earlier then
# their StdLib symlinks.
%{!?buildtime_libdir:%global buildtime_libdir $(ruby -rrbconfig -e 'puts RbConfig::CONFIG["libdir"]')}
RUBYOPT="-I"
for module in \
openssl \
psych
do
for dir in \
%{gem_dir}/gems/$module-*/lib \
%{buildtime_libdir}/gems/ruby/$module-*
do
RUBYOPT="$RUBYOPT:$dir"
done
done
export RUBYOPT
# Rake solves the requires issues for tests
rake -f tasks/test.rake test:unit \
| tee error.log
rake -f tasks/test.rake test:unit
%if %{with help2man}
# Check `--help` output, using which man page is created
export GEM_PATH="%{gem_dir}:%{buildroot}/usr/share/vagrant/gems"
export VAGRANT_INSTALLER_ENV=1
%{buildroot}/usr/share/%{name}/gems/gems/%{name}-%{version}/bin/%{name} --help 2>/dev/null \
| grep -q '^Usage: vagrant '
%endif
%pre
getent group vagrant >/dev/null || groupadd -r vagrant
%post -p %{_bindir}/ruby
begin
@ -440,15 +284,8 @@ end
%dir %{dirname:%{vagrant_plugin_instdir}}
%dir %{dirname:%{vagrant_plugin_spec}}
%exclude %{vagrant_plugin_instdir}/Makefile
%exclude %{vagrant_plugin_instdir}/Dockerfile
%exclude %{vagrant_plugin_instdir}/flake*
%exclude %{vagrant_plugin_instdir}/go.{mod,sum}
%exclude %{vagrant_plugin_instdir}/gen.go
%exclude %{vagrant_plugin_instdir}/binstubs/vagrant
%exclude %{vagrant_plugin_instdir}/nix/*.nix
%exclude %{vagrant_plugin_instdir}/shell.nix
%exclude %{vagrant_plugin_instdir}/vagrant-config.hcl
# Kept for backward compatibility.
%{vagrant_embedded_dir}/lib
%{_bindir}/%{name}
%dir %{vagrant_plugin_instdir}
@ -461,7 +298,6 @@ end
# TODO: Make more use of contribs.
%{vagrant_plugin_instdir}/contrib
%exclude %{vagrant_plugin_instdir}/contrib/bash
%exclude %{vagrant_plugin_instdir}/contrib/zsh/_%{name}
# This is not the original .gemspec.
%exclude %{vagrant_plugin_instdir}/vagrant.gemspec
%{vagrant_plugin_instdir}/keys
@ -479,13 +315,7 @@ end
%dir %{dirname:%{bashcompletion_dir}}
%dir %{bashcompletion_dir}
%{bashcompletion_dir}/%{name}
# By "owning" the site-functions dir, we don't need to Require zsh
%dir %{_datadir}/zsh
%{_datadir}/zsh/site-functions/_%{name}
%{_rpmconfigdir}/macros.d/macros.%{name}
%if %{with help2man}
%{_mandir}/man1/%{name}.1*
%endif
%files doc
%doc %{vagrant_plugin_instdir}/RELEASE.md
@ -494,145 +324,11 @@ end
%{vagrant_plugin_instdir}/Rakefile
%{vagrant_plugin_instdir}/tasks
%{vagrant_plugin_instdir}/vagrant-spec.config.example.rb
%{_mandir}/man1/%{name}.1*
%changelog
* Mon Dec 22 2025 Vít Ondruch <vondruch@redhat.com> - 2.3.4-9
- Relax `rubygem(rubyzip)` dependency
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Jan 16 2025 Jarek Prokop <jprokop@redhat.com> - 2.3.4-7
- Fix default URL used for pulling boxes.
Resolves: rhbz#2337302
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Wed Feb 07 2024 Vít Ondruch <vondruch@redhat.com> - 2.3.4-5
- Drop superfluous rest-client dependency.
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jun 21 2023 Zdenek Zambersky <zzambers@redhat.com> - 2.3.4-2
- Added missing dependency on rexml and mime-types
* Tue May 09 2023 Jarek Prokop <jprokop@redhat.com> - 2.3.4-1
- Upgrade to Vagrant 2.3.4.
* Thu Mar 16 2023 Pavel Valena <pvalena@redhat.com> - 2.2.19-10
- Handle URL properly
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Jan 09 2023 Jarek Prokop <jprokop@redhat.com> - 2.2.19-8
- Enable rubygem-ed25519 requires.
Resolves: rhbz#1962869
* Fri Jan 6 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.2.19-7
- Replace regex match patch with the one by the upstream
* Mon Dec 26 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.2.19-6
- Backport upstream fix for ruby3.2 File.exists? removal
- Apply proposal fix for ruby3.2 Object#=~ removal
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Mar 11 2022 Pavel Valena <pvalena@redhat.com> - 2.2.19-4
- Add missing dependency on bin/ps
* Mon Feb 21 2022 Jarek Prokop <jprokop@redhat.com> - 2.2.19-3
- Fix FTBFS due to new rspec-mocks.
- Relax required ruby version.
Resolves: rhbz#2053476
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Nov 15 2021 Pavel Valena <pvalena@redhat.com> - 2.2.19-1
- Upgrade Vagrant to 2.2.19.
Resolves: rhbz#1980195
- Add zsh autocompletion.
- Relax net-ssh dependency once more.
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Apr 16 2021 Pavel Valena <pvalena@redhat.com> - 2.2.16-1
- Update to Vagrant 2.2.16.
Resolves: rhbz#1872307
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.9-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jan 20 2021 Vít Ondruch <vondruch@redhat.com> - 2.2.9-5
- Fix Ruby 3.0 and rspec-mock 3.10.1 compatibility.
- Relax net-ssh dependency.
- Relax Ruby version restriction.
Resolves: rhbz#1915671
* Mon Aug 17 2020 Vít Ondruch <vondruch@redhat.com> - 2.2.9-4
- Use Erubi instead of Erubis.
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed May 20 2020 Pavel Valena <pvalena@redhat.com> - 2.2.9-2
- Move dependency load map_command_options
for creating @box_extra_download_options to config/vm.rb.
https://github.com/hashicorp/vagrant/pull/11609
* Mon May 11 2020 Pavel Valena <pvalena@redhat.com> - 2.2.9-1
- Update to Vagrant 2.2.9.
Resolves: rhbz#1795460
- Added support for podman via docker podman-docker wrapper
(https://github.com/hashicorp/vagrant/pull/11356).
* Tue Apr 21 2020 Vít Ondruch <vondruch@redhat.com> - 2.2.6-4
- Relax rubygem-net-ssh dependency.
Resolves: rhbz#1805240
- Fix FTBFS due to Ruby 2.7.
Resolves: rhbz#1800230
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Oct 15 2019 Pavel Valena <pvalena@redhat.com> - 2.2.6-1
- Upgrade to Vagrant 2.2.6.
- Move man pages to main package
* Wed Aug 14 2019 Pavel Valena <pvalena@redhat.com> - 2.2.5-1
- Update to Vagrant 2.2.5.
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Mar 15 2019 Vít Ondruch <vondruch@redhat.com> - 2.2.4-2
- Don't create `vagrant` group anymore.
* Fri Mar 01 2019 Pavel Valena <pvalena@redhat.com> - 2.2.4-1
- Update to Vagrant 2.2.4.
* Fri Feb 15 2019 Vít Ondruch <vondruch@redhat.com> - 2.2.3-2
- Disable Vagrant's built-in version check.
* Thu Feb 14 2019 Pavel Valena <pvalena@redhat.com> - 2.2.3-1
- Update to Vagrant 2.2.3.
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Oct 11 2018 Pavel Valena <pvalena@redhat.com> - 2.1.5-2
- Fix: two additional patches for change_host_name logic(rhbz#1624068)
* Wed Sep 19 2018 Pavel Valena <pvalena@redhat.com> - 2.1.5-1
- Update to Vagrant 2.1.5.
* Wed Oct 24 2018 Pavel Valena <pvalena@redhat.com> - 2.1.2-3
- Update restart logic for redhat change_host_name cap(rhbz#1624068)
* Wed Sep 12 2018 Tobias Jungel <tobias.jungel@bisdn.de> - 2.1.2-2