From 27cdadbc763a3ad953af45b6c7b126b0cc503703 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 2 Sep 2014 14:47:35 +0530 Subject: [PATCH] Log a message showing the config file used --- plinth/__main__.py | 3 ++- plinth/cfg.py | 10 ++++++---- setup.py | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index 9fee788c3..09dff24f3 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -7,7 +7,6 @@ import django.core.wsgi import logging import os import stat -import sys import cherrypy from cherrypy import _cpserver @@ -219,6 +218,8 @@ def main(): configure_django() + LOGGER.info('Configuration loaded from file - %s', cfg.CONFIG_FILE) + module_loader.load_modules() setup_server() diff --git a/plinth/cfg.py b/plinth/cfg.py index 54b801ea7..12a620fae 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -1,4 +1,4 @@ -from menu import Menu +from plinth.menu import Menu import os import ConfigParser @@ -23,25 +23,27 @@ server_dir = '/' main_menu = Menu() +CONFIG_FILE = None DEFAULT_CONFIG_FILE = '/etc/plinth/plinth.config' DEFAULT_ROOT = '/' def read(): """Read configuration""" + global CONFIG_FILE # pylint: disable-msg=W0603 if os.path.isfile(DEFAULT_CONFIG_FILE): - config_file = DEFAULT_CONFIG_FILE + CONFIG_FILE = DEFAULT_CONFIG_FILE directory = DEFAULT_ROOT else: directory = os.path.dirname(os.path.realpath(__file__)) directory = os.path.join(directory, '..') - config_file = os.path.join(directory, 'plinth.config') + CONFIG_FILE = os.path.join(directory, 'plinth.config') parser = SafeConfigParser( defaults={ 'root': os.path.realpath(directory), }) - parser.read(config_file) + parser.read(CONFIG_FILE) config_items = {('Name', 'product_name'), ('Name', 'box_name'), diff --git a/setup.py b/setup.py index 823f6db00..41967fad5 100755 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ DIRECTORIES_TO_COPY = [ ('/usr/share/doc/plinth/', 'doc'), ] + class CustomInstallData(install_data): """Override install command to allow directory creation and copy""" def run(self):