#17 Update to Vagrant 2.2.3
Closed 5 years ago by vondruch. Opened 5 years ago by pvalena.
rpms/ pvalena/vagrant rebase  into  master

file modified
+8 -4
@@ -18,13 +18,17 @@ 

  %vagrant_plugin_conf_link %{vagrant_embedded_dir}/plugins.json

  %vagrant_plugin_conf %{vagrant_plugin_conf_dir}/plugins.json

  

- # Install gem into appropriate directory.

- # -n<vagrant_plugin_file>      Overrides gem file name for installation.

- # -d<install_dir>   Set installation directory.

+ # %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.

+ #

  %vagrant_plugin_install(d:n:) \

  mkdir -p %{-d*}%{!?-d:.%{vagrant_plugin_dir}} \

  \

- CONFIGURE_ARGS="--with-cflags='%{optflags}' $CONFIGURE_ARGS" \\\

+ CONFIGURE_ARGS="--with-cflags='%{optflags}' --with-cxxflags='%{optflags}' $CONFIGURE_ARGS" \\\

  gem install \\\

          -V \\\

          --local \\\

file modified
+2 -2
@@ -1,2 +1,2 @@ 

- SHA512 (vagrant-2.1.5.tar.gz) = 544216eb25c06a1ebddbadcc9d2d6a6dd9932e33d2554e3d51dba0e24a339b9afe0b85d1322bdb67c5de3d070aa4c854f1ccc931b23ea80f0625eb4d1f120238

- SHA512 (vagrant-spec-94a9d31ba18b4130b14da12a2f7b4001c3d2ff12.tar.gz) = b95eefa52c21e1020f3f889fc5a72476a3ffb76f780b0254af85bbbc55465c05081f7c18303caa67843bc959326cbf253b57609faa8187fd89188a2488bfe922

+ SHA512 (vagrant-2.2.0.tar.gz) = 55b3edfe4360f7e94ee01dffd02ddb69cc793e7c5e0b2939c0d95827959083f7caa523f5cac430af0cf4890ecec1387ce7175604fff6c8dcc1be515c18d4080a

+ SHA512 (vagrant-spec-abfc34474d122235d56e4c6b6fb5d3e35bedfa90.tar.gz) = cbb60d661d34b37bc5d414da0b2a31f39e2910c11251e334da5efbd8f010b5bd428bc1ae476fcb9b42ec4e8f8c6265292ba3f8f543625178ecb85aad06e8856f

@@ -1,65 +0,0 @@ 

- 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", "~> 5.0.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

@@ -1,598 +0,0 @@ 

- 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 | 21 +++++++++++++++++----

-  1 file changed, 17 insertions(+), 4 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

- @@ -12,27 +12,39 @@ module Linux

-          #

-          # @return [Boolean]

-          def systemd?(comm)

- -          comm.test("sudo ps -o comm= 1 | grep systemd")

- +          comm.test("ps -o comm= 1 | grep systemd")

-          end

-  

-          # 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 -t")

- @@ -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

- @@ -57,7 +57,7 @@ def netplan?(comm)

-          # @param [Vagrant::Plugin::V2::Communicator] comm Guest communicator

-          # @return [Boolean]

-          def nmcli?(comm)

- -          comm.test("nmcli -t")

- +          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 -t d show eth1").and_return(false)

-        allow(comm).to receive(:test).with("nmcli -t d show eth2").and_return(false)

