Merge pull request #9926 from Telekom-PD/centos_75_nmcli_hang

Fix hang at nmcli call on CentOS 7.5 when ssh.pty is enabled
This commit is contained in:
Chris Roberts 2018-07-27 12:11:30 -07:00 committed by GitHub
commit c0b871794c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -44,7 +44,7 @@ module Vagrant
#
# @return [Boolean]
def nmcli?(comm)
comm.test("nmcli")
comm.test("nmcli -t")
end
# NetworkManager currently controls device
@ -53,8 +53,8 @@ module Vagrant
# @param device_name [String]
# @return [Boolean]
def nm_controlled?(comm, device_name)
comm.test("nmcli d show #{device_name}") &&
!comm.test("nmcli d show #{device_name} | grep unmanaged")
comm.test("nmcli -t d show #{device_name}") &&
!comm.test("nmcli -t d show #{device_name} | grep unmanaged")
end
end

View File

@ -65,8 +65,8 @@ describe "VagrantPlugins::GuestDebian::Cap::ConfigureNetworks" do
end
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("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("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)
@ -125,8 +125,8 @@ describe "VagrantPlugins::GuestDebian::Cap::ConfigureNetworks" do
it "uses NetworkManager if detected on device" do
allow(cap).to receive(:nm_controlled?).and_return(true)
allow(comm).to receive(:test).with("nmcli d show eth1").and_return(true)
allow(comm).to receive(:test).with("nmcli d show eth2").and_return(true)
allow(comm).to receive(:test).with("nmcli -t d show eth1").and_return(true)
allow(comm).to receive(:test).with("nmcli -t d show eth2").and_return(true)
expect(cap).to receive(:upload_tmp_file).with(comm, nm_yml)
.and_return("/tmp/vagrant-network-entry.1234")