]> git.ipfire.org Git - pakfire.git/commitdiff
Only load files with ".repo" extension from configuration dir.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Dec 2011 16:17:09 +0000 (17:17 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Dec 2011 16:17:09 +0000 (17:17 +0100)
That allows us to rename files that should not be loaded.

python/pakfire/config.py
python/pakfire/constants.py

index d3ce77af1b60c9b25eb2eb4f41134a98ec7b0f74..6fb9b298092f12a399488e100683d42ced599b58 100644 (file)
@@ -158,7 +158,15 @@ class Config(object):
                if not files:
                        # Return system configuration files
                        files += [CONFIG_FILE]
-                       files += [os.path.join(CONFIG_DIR, f) for f in os.listdir(CONFIG_DIR)]
+
+                       for f in os.listdir(CONFIG_DIR):
+                               # Skip all files with wrong extensions.
+                               if not f.endswith(CONFIG_DIR_EXT):
+                                       continue
+
+                               # Create absolute path.
+                               f = os.path.join(CONFIG_DIR, f)
+                               files.append(f)
 
                return files
 
index e396888bef4569431cc980b9f962867e2a29baef..305da5fcb7fe9d281b07613528a2eb8076e2c9be 100644 (file)
@@ -31,6 +31,7 @@ SYSCONFDIR = "/etc"
 SCRIPT_DIR = "/usr/lib/pakfire"
 
 CONFIG_DIR = os.path.join(SYSCONFDIR, "pakfire.repos.d")
+CONFIG_DIR_EXT = ".repo"
 CONFIG_FILE = os.path.join(SYSCONFDIR, "pakfire.conf")
 
 CACHE_DIR = "/var/cache/pakfire"