Change first_boot module to show and update current hostname,

instead of showing the box_name value and failing to set anything
when the user specify a host name value.
This commit is contained in:
Petter Reinholdtsen committed 2013-09-11 14:04:34 +02:00
1 parent ec9a457e3e
commit 71873b6702
2 files changed
+15 -20

No files matched your search

+4 -1
View File
@@ -40,6 +40,9 @@ def valid_hostname(name):
return message
def get_hostname():
return gethostname()
def set_hostname(hostname):
"Sets machine hostname to hostname"
cfg.log.info("Writing '%s' to /etc/hostname with exmachina" % hostname)
@@ -53,7 +56,7 @@ def set_hostname(hostname):
if platform.linux_distribution()[0]=="Ubuntu" :
cfg.exmachina.service.start("hostname")
else:
cfg.exmachina.initd.restart("hostname.sh") # is hostname.sh debian-only?
cfg.exmachina.initd.start("hostname.sh") # is hostname.sh debian-only?
except OSError, e:
raise cherrypy.HTTPError(500, "Hostname restart failed: %s" % e)