
From: Aline Manera <alinefm@br.ibm.com> More than expose if there is a repository management tool recognized by Kimchi, we also need to expose which tool is it. The repository information depends on its type and UI needs to know it to properly build the view. Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- docs/API.md | 4 ++-- src/kimchi/mockmodel.py | 2 +- src/kimchi/model/config.py | 6 +++--- src/kimchi/repositories.py | 4 ++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/API.md b/docs/API.md index 672ef14..147511d 100644 --- a/docs/API.md +++ b/docs/API.md @@ -581,8 +581,8 @@ creation. the system; False, otherwise. * update_tool: True if there is a compatible package manager for the system; False, otherwise - * repo_mngt_tool: True if there is a compatible repository management tool - for the system; False, otherwise + * repo_mngt_tool: 'deb', 'yum' or None - when the repository management + tool is not identified * **POST**: *See Configuration Actions* **Actions (POST):** diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py index 743c7c6..d2adb4d 100644 --- a/src/kimchi/mockmodel.py +++ b/src/kimchi/mockmodel.py @@ -69,7 +69,7 @@ class MockModel(object): 'screenshot': True, 'system_report_tool': True, 'update_tool': True, - 'repo_mngt_tool': True} + 'repo_mngt_tool': 'yum'} def reset(self): self._mock_vms = {} diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py index 5b27188..a6a25e4 100644 --- a/src/kimchi/model/config.py +++ b/src/kimchi/model/config.py @@ -82,11 +82,11 @@ class CapabilitiesModel(object): update_tool = True try: - Repositories() + repo = Repositories() except Exception: - repo_mngt_tool = False + repo_mngt_tool = None else: - repo_mngt_tool = True + repo_mngt_tool = repo._pkg_mnger.TYPE return {'libvirt_stream_protocols': self.libvirt_stream_protocols, 'qemu_stream': self.qemu_stream, diff --git a/src/kimchi/repositories.py b/src/kimchi/repositories.py index 2727c84..e685991 100644 --- a/src/kimchi/repositories.py +++ b/src/kimchi/repositories.py @@ -193,6 +193,8 @@ class YumRepo(object): It's loaded only on those systems listed at YUM_DISTROS and loads necessary modules in runtime. """ + TYPE = 'yum' + def __init__(self): self._yb = getattr(__import__('yum'), 'YumBase')() self._repos = self._yb.repos @@ -413,6 +415,8 @@ class AptRepo(object): It's loaded only on those systems listed at YUM_DISTROS and loads necessary modules in runtime. """ + TYPE = 'deb' + def __init__(self): getattr(__import__('apt_pkg'), 'init_config')() getattr(__import__('apt_pkg'), 'init_system')() -- 1.7.10.4