Move config module to python logging

This commit is contained in:
Sunil Mohan Adapa 2014-07-05 21:27:34 +02:00
parent ae02192009
commit 8d477fceb7

View File

@ -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