diff --git a/modules/config/config.py b/modules/config/config.py index 7095414cf..4aa6f299e 100644 --- a/modules/config/config.py +++ b/modules/config/config.py @@ -25,6 +25,7 @@ from django.contrib.auth.decorators import login_required from django.core import validators from django.template.response import TemplateResponse from gettext import gettext as _ +import logging import re import socket @@ -33,6 +34,9 @@ import cfg import util +LOGGER = logging.getLogger(__name__) + + def get_hostname(): """Return the hostname""" return socket.gethostname() @@ -155,11 +159,11 @@ def set_hostname(hostname): # valid_hostname check, convert to ASCII. hostname = str(hostname) - cfg.log.info("Changing hostname to '%s'" % hostname) + LOGGER.info('Changing hostname to - %s', hostname) try: - actions.superuser_run("xmpp-pre-hostname-change") - actions.superuser_run("hostname-change", hostname) - actions.superuser_run("xmpp-hostname-change", hostname, async=True) + actions.superuser_run('xmpp-pre-hostname-change') + actions.superuser_run('hostname-change', hostname) + actions.superuser_run('xmpp-hostname-change', hostname, async=True) except OSError: return False