]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
Adding property tags to class ModuleMetadata
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 4 Jan 2019 16:47:42 +0000 (17:47 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 4 Jan 2019 16:47:42 +0000 (17:47 +0100)
lib/webhooks/module_meta_info.py

index ed438a48cfc082c5a2060fe8505a76608f7426ae..f8a59a72e8aed0ed3b25174170cd7240d397ab1d 100644 (file)
@@ -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)))