From: Michael Tremer Date: Thu, 8 Dec 2011 16:17:09 +0000 (+0100) Subject: Only load files with ".repo" extension from configuration dir. X-Git-Tag: 0.9.19~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c3f6dcb6ddaab6cec57fb596b8e033f280e9f1a;p=pakfire.git Only load files with ".repo" extension from configuration dir. That allows us to rename files that should not be loaded. --- diff --git a/python/pakfire/config.py b/python/pakfire/config.py index d3ce77af1..6fb9b2980 100644 --- a/python/pakfire/config.py +++ b/python/pakfire/config.py @@ -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 diff --git a/python/pakfire/constants.py b/python/pakfire/constants.py index e396888be..305da5fcb 100644 --- a/python/pakfire/constants.py +++ b/python/pakfire/constants.py @@ -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"