From b54a4906e67e6e35a571c754865c1a517722674f Mon Sep 17 00:00:00 2001 From: Tom Galloway Date: Thu, 10 Jan 2013 09:15:31 +0000 Subject: [PATCH] Fix to allow hostname to be updated on Ubuntu. This needed a change to exmachina which I've created a pull request for. I've updated Make to point to my fork of exmachina until this has been merged, when it can be reverted. --- Makefile | 2 +- modules/installed/system/config.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 40460de7a..72d916965 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ predepend: touch predepend $(BUILD_DIR)/exmachina: build - git clone git://github.com/bnewbold/exmachina $(BUILD_DIR)/exmachina + git clone git://github.com/tomgalloway/exmachina $(BUILD_DIR)/exmachina $(BUILD_DIR)/bjsonrpc: build git clone git://github.com/deavid/bjsonrpc.git $(BUILD_DIR)/bjsonrpc diff --git a/modules/installed/system/config.py b/modules/installed/system/config.py index 01c4ec693..b671fcc12 100644 --- a/modules/installed/system/config.py +++ b/modules/installed/system/config.py @@ -10,6 +10,7 @@ import cfg from forms import Form from model import User from util import * +import platform class Config(PagePlugin): def __init__(self, *args, **kwargs): @@ -49,7 +50,10 @@ def set_hostname(hostname): # don't persist/cache change unless it was saved successfuly sys_store = filedict_con(cfg.store_file, 'sys') sys_store['hostname'] = hostname - cfg.exmachina.initd.restart("hostname.sh") # is hostname.sh debian-only? + if platform.linux_distribution()[0]=="Ubuntu" : + cfg.exmachina.service.start("hostname") + else: + cfg.exmachina.initd.restart("hostname.sh") # is hostname.sh debian-only? except OSError, e: raise cherrypy.HTTPError(500, "Hostname restart failed: %s" % e)