From 6c3f6dcb6ddaab6cec57fb596b8e033f280e9f1a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 8 Dec 2011 17:17:09 +0100 Subject: [PATCH] Only load files with ".repo" extension from configuration dir. That allows us to rename files that should not be loaded. --- python/pakfire/config.py | 10 +++++++++- python/pakfire/constants.py | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) 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" -- 2.39.5