import re
import textwrap
import datetime
+import locale
# Third party modules
import yaml
__version__ = webhooks.__version__
LOG = logging.getLogger(__name__)
-DEFAULT_EMAIL = 'frank.brehm@pixelpark.com'
-DEFAULT_SENDER = 'Puppetmaster <{}>'.format(DEFAULT_EMAIL)
# =============================================================================
the local repository and deploys it with r10k.
''').strip()
+ self.locale = 'de_DE.utf8'
+
super(R10kHookApp, self).__init__(
appname=appname, verbose=verbose, version=version)
elif isinstance(config['add_ignore_projects'], list):
self.ignore_projects += config['add_ignore_projects']
+ if 'locale' in config and config['locale']:
+ self.locale = config['locale']
+
+ # -------------------------------------------------------------------------
+ def pre_run(self):
+
+ if not super(R10kHookApp, self).pre_run():
+ return False
+
+ if self.full_name in self.ignore_projects or self.name in self.ignore_projects:
+ LOG.info("Ignoring project {!r}.".format(self.full_name))
+ return False
+
+ cur_loc = locale.getlocale()
+ cur_lang = os.environ.get('LANG', None)
+ if self.verbose > 1:
+ LOG.debug("Current locale is: {lo!r}, current LANG is {la!r}.".format(
+ lo=cur_loc, la=cur_lang))
+
+ LOG.debug("Setting locale and LANG to: {!r}.".format(self.locale))
+ locale.setlocale(locale.LC_ALL, self.locale)
+ os.environ['LANG'] = self.locale
+
# -------------------------------------------------------------------------
def run(self):
"""Main routine."""