import os
import logging
import textwrap
-import copy
-import pipes
import json
import re
import glob
import fcntl
import pwd
import grp
+import errno
+import sys
-from operator import attrgetter, itemgetter
+from operator import itemgetter
# Third party modules
import six
# 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__)
"""
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
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
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)
self.read_stdin = False
self.cache_file = os.path.join(self.data_dir, self.appname + '.yaml')
-
self.initialized = True
# -------------------------------------------------------------------------
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:
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
from .obj import BaseObjectError
from .obj import BaseObject
-__version__ = '0.5.0'
+__version__ = '0.5.1'
LOG = logging.getLogger(__name__)
# -------------------------------------------------------------------------
@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.")
# -------------------------------------------------------------------------
@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:
# -------------------------------------------------------------------------
@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