From: Frank Brehm Date: Fri, 4 Jan 2019 16:47:42 +0000 (+0100) Subject: Adding property tags to class ModuleMetadata X-Git-Tag: 1.6.4^2~66 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=70bffdadd594b470752da0d498a759a616031803;p=pixelpark%2Fpuppetmaster-webhooks.git Adding property tags to class ModuleMetadata --- diff --git a/lib/webhooks/module_meta_info.py b/lib/webhooks/module_meta_info.py index ed438a4..f8a59a7 100644 --- a/lib/webhooks/module_meta_info.py +++ b/lib/webhooks/module_meta_info.py @@ -27,7 +27,7 @@ from fb_tools.obj import FbBaseObjectError, FbBaseObject from .xlate import XLATOR -__version__ = '0.5.1' +__version__ = '0.5.2' LOG = logging.getLogger(__name__) @@ -162,6 +162,7 @@ class ModuleMetadata(FbBaseObject): self._project_page = None self._issues_url = None self.operatingsystem_support = [] + self.tags = [] super(ModuleMetadata, self).__init__( appname=appname, verbose=verbose, version=version, @@ -374,6 +375,11 @@ class ModuleMetadata(FbBaseObject): for item in json_data['operatingsystem_support']: supp = ModuleOsSupport.from_data(item) metadata.operatingsystem_support.append(supp) + if 'tags' in json_data: + for tag in json_data['tags']: + tg = str(tag).strip() + if tg: + metadata.tags.append(tg) metadata.initialized = True if verbose > 3: @@ -400,6 +406,8 @@ class ModuleMetadata(FbBaseObject): new.issues_url = self.issues_url for supp in self.operatingsystem_support: new.operatingsystem_support.append(copy.copy(supp)) + for tag in self.tags: + new.tags.append(tag) new.initialized = True @@ -430,6 +438,10 @@ class ModuleMetadata(FbBaseObject): data['operatingsystem_support'] = [] for supp in self.operatingsystem_support: data['operatingsystem_support'].append(supp.to_data()) + if self.tags: + data['tags'] = [] + for tag in self.tags: + data['tags'].append(tag) if self.verbose > 4: LOG.debug("ModuleMetadata:\n{}".format(pp(data)))