From: Frank Brehm Date: Fri, 24 Aug 2018 09:43:56 +0000 (+0200) Subject: Adding method to_data() to class ModuleInfo X-Git-Tag: 0.9.8^2~4 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=f8a9fcddb53438c2d11a550ffeab796aaf491b93;p=pixelpark%2Fpuppetmaster-webhooks.git Adding method to_data() to class ModuleInfo --- diff --git a/lib/webhooks/module_info.py b/lib/webhooks/module_info.py index 343821e..b414aff 100644 --- a/lib/webhooks/module_info.py +++ b/lib/webhooks/module_info.py @@ -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):