- -      allow(comm).to receive(:test).with("sudo 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("sudo 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")

file modified
+45 -35
@@ -1,12 +1,11 @@ 

  %global bashcompletion_dir %(pkg-config --variable=completionsdir bash-completion 2> /dev/null || :)

  

- %global vagrant_spec_commit 94a9d31ba18b4130b14da12a2f7b4001c3d2ff12

+ %global vagrant_spec_commit abfc34474d122235d56e4c6b6fb5d3e35bedfa90

  

  Name: vagrant

- Version: 2.1.5

- Release: 2%{?dist}

+ Version: 2.2.3

+ Release: 1%{?dist}

  Summary: Build and distribute virtualized development environments

- Group: Development/Languages

  License: MIT

  URL: http://vagrantup.com

  Source0: https://github.com/mitchellh/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
@@ -14,7 +13,7 @@ 

  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/mitchellh/vagrant-spec/archive/94a9d31ba18b4130b14da12a2f7b4001c3d2ff12/vagrant-spec-94a9d31ba18b4130b14da12a2f7b4001c3d2ff12.tar.gz

+ # wget https://github.com/mitchellh/vagrant-spec/archive/abfc34474d122235d56e4c6b6fb5d3e35bedfa90/vagrant-spec-abfc34474d122235d56e4c6b6fb5d3e35bedfa90.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
@@ -24,15 +23,6 @@ 

  # fails on older Fedoras.

  %{?load:%{SOURCE4}}

  

- Patch0: vagrant-2.1.5-fix-dependencies.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

- Patch1: vagrant-2.1.6-update-restart-logic-in-redhat.patch

- 

  Requires: ruby(release)

  Requires: ruby(rubygems) >= 1.3.6

  # Explicitly specify MRI, since Vagrant does not work with JRuby ATM.
@@ -40,14 +30,15 @@ 

  Requires: rubygem(hashicorp-checkpoint) >= 0.1.5

  Requires: rubygem(childprocess) >= 0.5.0

  Requires: rubygem(erubis) >= 2.7.0

- Requires: rubygem(i18n) >= 0.6.0

+ Requires: rubygem(i18n) >= 1.1.0

  Requires: rubygem(json)

  Requires: rubygem(listen) >= 3.1.5

  Requires: rubygem(log4r) >= 1.1.9

- Requires: rubygem(net-ssh) >= 4.2.0

+ Requires: rubygem(net-ssh) >= 5.1.0

  Requires: rubygem(net-scp) >= 1.2.0

  Requires: rubygem(net-sftp) >= 2.1

  Requires: rubygem(rest-client) >= 1.6.0

+ Requires: rubygem(rubyzip) >= 1.2.2

  Requires: bsdtar

  Requires: curl

  
@@ -71,6 +62,7 @@ 

  BuildRequires: rubygem(rspec-its)

  BuildRequires: rubygem(net-sftp)

  BuildRequires: rubygem(rest-client)

+ BuildRequires: rubygem(rubyzip)

  BuildRequires: rubygem(thor)

  BuildRequires: rubygem(webmock)

  BuildRequires: rubygem(fake_ftp)
@@ -95,7 +87,6 @@ 

  

  %package doc

  Summary: Documentation for %{name}

- Group: Documentation

  Requires: %{name} = %{version}-%{release}

  BuildArch: noarch

  
@@ -105,13 +96,39 @@ 

  %prep

  %setup -q -b2

  

- %patch0 -p1

- %patch1 -p1

- 

  %build

- %gemspec_remove_dep -s %{name}.gemspec -g childprocess '~> 0.5.0'

+ # 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

+ 

+ # We have newer versions in Fedora

+ %gemspec_remove_dep -s %{name}.gemspec -g childprocess '~> 0.6.0'

  %gemspec_add_dep -s %{name}.gemspec -g childprocess '>= 0.5.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

+ 

+ # Do not impose any Ruby version restrictions on Fedora.

+ %gemspec_remove_dep -s %{name}.gemspec -g ruby_dep

+ 

+ # Allow older rubyzip version

+ # TODO: remove

+ # https://src.fedoraproject.org/rpms/rubygem-rubyzip/pull-request/1

+ %gemspec_remove_dep -s %{name}.gemspec -g rubyzip

+ %gemspec_add_dep -s %{name}.gemspec -g rubyzip

+ 

+ 

  gem build %{name}.gemspec

  

  gem install -V --local \
@@ -158,17 +175,6 @@ 

  touch %{buildroot}%{vagrant_plugin_conf}

  ln -s -t %{buildroot}%{vagrant_embedded_dir}/ %{vagrant_plugin_conf}

  

- # !!! 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.
@@ -207,6 +213,10 @@ 

  # 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,login}/

+ 

  # Rake solves the requires issues for tests

  rake -f tasks/test.rake test:unit

  
@@ -282,9 +292,6 @@ 

  %dir %{dirname:%{vagrant_plugin_instdir}}

  %dir %{dirname:%{vagrant_plugin_spec}}

  

- # Kept for backward compatibility.

- %{vagrant_embedded_dir}/lib

- 

  %{_bindir}/%{name}

  %dir %{vagrant_plugin_instdir}

  %license %{vagrant_plugin_instdir}/LICENSE
@@ -326,6 +333,9 @@ 

  

  

  %changelog

+ * Thu Jan 03 2019 Pavel Valena <pvalena@redhat.com> - 2.2.3-1

+ - Update to Vagrant 2.2.3.

+ 

  * Thu Oct 11 2018 Pavel Valena <pvalena@redhat.com> - 2.1.5-2

  - Fix: two additional patches for change_host_name logic(rhbz#1624068)

  

also enhance .spec file.


Up-to-date copr-build:
https://copr.fedorainfracloud.org/coprs/pvalena/vagrant/build/854946/

Up-to-date scratch-build:
- needs Net:SSH

Checks:

  • tests run: ok
  • install & init: ok
  • smoke test: ok

Not checked:

  • Plugins install

Notes:

  • Replaced fix-dependencies.patch with %gemspec_ macros
  • Removed command cloud, which depends on unpackaged vagrant_cloud gem (but Review Request is submitted)
  • Updated vagrant-spec commit

Smoke test[passing] env:

  • vagrant-2.2.3-5.fc28.noarch
  • vagrant-libvirt-0.0.45-5.fc28.noarch
  • ruby-2.6.1-112.fc28.x86_64
  • rubygems-3.0.1-112.fc28.noarch
  • rubygem-net-ssh-5.1.0-1.fc28.noarch
  • rubygem-i18n-1.1.1-2.fc28.noarch
  • rubygem-childprocess-0.9.0-1.fc28.noarch
  • rubygem-ruby-libvirt-0.7.1-4.fc28.x86_64
  • rubygem-fog-core-2.1.2-1.fc28.noarch
  • rubygem-fog-json-1.2.0-1.fc28.noarch
  • rubygem-fog-libvirt-0.5.0-2.fc28.noarch

Prerequisites in order:


Disabled tests:

  3) VagrantPlugins::FTPPush::FTPAdapter#upload uploads the file
     # ./test/unit/plugins/pushes/ftp/adapter_test.rb:75

  4) VagrantPlugins::FTPPush::FTPAdapter#upload uploads in passive mode
     # ./test/unit/plugins/pushes/ftp/adapter_test.rb:84

  5) VagrantPlugins::FTPPush::SFTPAdapter#upload uploads the file
     # ./test/unit/plugins/pushes/ftp/adapter_test.rb:112

  6) VagrantPlugins::FTPPush::Push#push pushes the files to the server
     # ./test/unit/plugins/pushes/ftp/push_test.rb:72

  7) Vagrant::Action::Builtin::BoxAdd with box file directly adds from FTP URL
     # ./test/unit/vagrant/action/builtin/box_add_test.rb:149

