From: Frank Brehm Date: Fri, 24 Aug 2018 13:06:06 +0000 (+0200) Subject: Bugfixing an applying flake8 rules X-Git-Tag: 0.9.10^2 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=8d1146ec4432c772c3170545bb37feab2e837abf;p=pixelpark%2Fpuppetmaster-webhooks.git Bugfixing an applying flake8 rules --- diff --git a/lib/webhooks/__init__.py b/lib/webhooks/__init__.py index e36d8f2..7f386bf 100644 --- a/lib/webhooks/__init__.py +++ b/lib/webhooks/__init__.py @@ -1,6 +1,6 @@ #!/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '0.9.9' +__version__ = '0.9.10' # vim: ts=4 et list diff --git a/lib/webhooks/common.py b/lib/webhooks/common.py index 88da917..c0f0e7e 100644 --- a/lib/webhooks/common.py +++ b/lib/webhooks/common.py @@ -18,11 +18,10 @@ import locale import collections # Third party modules -import six # Own modules -__version__ = '0.3.3' +__version__ = '0.3.4' LOG = logging.getLogger(__name__) RE_YES = re.compile(r'^\s*(?:y(?:es)?|true)\s*$', re.IGNORECASE) diff --git a/lib/webhooks/get_forge_modules.py b/lib/webhooks/get_forge_modules.py index f40c30f..4dd22eb 100644 --- a/lib/webhooks/get_forge_modules.py +++ b/lib/webhooks/get_forge_modules.py @@ -12,8 +12,6 @@ from __future__ import absolute_import import os import logging import textwrap -import copy -import pipes import json import re import glob @@ -21,8 +19,10 @@ import datetime import fcntl import pwd import grp +import errno +import sys -from operator import attrgetter, itemgetter +from operator import itemgetter # Third party modules import six @@ -33,13 +33,12 @@ from six import reraise # Own modules from . import __version__ -from .common import pp, to_str, to_bytes +from .common import pp, to_bytes from .base_app import BaseHookError, BaseHookApp -from .module_info import ModuleInfoError, ModuleInfo +from .module_info import ModuleInfo -#__version__ = webhooks.__version__ LOG = logging.getLogger(__name__) @@ -56,7 +55,8 @@ class GetForgeModulesApp(BaseHookApp): """ default_forge_uri = 'https://forgeapi.puppet.com/v3/modules' - default_puppet_root_env_dir = os.sep + os.path.join('etc', 'puppetlabs', 'code', 'environments') + default_puppet_root_env_dir = os.sep + os.path.join( + 'etc', 'puppetlabs', 'code', 'environments') default_http_timeout = 30 max_http_timeout = 600 @@ -74,7 +74,7 @@ class GetForgeModulesApp(BaseHookApp): def __init__(self, appname=None, verbose=0, version=__version__): """Constructor.""" - self.cache_file = None + self.cache_file = None self.environments = [] self.puppet_root_env_dir = self.default_puppet_root_env_dir self.forge_uri = self.default_forge_uri @@ -85,7 +85,7 @@ class GetForgeModulesApp(BaseHookApp): Collects information about all used Puppet Modules from {url} and cache those information in {cdir!r}. ''').strip().format( - url=self.default_forge_uri, cdir=self.default_data_dir) + url=self.default_forge_uri, cdir=self.default_data_dir) super(GetForgeModulesApp, self).__init__( appname=appname, verbose=verbose, version=version) @@ -96,7 +96,6 @@ class GetForgeModulesApp(BaseHookApp): self.read_stdin = False self.cache_file = os.path.join(self.data_dir, self.appname + '.yaml') - self.initialized = True # ------------------------------------------------------------------------- @@ -265,7 +264,7 @@ class GetForgeModulesApp(BaseHookApp): with open(metadata_file, 'r', **self.open_args) as fh: json_data = json.load(fh) except ValueError as e: - LOG.warn( "Could not interprete {f!r} as a regular JSON file: {e}".format( + LOG.warn("Could not interprete {f!r} as a regular JSON file: {e}".format( f=metadata_file, e=e)) return None if not json_data: diff --git a/lib/webhooks/handler.py b/lib/webhooks/handler.py index d6d58ba..a72985a 100644 --- a/lib/webhooks/handler.py +++ b/lib/webhooks/handler.py @@ -413,7 +413,7 @@ class BaseHandler(BaseObject): env={'USER': pwd_info.pw_name}, **kwargs ) - #cwd=self.base_dir, + # cwd=self.base_dir, # Display Output of executable stdoutdata = '' diff --git a/lib/webhooks/module_info.py b/lib/webhooks/module_info.py index 6ce86c0..bddaa02 100644 --- a/lib/webhooks/module_info.py +++ b/lib/webhooks/module_info.py @@ -9,15 +9,14 @@ from __future__ import absolute_import # Standard modules -import os import logging import re import copy import warnings import time +import datetime # Third party modules -import six import requests import pytz @@ -27,7 +26,7 @@ from .common import pp, to_str, to_bool, is_sequence from .obj import BaseObjectError from .obj import BaseObject -__version__ = '0.5.0' +__version__ = '0.5.1' LOG = logging.getLogger(__name__) @@ -341,8 +340,7 @@ class ModuleInfo(BaseObject): # ------------------------------------------------------------------------- @classmethod - def init_from_json( - cls, json_data, env, appname=None, verbose=0, base_dir=None): + def init_from_json(cls, json_data, env, appname=None, verbose=0, base_dir=None): if 'name' not in json_data: LOG.warn("Did not found module name in json.") @@ -366,8 +364,7 @@ class ModuleInfo(BaseObject): # ------------------------------------------------------------------------- @classmethod - def init_from_puppetfile_line( - cls, line, env, appname=None, verbose=0, base_dir=None): + def init_from_puppetfile_line(cls, line, env, appname=None, verbose=0, base_dir=None): match = cls.re_mod_pf_line.search(line) if not match: @@ -456,7 +453,8 @@ class ModuleInfo(BaseObject): # ------------------------------------------------------------------------- @classmethod def get_from_forge( - cls, full_name, forge_uri, http_timeout=30, appname=None, verbose=0, base_dir=None): + cls, full_name, forge_uri, http_timeout=30, + appname=None, verbose=0, base_dir=None): url = "{url}/{name}".format(url=forge_uri, name=full_name) module_info = None