Merge pull request #9265 from trombik/atomic_interface_restart
Atomically apply new hostname.if(5)
This commit is contained in:
commit
a1932b8d21
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue