2013-04-04 06:53:17 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestUbuntu
|
|
|
|
module Cap
|
2013-11-23 23:48:00 +00:00
|
|
|
class ChangeHostName < VagrantPlugins::GuestDebian::Cap::ChangeHostName
|
2013-04-04 06:53:17 +00:00
|
|
|
def self.change_host_name(machine, name)
|
2013-11-23 23:48:00 +00:00
|
|
|
super
|
|
|
|
end
|
2013-09-22 07:33:24 +00:00
|
|
|
|
2013-11-23 23:48:00 +00:00
|
|
|
def refresh_hostname_service
|
|
|
|
if hardy?
|
|
|
|
# hostname.sh returns 1, so use `true` to get a 0 exitcode
|
|
|
|
sudo("/etc/init.d/hostname.sh start; true")
|
|
|
|
else
|
|
|
|
sudo("service hostname start")
|
|
|
|
end
|
|
|
|
end
|
2013-09-22 07:33:24 +00:00
|
|
|
|
2013-11-23 23:48:00 +00:00
|
|
|
def hardy?
|
|
|
|
machine.communicate.test("[ `lsb_release -c -s` = hardy ]")
|
|
|
|
end
|
2013-09-22 07:33:24 +00:00
|
|
|
|
2013-11-23 23:48:00 +00:00
|
|
|
def renew_dhcp
|
|
|
|
sudo("ifdown -a; ifup -a; ifup -a --allow=hotplug")
|
2013-04-04 06:53:17 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|