From: Frank Brehm Date: Mon, 27 Aug 2018 09:54:27 +0000 (+0200) Subject: Bugfixing and adding method local_version_output X-Git-Tag: 0.10.7^2~5 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=c8e4e394cef0c26774fffc9576867fa772921ebc;p=pixelpark%2Fpuppetmaster-webhooks.git Bugfixing and adding method local_version_output --- 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']