rebased onto fb5c0ae5b3993f7ed678c0423d9e4c192c81172a

5 years ago

Newer rubygem-rubyzip is needed for Vagrant 2.2.0 to install.

rebased onto 4d270c26a5c6bc046ad1ff3ad07b26dc6c7d24bf

5 years ago

Build failure (only in Koji):

  1) Vagrant::Util::CheckpointClient#version_check latest version is newer than current version should not display upgrade information
     Failure/Error: expect(prefixed_ui).not_to receive(:info).at_least(:once)
     RuntimeError:
       `count` is not supported with negative message expectations
     # ./test/unit/vagrant/util/checkpoint_client_test.rb:178:in `block (4 levels) in <top (required)>'

Maybe because of older vagrant-libvirt.

rebased onto c275eaa0b0dc6deeed5a57ffc357e81ca8810ee5

5 years ago

Newer rubygem-rubyzip is needed for Vagrant 2.2.0 to install.

Have you tried to relax the dependency?

Have you tried to relax the dependency?

I currently have no way of testing, whether it'll work. I'll check whether tests pass.


The failure I mentioned before did not occur in previous builds. It was triggered by rspec update to 3.8.

rebased onto f56538a38cb2bc40a03b99709493766cef676f14

5 years ago

Tests do pass, install too. Running smoke test now. I've fixed the rspec failure too.

Note: libvirt needs updated libusbx on F28.

rebased onto 262be7bc7ec77036670f1ecd850dab7546496fac

5 years ago

rebased onto e8c718598ff2a958aec27bc068183d1c94f576a6

5 years ago

rebased onto 278d82220a6ec68b939869ccf87c7cc568789e3b

5 years ago

rebased onto 7e10149be9c9e5ef09a9e698d3e0b0d5051e9953

5 years ago

rebased onto 60f3811c6f8048379d275dad5ae02fdb225cab53

5 years ago

rebased onto ac5ab0b

5 years ago

Failure with libvirt.qemu_use_session = true occurs if Vagrantfile contains f.e.:

test_vm.vm.network :private_network, :ip => "172.16.0.2"

As well as ed25519 gem.
Vagrant can however operate without them, so this is non-blocking issue.

Smoke-Tested with QEMU/Session on by default (vagrant-libvirt PR).

Works fine, even setting it off manually for specific Vagrantfile works as expected.

Works fine, even setting it off manually for specific Vagrantfile works as expected.

IOW it results in:

Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/liveuser/.ssh/id_rsa:

If user is not in the libvirt group.

Pull-Request has been closed by vondruch

5 years ago