From 5a1e0960517b6a49fc7502b45ca4f74894459e04 Mon Sep 17 00:00:00 2001 From: Seblu <sebastien.luttringer@smartjog.com> Date: Mon, 25 Jul 2011 19:12:19 +0200 Subject: [PATCH] fix bad cache loading --- installsystems/config.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installsystems/config.py b/installsystems/config.py index e5a3ad8..3f2a38a 100644 --- a/installsystems/config.py +++ b/installsystems/config.py @@ -60,6 +60,8 @@ class MainConfigFile(ConfigFile): Load/Reload config file ''' self._config = {} + # loading default options + self._config["cache"] = self.cache # loading config file if exists if self.path is None: debug("No main config file to load") @@ -70,7 +72,7 @@ class MainConfigFile(ConfigFile): cp.read(self.path) # main configuration if cp.has_section(self.prefix): - self._config = dict(cp.items(self.prefix)) + self._config.update(cp.items(self.prefix)) except Exception as e: raise Exception("Unable load main config file %s: %s" % (self.path, e)) @@ -88,12 +90,10 @@ class MainConfigFile(ConfigFile): ''' List all candidates to cache directories. Alive or not ''' - dirs = ["/var/tmp", "/tmp"] - # we have a different behaviour if we are root + dirs = [os.path.expanduser("~/.cache"), "/var/tmp", "/tmp"] + # we have an additional directry if we are root if os.getuid() == 0: dirs.insert(0, "/var/cache") - else: - dirs.insert(0, os.path.expanduser("~/.cache")) return map(lambda x: os.path.join(x, self.prefix), dirs) def _cache_path(self): -- GitLab