mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
Move config module to python logging
This commit is contained in:
parent
ae02192009
commit
8d477fceb7
@ -25,6 +25,7 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
@ -33,6 +34,9 @@ import cfg
|
|||||||
import util
|
import util
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_hostname():
|
def get_hostname():
|
||||||
"""Return the hostname"""
|
"""Return the hostname"""
|
||||||
return socket.gethostname()
|
return socket.gethostname()
|
||||||
@ -155,11 +159,11 @@ def set_hostname(hostname):
|
|||||||
# valid_hostname check, convert to ASCII.
|
# valid_hostname check, convert to ASCII.
|
||||||
hostname = str(hostname)
|
hostname = str(hostname)
|
||||||
|
|
||||||
cfg.log.info("Changing hostname to '%s'" % hostname)
|
LOGGER.info('Changing hostname to - %s', hostname)
|
||||||
try:
|
try:
|
||||||
actions.superuser_run("xmpp-pre-hostname-change")
|
actions.superuser_run('xmpp-pre-hostname-change')
|
||||||
actions.superuser_run("hostname-change", hostname)
|
actions.superuser_run('hostname-change', hostname)
|
||||||
actions.superuser_run("xmpp-hostname-change", hostname, async=True)
|
actions.superuser_run('xmpp-hostname-change', hostname, async=True)
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user