Merge pull request #9265 from trombik/atomic_interface_restart

Atomically apply new hostname.if(5)
This commit is contained in:
Brian Cain 2018-02-09 14:27:07 -08:00 committed by GitHub
commit a1932b8d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -36,15 +36,8 @@ module VagrantPlugins
machine.communicate.sudo("mv /tmp/vagrant-network-entry /etc/hostname.#{ifname}")
# remove old configurations
machine.communicate.sudo("sudo ifconfig #{ifname} inet delete", { error_check: false })
machine.communicate.sudo("pkill -f 'dhclient: #{ifname}'", { error_check: false })
if network[:type].to_sym == :static
machine.communicate.sudo("ifconfig #{ifname} inet #{network[:ip]} netmask #{network[:netmask]}")
elsif network[:type].to_sym == :dhcp
machine.communicate.sudo("dhclient #{ifname}")
end
# apply new configurations
machine.communicate.sudo("sh /etc/netstart #{ifname}")
end
end
end