From c8e4e394cef0c26774fffc9576867fa772921ebc Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 27 Aug 2018 11:54:27 +0200 Subject: [PATCH] Bugfixing and adding method local_version_output --- lib/webhooks/module_info.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/webhooks/module_info.py b/lib/webhooks/module_info.py index 1d669bf..891d199 100644 --- a/lib/webhooks/module_info.py +++ b/lib/webhooks/module_info.py @@ -26,7 +26,7 @@ from .common import pp, to_str, to_bool, is_sequence from .obj import BaseObjectError from .obj import BaseObject -__version__ = '0.6.1' +__version__ = '0.6.2' LOG = logging.getLogger(__name__) @@ -301,6 +301,26 @@ class ModuleInfo(BaseObject): return res + # ------------------------------------------------------------------------- + def local_version_output(self, environment): + + if environment not in self.local_versions and environment not in self.expected_versions: + return '~' + + if environment in self.expected_versions: + expected = self.expected_versions[environment] + local_version = '~' + if environment in self.local_versions: + local_version = self.local_versions[environment] + if expected == local_version: + return expected + return "{e} => {l}".format(e=expected, l=local_version) + if environment in self.local_versions: + local_version = self.local_versions[environment] + else: + local_version = '~' + return "~ => {}".format(local_version) + # ------------------------------------------------------------------------- def merge_in(self, other): @@ -392,7 +412,7 @@ class ModuleInfo(BaseObject): module_info.forge_version = data['forge_version'] if 'forge_avail' in data: - module_info._full_name_orig = data['forge_avail'] + module_info._forge_avail = data['forge_avail'] if 'forge_homepage_url' in data: module_info.forge_homepage_url = data['forge_homepage_url'] -- 2.39.5