# -*- coding: utf-8 -*-
# Standard modules
-import os
import sys
import logging
-import pathlib
from pathlib import Path
sys.path.insert(0, str(libdir))
-from webhooks.deploy import WebhookDeployApp
+from webhooks.deploy import WebhookDeployApp # noqa
MY_APPNAME = my_path.stem
LOG = logging.getLogger(MY_APPNAME)
#!/bin/env python3
# -*- coding: utf-8 -*-
-__version__ = '1.4.6'
+__version__ = '1.4.7'
# vim: ts=4 et list
import six
import yaml
import pytz
-import pathlib
# Own modules
from fb_tools.common import pp, to_bytes, to_bool
-from fb_tools.obj import FbBaseObject
from fb_tools.handler import BaseHandler
-from fb_tools.errors import FbAppError
+from fb_tools.errors import FbAppError, FunctionNotImplementedError
from fb_tools.app import BaseApplication
from . import __version__ as __pkg_version__
_ = XLATOR.gettext
ngettext = XLATOR.ngettext
+
# =============================================================================
class BaseHookError(FbAppError):
"""
pass
+
# =============================================================================
class UncriticalHookError(BaseHookError):
"""
setattr(namespace, self.dest, data_dir)
+
# =============================================================================
class LogDirOptionAction(argparse.Action, UncriticalHookError):
msg = _("Logging directory {!r} does not exists.").format(str(log_dir))
raise argparse.ArgumentError(self, msg)
- if not data_dir.is_dir():
+ if not log_dir.is_dir():
msg = _("Path to logging directory {!r} is not a directory.").format(str(log_dir))
raise argparse.ArgumentError(self, msg)
setattr(namespace, self.dest, log_dir)
+
# =============================================================================
class BaseHookApp(BaseApplication):
"""
# Standard modules
import os
import logging
-import textwrap
import copy
import pipes
import pathlib
# Third party modules
# Own modules
-from fb_tools.common import pp, to_str
+from fb_tools.common import pp
from . import __version__
finally:
os.chdir(cur_dir)
+
# =============================================================================
if __name__ == "__main__":
# Standard modules
import os
import logging
-import textwrap
import json
import glob
import datetime
# Third party modules
import six
import yaml
-import babel
from babel.dates import format_datetime, LOCALTZ
def run_hook(self):
"""Main routine."""
- my_loc = babel.core.default_locale()
-
d = datetime.datetime.now(LOCALTZ)
dt = format_datetime(d, 'yyyy-MM-dd HH:mm:ss z', tzinfo=LOCALTZ)
LOG.info(_("Reading metadata files of environment {!r} ...").format(env))
- #pattern = os.path.join(self.puppet_root_env_dir, env, 'modules', '*')
- #if self.verbose > 2:
- # LOG.debug("Globbing pattern for module directories: {!r}".format(str(pattern)))
-
modules_dir = self.puppet_root_env_dir / env / 'modules'
- #for module_dir in glob.glob(str(pattern)):
for module_dir in modules_dir.glob('*'):
module_info = self.get_meta_module_info(module_dir, env)
if module_info:
# Standard modules
import logging
-import textwrap
import datetime
import re
-import time
from distutils.version import LooseVersion
# Third party modules
-import babel
from babel.dates import format_datetime, LOCALTZ
# Own modules
pass
+
# =============================================================================
class InvalidEnvironmentError(GetModuleChangesError):
super(GetModuleChangesApp, self).post_init()
self.read_stdin = False
- # self.no_error_mail = True
self.initialized = True
# -------------------------------------------------------------------------
import sys
import os
import logging
-import textwrap
import locale
import pipes
import urllib.parse
import requests
# Own modules
-from fb_tools.common import to_str
-from fb_tools.handler import BaseHandler
-
from . import __version__
from .base_app import BaseHookApp
bname = self.puppetmaster_host + '.pem'
key_file = self.puppetmaster_ssl_dir / 'private_keys' / bname
cert_file = self.puppetmaster_ssl_dir / 'certs' / bname
- ca_file = self.puppetmaster_ssl_dir / 'certs' /'ca.pem'
+ ca_file = self.puppetmaster_ssl_dir / 'certs' / 'ca.pem'
cert = (str(cert_file), str(key_file))
session = requests.Session()
# Standard modules
import logging
-import textwrap
import json
import datetime
import re
pass
+
# =============================================================================
class ShowModulesUncriticalError(ShowModulesError, UncriticalHookError):
pass
+
# =============================================================================
class ShowModulesApp(BaseHookApp):
"""
self.print_out(" </tbody>")
self.print_out("</table>")
- plural_e = 'e'
- if nr_modules == 1:
- plural_e = ''
msg = "<br/>" + ngettext(
"Found total {sb}one module{eb}.",
"Found total {sb}{nr} modules{eb}.", nr_modules).format(
if self.verbose > 2:
LOG.debug("Zeilen-Template:\n{}".format(tpl))
- plural_e = 'e'
- if nr_modules == 1:
- plural_e = ''
msg = "\n" + ngettext(
"Found total {sb}one module{eb}.",
"Found total {sb}{nr} modules{eb}.", nr_modules).format(
# -*- coding: utf-8 -*-
# Standard modules
-import os
import sys
import logging
# -*- coding: utf-8 -*-
# Standard modules
-import os
import sys
import logging
sys.path.insert(0, str(libdir))
-from webhooks.show_modules import ShowModulesApp
+from webhooks.show_modules import ShowModulesApp # noqa
MY_APPNAME = my_path.stem
LOG = logging.getLogger(MY_APPNAME)
# -*- coding: utf-8 -*-
# Standard modules
-import os
import sys
import logging
sys.path.insert(0, str(libdir))
-from webhooks.show_modules import ShowModulesApp
+from webhooks.show_modules import ShowModulesApp # noqa
MY_APPNAME = my_path.stem
LOG = logging.getLogger(MY_APPNAME)
# -*- coding: utf-8 -*-
# Standard modules
-import os
import sys
import logging
sys.path.insert(0, str(libdir))
-from webhooks.show_modules import ShowModulesApp
+from webhooks.show_modules import ShowModulesApp # noqa
MY_APPNAME = my_path.stem
LOG = logging.getLogger(MY_APPNAME)