mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Merge pull request #86 from SunilMohanAdapa/python-logging
Python logging
This commit is contained in:
commit
a8ed02b723
40
logger.py
40
logger.py
@ -1,40 +0,0 @@
|
|||||||
import cherrypy
|
|
||||||
import inspect
|
|
||||||
import cfg
|
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
"""Initialize logging"""
|
|
||||||
cherrypy.log.error_file = cfg.status_log_file
|
|
||||||
cherrypy.log.access_file = cfg.access_log_file
|
|
||||||
if not cfg.no_daemon:
|
|
||||||
cherrypy.log.screen = False
|
|
||||||
|
|
||||||
|
|
||||||
class Logger(object):
|
|
||||||
"""By convention, log levels are DEBUG, INFO, WARNING, ERROR and CRITICAL."""
|
|
||||||
def log(self, msg, level="DEBUG"):
|
|
||||||
cherrypy.log.error("%s %s" % (level, msg), inspect.stack()[2][3], 20)
|
|
||||||
def __call__(self, *args):
|
|
||||||
self.log(*args)
|
|
||||||
|
|
||||||
def debug(self, msg):
|
|
||||||
self.log(msg)
|
|
||||||
|
|
||||||
def info(self, msg):
|
|
||||||
self.log(msg, "INFO")
|
|
||||||
|
|
||||||
def warn(self, msg):
|
|
||||||
self.log(msg, "WARNING")
|
|
||||||
|
|
||||||
def warning(self, msg):
|
|
||||||
self.log(msg, "WARNING")
|
|
||||||
|
|
||||||
def error(self, msg):
|
|
||||||
self.log(msg, "ERROR")
|
|
||||||
|
|
||||||
def err(self, msg):
|
|
||||||
self.error(msg)
|
|
||||||
|
|
||||||
def critical(self, msg):
|
|
||||||
self.log(msg, "CRITICAL")
|
|
||||||
@ -21,11 +21,13 @@ Discover, load and manage Plinth modules
|
|||||||
|
|
||||||
import django
|
import django
|
||||||
import importlib
|
import importlib
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import cfg
|
|
||||||
import urls
|
import urls
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def load_modules():
|
def load_modules():
|
||||||
"""
|
"""
|
||||||
@ -37,15 +39,14 @@ def load_modules():
|
|||||||
for name in os.listdir('modules/enabled'):
|
for name in os.listdir('modules/enabled'):
|
||||||
full_name = 'modules.{module}'.format(module=name)
|
full_name = 'modules.{module}'.format(module=name)
|
||||||
|
|
||||||
cfg.log.info('Importing {full_name}'.format(full_name=full_name))
|
LOGGER.info('Importing %s', full_name)
|
||||||
try:
|
try:
|
||||||
module = importlib.import_module(full_name)
|
module = importlib.import_module(full_name)
|
||||||
modules[name] = module
|
modules[name] = module
|
||||||
module_names.append(name)
|
module_names.append(name)
|
||||||
except ImportError as exception:
|
except Exception as exception:
|
||||||
cfg.log.error(
|
LOGGER.exception('Could not import modules/%s: %s',
|
||||||
'Could not import modules/{module}: {exception}'
|
name, exception)
|
||||||
.format(module=name, exception=exception))
|
|
||||||
|
|
||||||
_include_module_urls(full_name)
|
_include_module_urls(full_name)
|
||||||
|
|
||||||
@ -60,10 +61,10 @@ def load_modules():
|
|||||||
_insert_modules(module_name, module, remaining_modules,
|
_insert_modules(module_name, module, remaining_modules,
|
||||||
ordered_modules)
|
ordered_modules)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
cfg.log.error('Unsatified dependency for module - %s' %
|
LOGGER.error('Unsatified dependency for module - %s',
|
||||||
(module_name,))
|
module_name)
|
||||||
|
|
||||||
cfg.log.debug('Module load order - %s' % ordered_modules)
|
LOGGER.debug('Module load order - %s', ordered_modules)
|
||||||
|
|
||||||
for module_name in ordered_modules:
|
for module_name in ordered_modules:
|
||||||
_initialize_module(modules[module_name])
|
_initialize_module(modules[module_name])
|
||||||
@ -87,8 +88,8 @@ def _insert_modules(module_name, module, remaining_modules, ordered_modules):
|
|||||||
try:
|
try:
|
||||||
module = remaining_modules.pop(dependency)
|
module = remaining_modules.pop(dependency)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
cfg.log.error('Not found or circular dependency - %s, %s' %
|
LOGGER.error('Not found or circular dependency - %s, %s',
|
||||||
(module_name, dependency))
|
module_name, dependency)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
_insert_modules(dependency, module, remaining_modules, ordered_modules)
|
_insert_modules(dependency, module, remaining_modules, ordered_modules)
|
||||||
@ -104,7 +105,7 @@ def _include_module_urls(module_name):
|
|||||||
'', django.conf.urls.url(
|
'', django.conf.urls.url(
|
||||||
r'', django.conf.urls.include(url_module)))
|
r'', django.conf.urls.include(url_module)))
|
||||||
except ImportError:
|
except ImportError:
|
||||||
cfg.log.debug('No URLs for {module}'.format(module=module_name))
|
LOGGER.debug('No URLs for %s', module_name)
|
||||||
|
|
||||||
|
|
||||||
def _initialize_module(module):
|
def _initialize_module(module):
|
||||||
@ -112,15 +113,14 @@ def _initialize_module(module):
|
|||||||
try:
|
try:
|
||||||
init = module.init
|
init = module.init
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
cfg.log.debug('No init() for module - {module}'
|
LOGGER.debug('No init() for module - %s', module.__name__)
|
||||||
.format(module=module.__name__))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
init()
|
init()
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
cfg.log.error('Exception while running init for {module}: {exception}'
|
LOGGER.exception('Exception while running init for %s: %s',
|
||||||
.format(module=module, exception=exception))
|
module, exception)
|
||||||
|
|
||||||
|
|
||||||
def get_template_directories():
|
def get_template_directories():
|
||||||
@ -132,6 +132,4 @@ def get_template_directories():
|
|||||||
for name in os.listdir('modules/enabled'):
|
for name in os.listdir('modules/enabled'):
|
||||||
directories.add(os.path.join('modules', name, 'templates'))
|
directories.add(os.path.join('modules', name, 'templates'))
|
||||||
|
|
||||||
cfg.log.info('Template directories - %s' % directories)
|
|
||||||
|
|
||||||
return directories
|
return directories
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -22,12 +22,16 @@ Plinth module to configure a firewall
|
|||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
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 actions
|
import actions
|
||||||
import cfg
|
import cfg
|
||||||
import service as service_module
|
import service as service_module
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initailze firewall module"""
|
"""Initailze firewall module"""
|
||||||
menu = cfg.main_menu.find('/sys')
|
menu = cfg.main_menu.find('/sys')
|
||||||
@ -99,7 +103,7 @@ def on_service_enabled(sender, service_id, enabled, **kwargs):
|
|||||||
internal_enabled_services = get_enabled_services(zone='internal')
|
internal_enabled_services = get_enabled_services(zone='internal')
|
||||||
external_enabled_services = get_enabled_services(zone='external')
|
external_enabled_services = get_enabled_services(zone='external')
|
||||||
|
|
||||||
cfg.log.info('Service enabled - %s, %s' % (service_id, enabled))
|
LOGGER.info('Service enabled - %s, %s', service_id, enabled)
|
||||||
service = service_module.SERVICES[service_id]
|
service = service_module.SERVICES[service_id]
|
||||||
for port in service.ports:
|
for port in service.ports:
|
||||||
if enabled:
|
if enabled:
|
||||||
@ -137,8 +141,7 @@ def _run(arguments, superuser=False):
|
|||||||
"""Run an given command and raise exception if there was an error"""
|
"""Run an given command and raise exception if there was an error"""
|
||||||
command = 'firewall'
|
command = 'firewall'
|
||||||
|
|
||||||
cfg.log.info('Running command - %s, %s, %s' % (command, arguments,
|
LOGGER.info('Running command - %s, %s, %s', command, arguments, superuser)
|
||||||
superuser))
|
|
||||||
|
|
||||||
if superuser:
|
if superuser:
|
||||||
output, error = actions.superuser_run(command, arguments)
|
output, error = actions.superuser_run(command, arguments)
|
||||||
|
|||||||
@ -27,11 +27,15 @@ from django.template import RequestContext
|
|||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
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 actions
|
import actions
|
||||||
import cfg
|
import cfg
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Intialize the PageKite module"""
|
"""Intialize the PageKite module"""
|
||||||
menu = cfg.main_menu.find('/apps')
|
menu = cfg.main_menu.find('/apps')
|
||||||
@ -130,7 +134,6 @@ def get_status():
|
|||||||
|
|
||||||
# Check if PageKite is installed
|
# Check if PageKite is installed
|
||||||
output = _run(['get-installed'])
|
output = _run(['get-installed'])
|
||||||
cfg.log('Output - %s' % output)
|
|
||||||
if output.split()[0] != 'installed':
|
if output.split()[0] != 'installed':
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -155,7 +158,7 @@ def get_status():
|
|||||||
|
|
||||||
def _apply_changes(request, old_status, new_status):
|
def _apply_changes(request, old_status, new_status):
|
||||||
"""Apply the changes to PageKite configuration"""
|
"""Apply the changes to PageKite configuration"""
|
||||||
cfg.log.info('New status is - %s' % new_status)
|
LOGGER.info('New status is - %s', new_status)
|
||||||
|
|
||||||
if old_status != new_status:
|
if old_status != new_status:
|
||||||
_run(['stop'])
|
_run(['stop'])
|
||||||
@ -194,8 +197,7 @@ def _run(arguments, superuser=True):
|
|||||||
"""Run an given command and raise exception if there was an error"""
|
"""Run an given command and raise exception if there was an error"""
|
||||||
command = 'pagekite-configure'
|
command = 'pagekite-configure'
|
||||||
|
|
||||||
cfg.log.info('Running command - %s, %s, %s' % (command, arguments,
|
LOGGER.info('Running command - %s, %s, %s', command, arguments, superuser)
|
||||||
superuser))
|
|
||||||
|
|
||||||
if superuser:
|
if superuser:
|
||||||
output, error = actions.superuser_run(command, arguments)
|
output, error = actions.superuser_run(command, arguments)
|
||||||
|
|||||||
@ -7,11 +7,15 @@ from django.template import RequestContext
|
|||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
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 cfg
|
import cfg
|
||||||
from ..lib.auth import add_user
|
from ..lib.auth import add_user
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Intialize the module"""
|
"""Intialize the module"""
|
||||||
menu = cfg.main_menu.find('/sys')
|
menu = cfg.main_menu.find('/sys')
|
||||||
@ -128,8 +132,7 @@ def _apply_edit_changes(request, data):
|
|||||||
username = field.split('delete_user_')[1]
|
username = field.split('delete_user_')[1]
|
||||||
|
|
||||||
requesting_user = request.user.username
|
requesting_user = request.user.username
|
||||||
cfg.log.info('%s asked to delete %s' %
|
LOGGER.info('%s asked to delete %s', requesting_user, username)
|
||||||
(requesting_user, username))
|
|
||||||
|
|
||||||
if username == requesting_user:
|
if username == requesting_user:
|
||||||
messages.error(
|
messages.error(
|
||||||
|
|||||||
@ -5,12 +5,15 @@ from django.template import RequestContext
|
|||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
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 actions
|
import actions
|
||||||
import cfg
|
import cfg
|
||||||
import service
|
import service
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SIDE_MENU = {'title': _('XMPP'),
|
SIDE_MENU = {'title': _('XMPP'),
|
||||||
'items': [{'url': '/apps/xmpp/configure',
|
'items': [{'url': '/apps/xmpp/configure',
|
||||||
'text': 'Configure XMPP Server'},
|
'text': 'Configure XMPP Server'},
|
||||||
@ -94,7 +97,7 @@ def get_status():
|
|||||||
|
|
||||||
def _apply_changes(request, old_status, new_status):
|
def _apply_changes(request, old_status, new_status):
|
||||||
"""Apply the form changes"""
|
"""Apply the form changes"""
|
||||||
cfg.log.info('Status - %s, %s' % (old_status, new_status))
|
LOGGER.info('Status - %s, %s', old_status, new_status)
|
||||||
|
|
||||||
if old_status['inband_enabled'] == new_status['inband_enabled']:
|
if old_status['inband_enabled'] == new_status['inband_enabled']:
|
||||||
messages.info(request, _('Setting unchanged'))
|
messages.info(request, _('Setting unchanged'))
|
||||||
@ -107,7 +110,7 @@ def _apply_changes(request, old_status, new_status):
|
|||||||
messages.success(request, _('Inband registration disabled'))
|
messages.success(request, _('Inband registration disabled'))
|
||||||
option = 'noinband_enable'
|
option = 'noinband_enable'
|
||||||
|
|
||||||
cfg.log.info('Option - %s' % option)
|
LOGGER.info('Option - %s', option)
|
||||||
|
|
||||||
_output, error = actions.superuser_run('xmpp-setup', [option])
|
_output, error = actions.superuser_run('xmpp-setup', [option])
|
||||||
del _output # Unused
|
del _output # Unused
|
||||||
|
|||||||
49
plinth.py
49
plinth.py
@ -4,6 +4,7 @@ import argparse
|
|||||||
import django.conf
|
import django.conf
|
||||||
import django.core.management
|
import django.core.management
|
||||||
import django.core.wsgi
|
import django.core.wsgi
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import stat
|
import stat
|
||||||
import sys
|
import sys
|
||||||
@ -16,9 +17,6 @@ import cfg
|
|||||||
import module_loader
|
import module_loader
|
||||||
import service
|
import service
|
||||||
|
|
||||||
import logger
|
|
||||||
from logger import Logger
|
|
||||||
|
|
||||||
__version__ = "0.2.14"
|
__version__ = "0.2.14"
|
||||||
__author__ = "James Vasile"
|
__author__ = "James Vasile"
|
||||||
__copyright__ = "Copyright 2011-2013, James Vasile"
|
__copyright__ = "Copyright 2011-2013, James Vasile"
|
||||||
@ -27,6 +25,8 @@ __maintainer__ = "James Vasile"
|
|||||||
__email__ = "james@jamesvasile.com"
|
__email__ = "james@jamesvasile.com"
|
||||||
__status__ = "Development"
|
__status__ = "Development"
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
"""Parse command line arguments"""
|
"""Parse command line arguments"""
|
||||||
@ -54,8 +54,13 @@ def parse_arguments():
|
|||||||
|
|
||||||
def setup_logging():
|
def setup_logging():
|
||||||
"""Setup logging framework"""
|
"""Setup logging framework"""
|
||||||
cfg.log = Logger()
|
# Don't propagate cherrypy log messages to root logger
|
||||||
logger.init()
|
logging.getLogger('cherrypy').propagate = False
|
||||||
|
|
||||||
|
cherrypy.log.error_file = cfg.status_log_file
|
||||||
|
cherrypy.log.access_file = cfg.access_log_file
|
||||||
|
if not cfg.no_daemon:
|
||||||
|
cherrypy.log.screen = False
|
||||||
|
|
||||||
|
|
||||||
def setup_paths():
|
def setup_paths():
|
||||||
@ -67,6 +72,8 @@ def setup_paths():
|
|||||||
|
|
||||||
def setup_server():
|
def setup_server():
|
||||||
"""Setup CherryPy server"""
|
"""Setup CherryPy server"""
|
||||||
|
LOGGER.info('Setting up CherryPy server')
|
||||||
|
|
||||||
# Set the PID file path
|
# Set the PID file path
|
||||||
try:
|
try:
|
||||||
if cfg.pidfile:
|
if cfg.pidfile:
|
||||||
@ -129,6 +136,32 @@ def configure_django():
|
|||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'plinth.context_processor']
|
'plinth.context_processor']
|
||||||
|
|
||||||
|
logging_configuration = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': False,
|
||||||
|
'formatters': {
|
||||||
|
'default': {
|
||||||
|
'format':
|
||||||
|
'[%(asctime)s] %(name)-14s %(levelname)-8s %(message)s',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'handlers': {
|
||||||
|
'file': {
|
||||||
|
'class': 'logging.FileHandler',
|
||||||
|
'filename': cfg.status_log_file,
|
||||||
|
'formatter': 'default'
|
||||||
|
},
|
||||||
|
'console': {
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
'formatter': 'default'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'root': {
|
||||||
|
'handlers': ['console', 'file'],
|
||||||
|
'level': 'DEBUG' if cfg.debug else 'INFO'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data_file = os.path.join(cfg.data_dir, 'plinth.sqlite3')
|
data_file = os.path.join(cfg.data_dir, 'plinth.sqlite3')
|
||||||
|
|
||||||
template_directories = module_loader.get_template_directories()
|
template_directories = module_loader.get_template_directories()
|
||||||
@ -145,6 +178,7 @@ def configure_django():
|
|||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.messages'],
|
'django.contrib.messages'],
|
||||||
|
LOGGING=logging_configuration,
|
||||||
LOGIN_URL=cfg.server_dir + '/accounts/login/',
|
LOGIN_URL=cfg.server_dir + '/accounts/login/',
|
||||||
LOGIN_REDIRECT_URL=cfg.server_dir + '/',
|
LOGIN_REDIRECT_URL=cfg.server_dir + '/',
|
||||||
LOGOUT_URL=cfg.server_dir + '/accounts/logout/',
|
LOGOUT_URL=cfg.server_dir + '/accounts/logout/',
|
||||||
@ -155,8 +189,11 @@ def configure_django():
|
|||||||
TEMPLATE_CONTEXT_PROCESSORS=context_processors,
|
TEMPLATE_CONTEXT_PROCESSORS=context_processors,
|
||||||
TEMPLATE_DIRS=template_directories)
|
TEMPLATE_DIRS=template_directories)
|
||||||
|
|
||||||
|
LOGGER.info('Configured Django')
|
||||||
|
LOGGER.info('Template directories - %s', template_directories)
|
||||||
|
|
||||||
if not os.path.isfile(data_file):
|
if not os.path.isfile(data_file):
|
||||||
cfg.log.info('Creating and initializing data file')
|
LOGGER.info('Creating and initializing data file')
|
||||||
django.core.management.call_command('syncdb', interactive=False)
|
django.core.management.call_command('syncdb', interactive=False)
|
||||||
os.chmod(data_file, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
|
os.chmod(data_file, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
|
||||||
|
|
||||||
|
|||||||
6
views.py
6
views.py
@ -20,11 +20,15 @@ Main Plinth views
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django.http.response import HttpResponseRedirect
|
from django.http.response import HttpResponseRedirect
|
||||||
|
import logging
|
||||||
|
|
||||||
import cfg
|
import cfg
|
||||||
from withsqlite.withsqlite import sqlite_db
|
from withsqlite.withsqlite import sqlite_db
|
||||||
|
|
||||||
|
|
||||||
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Serve the main index page"""
|
"""Serve the main index page"""
|
||||||
# TODO: Move firstboot handling to firstboot module somehow
|
# TODO: Move firstboot handling to firstboot module somehow
|
||||||
@ -36,7 +40,7 @@ def index(request):
|
|||||||
return HttpResponseRedirect(cfg.server_dir + '/firstboot')
|
return HttpResponseRedirect(cfg.server_dir + '/firstboot')
|
||||||
|
|
||||||
if database['state'] < 5:
|
if database['state'] < 5:
|
||||||
cfg.log('First boot state = %d' % database['state'])
|
LOGGER.info('First boot state - %d', database['state'])
|
||||||
return HttpResponseRedirect(
|
return HttpResponseRedirect(
|
||||||
cfg.server_dir + '/firstboot/state%d' % database['state'])
|
cfg.server_dir + '/firstboot/state%d' % database['state'])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user