From a1bb7b837a1adfdcd8f1be94c76d4a00bbbd80d4 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Wed, 24 Oct 2018 15:27:33 -0700 Subject: [PATCH] Use semicolon over ampersand to separate commands --- plugins/guests/debian/cap/change_host_name.rb | 4 ++-- .../guests/debian/cap/change_host_name_test.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/guests/debian/cap/change_host_name.rb b/plugins/guests/debian/cap/change_host_name.rb index 2db5355cd..b64c236f8 100644 --- a/plugins/guests/debian/cap/change_host_name.rb +++ b/plugins/guests/debian/cap/change_host_name.rb @@ -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 diff --git a/test/unit/plugins/guests/debian/cap/change_host_name_test.rb b/test/unit/plugins/guests/debian/cap/change_host_name_test.rb index 6beff6451..1c05625d5 100644 --- a/test/unit/plugins/guests/debian/cap/change_host_name_test.rb +++ b/test/unit/plugins/guests/debian/cap/change_host_name_test.rb @@ -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