From b6aebeacae8eb4c35970700d328a85d64e0c4ab1 Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 16 Sep 2020 10:36:45 -0500 Subject: [PATCH] Use '-r' xargs argument This will pervent running sed if there are no results passed to xargs --- plugins/guests/redhat/cap/change_host_name.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb index 16b76110d..44a9dd89f 100644 --- a/plugins/guests/redhat/cap/change_host_name.rb +++ b/plugins/guests/redhat/cap/change_host_name.rb @@ -19,7 +19,7 @@ module VagrantPlugins sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network fi # Update DNS - find /etc/sysconfig/network-scripts -maxdepth 1 -type f -name 'ifcfg-*' | xargs sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/' + find /etc/sysconfig/network-scripts -maxdepth 1 -type f -name 'ifcfg-*' | xargs -r sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/' # Set the hostname - use hostnamectl if available echo '#{name}' > /etc/hostname EOH