[Kimchi-devel] [PATCH v2][Kimchi 1/2] Fix issue #840: Change distros.d internal path

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Fri Mar 18 15:07:17 UTC 2016


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 at linux.vnet.ibm.com>
---
 config.py.in    | 5 ++++-
 model/config.py | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/config.py.in b/config.py.in
index 3c1c13a..e645d5d 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():
@@ -115,8 +115,11 @@ class KimchiPaths(PluginPaths):
 
         if self.installed:
             self.spice_css_file = os.path.join(self.spice_dir, 'spice.css')
+            # Expose system configuration directory
+            self.sysconf_dir = os.path.join('@sysconfdir@', 'kimchi')
         else:
             self.spice_css_file = os.path.join(self.spice_dir, 'css/spice.css')
+            self.sysconf_dir = self.add_prefix(self.plugin_dir)
 
         self.serial_dir = os.path.join(self.ui_dir, 'serial')
 
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()
-- 
2.1.0




More information about the Kimchi-devel mailing list