On 03/17/2016 07:49 PM, Rodrigo Trujillo wrote:
When you install Kimchi package, it is going to install distros.d in
/etc/kimchi. However, internally, Kimchi is using the path
/etc/wok/plugins.d/kimchi, leading to errors. This patch fixes this
problem making Kimchi use /etc/kimchi/distros.d.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
config.py.in | 7 ++++++-
model/config.py | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/config.py.in b/config.py.in
index 3c1c13a..a32a2e7 100644
--- a/config.py.in
+++ b/config.py.in
@@ -42,7 +42,7 @@ def get_kimchi_version():
def get_distros_store():
- return os.path.join(PluginPaths('kimchi').conf_dir, 'distros.d')
+ return os.path.join(kimchiPaths.sysconf_dir, 'distros.d')
def get_debugreports_path():
@@ -120,6 +120,11 @@ class KimchiPaths(PluginPaths):
self.serial_dir = os.path.join(self.ui_dir, 'serial')
+ # Expose system configuration directory
+ if self.installed:
+ self.sysconf_dir = os.path.join('@sysconfdir@', 'kimchi')
+ else:
+ self.sysconf_dir = self.add_prefix(self.plugin_dir)
There is already an if condition to check Kimchi is installed or not.
You can reuse it and just add the new variable there.
kimchiPaths = KimchiPaths()
diff --git a/model/config.py b/model/config.py
index ccfd1b3..f5d2792 100644
--- a/model/config.py
+++ b/model/config.py
@@ -134,6 +134,10 @@ class DistrosModel(object):
return distro['name']
n_processes = len(self.distros.keys())
+ # Avoid problems if the for some reason the files are not in the right
+ # place, or were deleted, or moved or not supported in the arch
+ if n_processes < 1:
+ return []
pool = ThreadPool(processes=n_processes)
map_res = pool.map_async(validate_distro, self.distros.values())
pool.close()