]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
Bugfixing and adding method local_version_output
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 27 Aug 2018 09:54:27 +0000 (11:54 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 27 Aug 2018 09:54:27 +0000 (11:54 +0200)
lib/webhooks/module_info.py

index 1d669bf4a68c76a14a52ac8b93f309ac9078397a..891d19987e9cbc30c5d540fa4b76c98f47abda01 100644 (file)
@@ -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']