]> git.ipfire.org Git - people/jschlag/pbs.git/commitdiff
Always load default configuration file
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Oct 2017 11:22:32 +0000 (12:22 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 7 Oct 2017 11:27:13 +0000 (12:27 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/__init__.py
src/hub/__init__.py
src/web/__init__.py

index d82cae1e526947c5e2f4c2b7a79d8f3ea5c40e00..3e8843e1cfae01644fa7fa3da6c242e135e0dc98 100644 (file)
@@ -28,6 +28,9 @@ from . import updates
 from . import uploads
 from . import users
 
+log = logging.getLogger("backend")
+log.propagate = 1
+
 # Import version
 from .__version__ import VERSION as __version__
 
@@ -35,7 +38,7 @@ from .decorators import *
 from .constants import *
 
 class Backend(object):
-       def __init__(self, config_file="pbs.conf"):
+       def __init__(self, config_file=None):
                # Read configuration file.
                self.config = self.read_config(config_file)
 
@@ -68,7 +71,19 @@ class Backend(object):
 
        def read_config(self, path):
                c = ConfigParser.SafeConfigParser()
-               c.read(path)
+
+               # Load default configuration file first
+               paths = [
+                       os.path.join(CONFIGSDIR, "pbs.conf"),
+               ]
+
+               if path:
+                       paths.append(path)
+
+               # Load all configuration files
+               for path in paths:
+                       log.debug("Loading configuration from %s" % path)
+                       c.read(path)
 
                return c
 
index 0c722a3d46611a7a48902105d5d154e819c0f8dd..0b2e624763f01e51e5f85004d94997ba39c7287c 100644 (file)
@@ -79,9 +79,7 @@ class Application(tornado.web.Application):
        @property
        def pakfire(self):
                if self.__pakfire is None:
-                       config_file = os.path.join(BASEDIR, "..", "pbs.conf")
-
-                       self.__pakfire = Backend(config_file=config_file)
+                       self.__pakfire = Backend()
 
                return self.__pakfire
 
index c34ec552a3785a6d8a744e09269193252ee48f44..82f9fb3c635cca7c3119ecdc05e07fe3876214fe 100644 (file)
@@ -260,9 +260,7 @@ class Application(tornado.web.Application):
        @property
        def pakfire(self):
                if self.__pakfire is None:
-                       config_file = os.path.join(BASEDIR, "..", "pbs.conf")
-
-                       self.__pakfire = Backend(config_file=config_file)
+                       self.__pakfire = Backend()
 
                return self.__pakfire