[Kimchi-devel] [PATCH 7/7] host update: Expose update tool

Aline Manera alinefm at linux.vnet.ibm.com
Thu Feb 13 14:07:33 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

When there is no package manager compatible with the system, UI needs to
know to enable/disable the host update functionality.
Also update API.md accordingly and add missing parameter
system_report_tool there too.

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 docs/API.md                |    4 ++++
 src/kimchi/model/config.py |   10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/docs/API.md b/docs/API.md
index 9b4e2fd..3951434 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -542,6 +542,10 @@ creation.
     * screenshot: True, if libvirt stream functionality can create screenshot
       file without problems; False, otherwise or None if the functionality was
       not tested yet
+    * system_report_tool: True if the is some debug report tool installed on
+      the system; False, otherwise.
+    * update_tool: True if there is a compatible package manager for the
+      system; False, otherwise
 * **POST**: *See Configuration Actions*
 
 **Actions (POST):**
diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py
index 9b5814a..a940a32 100644
--- a/src/kimchi/model/config.py
+++ b/src/kimchi/model/config.py
@@ -29,6 +29,7 @@ from kimchi.exception import NotFoundError
 from kimchi.featuretests import FeatureTests
 from kimchi.model.debugreports import DebugReportsModel
 from kimchi.screenshot import VMScreenshot
+from kimchi.swupdate import SoftwareUpdate
 from kimchi.utils import kimchi_log
 
 
@@ -71,11 +72,18 @@ class CapabilitiesModel(object):
 
     def lookup(self, *ident):
         report_tool = DebugReportsModel.get_system_report_tool()
+        try:
+            SoftwareUpdate()
+        except Exception:
+            update_tool = False
+        else:
+            update_tool = True
 
         return {'libvirt_stream_protocols': self.libvirt_stream_protocols,
                 'qemu_stream': self.qemu_stream,
                 'screenshot': VMScreenshot.get_stream_test_result(),
-                'system_report_tool': bool(report_tool)}
+                'system_report_tool': bool(report_tool),
+                'update_tool': update_tool}
 
 
 class DistrosModel(object):
-- 
1.7.10.4




More information about the Kimchi-devel mailing list