From: Frank Brehm Date: Wed, 9 Jan 2019 17:23:54 +0000 (+0100) Subject: Adding lib/webhooks/forge_module_info.py X-Git-Tag: 1.6.4^2~63 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=56dba0ec2b51b62fcf4854844aac6a9028a4b74a;p=pixelpark%2Fpuppetmaster-webhooks.git Adding lib/webhooks/forge_module_info.py --- diff --git a/lib/webhooks/forge_module_info.py b/lib/webhooks/forge_module_info.py new file mode 100644 index 0000000..da087b7 --- /dev/null +++ b/lib/webhooks/forge_module_info.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +@author: Frank Brehm +@contact: frank.brehm@pixelpark.com +@copyright: © 2018 by Frank Brehm, Publicies Pixelpark GmbH, Berlin +@summary: A module for encapsulating all information about a Puppet module +""" +from __future__ import absolute_import + +# Standard modules +import logging +import re +import copy +import warnings +import time +import datetime + +# Third party modules +import requests +import pytz + +# Own modules +from fb_tools.common import pp, to_str, to_bool, is_sequence +from fb_tools.obj import FbBaseObjectError, FbBaseObject + +from .xlate import XLATOR + +__version__ = '0.1.0' + +LOG = logging.getLogger(__name__) + +_ = XLATOR.gettext +ngettext = XLATOR.ngettext + + +# ============================================================================= +def parse_forge_date(dt): + + return datetime.datetime.strptime(dt, '%Y-%m-%d %H:%M:%S %z') + + +# ============================================================================= +class ReleasInfoError(FbBaseObjectError): + + pass + + +# ============================================================================= +class ForgeModuleInfoError(FbBaseObjectError): + + pass + + +# ============================================================================= +class ForgeModuleInfoTypeError(ForgeModuleInfoError, TypeError): + + pass + + +# ============================================================================= +class ModuleReleaseInfo(FbBaseObject): + """Class for encapsulating information about a Puppet module release from Puppet Forge.""" + + # ------------------------------------------------------------------------- + def __init__( + self, appname=None, verbose=0, version=__version__, base_dir=None, initialized=None): + + self._created_at = None + self._deleted_at = None + self._file_size = None + self._file_uri = None + self._slug = None + self._supported = None + self._uri = None + self._version = None + + super(ModuleReleaseInfo, self).__init__( + appname=appname, verbose=verbose, version=version, + base_dir=base_dir, initialized=False, + ) + + + +# ============================================================================= +if __name__ == "__main__": + + pass + +# ============================================================================= + +# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 list diff --git a/lib/webhooks/get_forge_modules.py b/lib/webhooks/get_forge_modules.py index 7a5b3d4..e45ebf5 100644 --- a/lib/webhooks/get_forge_modules.py +++ b/lib/webhooks/get_forge_modules.py @@ -80,6 +80,8 @@ class GetForgeModulesApp(BaseHookApp): self.http_timeout = self.default_http_timeout self.modules = None self._do_forge = True + self.forge_modules = None + self.env_modules = None description = _( "Collects information about all used Puppet Modules from {url!r} "