]> git.decadent.org.uk Git - dak.git/commitdiff
which_conf_file
authorJoerg Jaspert <joerg@debian.org>
Sun, 19 Apr 2009 16:37:46 +0000 (18:37 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sun, 19 Apr 2009 16:37:46 +0000 (18:37 +0200)
if local config files are allowed, return the path for them, in case
one exists.
if not just behave as usual.

Signed-off-by: Joerg Jaspert <joerg@debian.org>
daklib/utils.py

index 651e13ae7b6ac507ef468bda804df4f047a0b51c..cb7efbea9c313767f5b98923bd89efdfce4bca04 100755 (executable)
@@ -745,6 +745,15 @@ def where_am_i ():
 
 def which_conf_file ():
     res = socket.gethostbyaddr(socket.gethostname())
+    # In case we allow local config files per user, try if one exists
+    if Cnf.FindB("Config::" + res[0] + "::AllowLocalConfig"):
+        homedir = os.getenv("HOME")
+        confpath = os.path.join(homedir, "/etc/dak.conf")
+        if os.path.exists(confpath):
+            return confpath
+
+    # We are still in here, so there is no local config file or we do
+    # not allow local files. Do the normal stuff.
     if Cnf.get("Config::" + res[0] + "::DakConfig"):
         return Cnf["Config::" + res[0] + "::DakConfig"]
     else: