Merge pull request #9459 from briancain/9428/master/update-systemd-check

Update systemd? check for guest inspection
This commit is contained in:
Brian Cain 2018-02-14 08:50:27 -08:00 committed by GitHub
commit 8c15e1995b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -65,7 +65,7 @@ describe "VagrantPlugins::GuestDebian::Cap::ConfigureNetworks" do
end end
before do 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("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("netplan -h").and_return(false)
end end
@ -83,7 +83,7 @@ describe "VagrantPlugins::GuestDebian::Cap::ConfigureNetworks" do
context "with systemd" do context "with systemd" do
before 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) allow(comm).to receive(:test).with("netplan -h").and_return(false)
end end