Use semicolon over ampersand to separate commands

This commit is contained in:
Brian Cain 2018-10-24 15:27:33 -07:00
parent e8c6916ebc
commit a1bb7b837a
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 8 additions and 8 deletions

View File

@ -92,9 +92,9 @@ module VagrantPlugins
interfaces.each do |iface|
logger.debug("Restarting interface #{iface} on guest #{machine.name}")
if nettools
restart_command = "ifdown #{iface} && ifup #{iface}"
restart_command = "ifdown #{iface};ifup #{iface}"
else
restart_command = "systemctl stop ifup@#{iface}.service && systemctl start ifup@#{iface}.service"
restart_command = "systemctl stop ifup@#{iface}.service;systemctl start ifup@#{iface}.service"
end
comm.sudo(restart_command)
end

View File

@ -136,18 +136,18 @@ describe "VagrantPlugins::GuestDebian::Cap::ChangeHostName" do
it "restarts every interface" do
cap.send(:restart_each_interface, machine, logger)
expect(comm.received_commands[0]).to match(/ifdown eth0 && ifup eth0/)
expect(comm.received_commands[1]).to match(/ifdown eth1 && ifup eth1/)
expect(comm.received_commands[2]).to match(/ifdown eth2 && ifup eth2/)
expect(comm.received_commands[0]).to match(/ifdown eth0;ifup eth0/)
expect(comm.received_commands[1]).to match(/ifdown eth1;ifup eth1/)
expect(comm.received_commands[2]).to match(/ifdown eth2;ifup eth2/)
end
end
context "with systemctl" do
it "restarts every interface" do
cap.send(:restart_each_interface, machine, logger)
expect(comm.received_commands[0]).to match(/systemctl stop ifup@eth0.service && systemctl start ifup@eth0.service/)
expect(comm.received_commands[1]).to match(/systemctl stop ifup@eth1.service && systemctl start ifup@eth1.service/)
expect(comm.received_commands[2]).to match(/systemctl stop ifup@eth2.service && systemctl start ifup@eth2.service/)
expect(comm.received_commands[0]).to match(/systemctl stop ifup@eth0.service;systemctl start ifup@eth0.service/)
expect(comm.received_commands[1]).to match(/systemctl stop ifup@eth1.service;systemctl start ifup@eth1.service/)
expect(comm.received_commands[2]).to match(/systemctl stop ifup@eth2.service;systemctl start ifup@eth2.service/)
end
end
end