From: Frank Brehm Date: Fri, 4 Jan 2019 15:29:36 +0000 (+0100) Subject: Adding properties license, source and summary to class ModuleMetadata X-Git-Tag: 1.6.4^2~71 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=0d07c119dcb2620d0dc644c8979b611f3ab76c33;p=pixelpark%2Fpuppetmaster-webhooks.git Adding properties license, source and summary to class ModuleMetadata --- diff --git a/lib/webhooks/module_meta_info.py b/lib/webhooks/module_meta_info.py index 24282d7..80e303a 100644 --- a/lib/webhooks/module_meta_info.py +++ b/lib/webhooks/module_meta_info.py @@ -54,6 +54,9 @@ class ModuleMetadata(FbBaseObject): self._name = None self._version = None self._author = None + self._license = None + self._summary = None + self._source = None super(ModuleMetadata, self).__init__( appname=appname, verbose=verbose, version=version, @@ -103,6 +106,45 @@ class ModuleMetadata(FbBaseObject): return self._author = to_str(value).strip() + # ------------------------------------------------------------------------- + @property + def license(self): + """The license of the module.""" + return self._license + + @license.setter + def license(self, value): + if value is None: + self._license = None + return + self._license = to_str(value).strip() + + # ------------------------------------------------------------------------- + @property + def summary(self): + """The summary of the module.""" + return self._summary + + @summary.setter + def summary(self, value): + if value is None: + self._summary = None + return + self._summary = to_str(value).strip() + + # ------------------------------------------------------------------------- + @property + def source(self): + """The source of the module.""" + return self._source + + @source.setter + def source(self, value): + if value is None: + self._source = None + return + self._source = to_str(value).strip() + # ------------------------------------------------------------------------- def as_dict(self, short=True): """ @@ -117,6 +159,9 @@ class ModuleMetadata(FbBaseObject): res['name'] = self.name res['version'] = self.version res['author'] = self.author + res['license'] = self.license + res['summary'] = self.summary + res['source'] = self.source return res @@ -131,6 +176,9 @@ class ModuleMetadata(FbBaseObject): required_props = { 'name': 'Name', 'version': 'Version', + 'license': 'License', + 'summary': 'Summary', + 'source': 'Source', } for prop in required_props.keys(): @@ -147,6 +195,9 @@ class ModuleMetadata(FbBaseObject): metadata.author = json_data['author'] else: metadata.author = metadata.author + metadata.license = json_data['license'] + metadata.summary = json_data['summary'] + metadata.source = json_data['source'] metadata.initialized = True if verbose > 3: @@ -162,6 +213,9 @@ class ModuleMetadata(FbBaseObject): new.name = self.name new.version = self.version new.author = self.author + new.license = self.license + new.summary = self.summary + new.source = self.source new.initialized = True @@ -174,6 +228,9 @@ class ModuleMetadata(FbBaseObject): data['name'] = self.name data['version'] = self.version data['author'] = self.author + data['license'] = self.license + data['summary'] = self.summary + data['source'] = self.source if self.verbose > 4: LOG.debug("ModuleMetadata:\n{}".format(pp(data)))