]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
Adding method to_data() to class ModuleInfo
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 24 Aug 2018 09:43:56 +0000 (11:43 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 24 Aug 2018 09:43:56 +0000 (11:43 +0200)
lib/webhooks/module_info.py

index 343821e59fe2e89698cf54bd0e476adab806e47d..b414aff72d1be5da6e503a857350f8983ceaef7d 100644 (file)
@@ -25,7 +25,7 @@ from .common import pp, to_str, to_bool, is_sequence
 from .obj import BaseObjectError
 from .obj import BaseObject
 
-__version__ = '0.4.0'
+__version__ = '0.5.0'
 
 LOG = logging.getLogger(__name__)
 
@@ -248,6 +248,28 @@ class ModuleInfo(BaseObject):
 
         return res
 
+    # -------------------------------------------------------------------------
+    def to_data(self):
+        """Returning a dict, which can be used to re-instantiate this module info."""
+
+        res = {}
+
+        res['name'] = self.name
+        res['vendor'] = self.vendor
+        res['full_name'] = self.full_name
+        res['full_name_orig'] = self.full_name_orig
+        res['forge_version'] = self.forge_version
+        res['forge_avail'] = self.forge_avail
+        res['forge_homepage_url'] = self.forge_homepage_url
+        res['forge_source'] = self.forge_source
+        res['repo'] = self.repo
+
+        red['local_versions'] = copy.copy(self.local_versions)
+        red['expected_versions'] = copy.copy(self.local_versions)
+        red['forge_releases'] = copy.copy(self.forge_releases)
+
+        return res
+
     # -------------------------------------------------------------------------
     def merge_in(self, other):