From 94954739b53ee4c6741a35c366c2fe5c9853e0ed Mon Sep 17 00:00:00 2001 From: Joe Doss Date: Mon, 17 Sep 2018 14:30:57 -0500 Subject: [PATCH] Simplified if statements. --- plugins/guests/redhat/cap/change_host_name.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb index 8f3265003..e9c0b1d80 100644 --- a/plugins/guests/redhat/cap/change_host_name.rb +++ b/plugins/guests/redhat/cap/change_host_name.rb @@ -29,9 +29,9 @@ module VagrantPlugins } # Restart network - if (test -f /etc/init.d/network && /etc/init.d/network status &> /dev/null ); then + if test -f /etc/init.d/network; then service network restart - elif (test -f /usr/lib/systemd/system/NetworkManager.service && systemctl is-enabled NetworkManager.service &> /dev/null ); then + elif systemctl -q is-enabled NetworkManager.service; then systemctl restart NetworkManager.service else printf "Could not restart the network to set the new hostname!\n"