(#9428) Update systemd? check for guest inspection

Prior to this commit, the regex matcher used with grep to determine if a
system was using systemd? was failing on systems that did not exactly
match the old regex. This commit updates that communications test to use
a different method of determining if systemd is in use with the ps
command.
This commit is contained in:
Brian Cain 2018-02-08 15:50:59 -08:00
parent 0d0a7e5a40
commit b77171c4fc
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ module Vagrant
#
# @return [Boolean]
def systemd?(comm)
comm.test("systemctl | grep '^-\.mount'")
comm.test("ps -o comm= 1 | grep systemd")
end
# systemd-networkd.service is in use

View File

@ -65,7 +65,7 @@ describe "VagrantPlugins::GuestDebian::Cap::ConfigureNetworks" do
end
before do
allow(comm).to receive(:test).with("systemctl | grep '^-.mount'").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)
end
@ -83,7 +83,7 @@ describe "VagrantPlugins::GuestDebian::Cap::ConfigureNetworks" do
context "with systemd" do
before do
expect(comm).to receive(:test).with("systemctl | grep '^-.mount'").and_return(true)
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)
end