---
-verbose: 0
-do_sudo: true
-log_dir: '/var/log/webhooks'
-default_email: 'puppet@pixelpark.com'
-default_parent_dir: '/etc/puppetlabs/code'
-smtp_server: 'localhost'
-smtp_port: 25
-mail_cc_addresses: []
-sender_address: 'Puppetmaster <puppetmaster@pixelpark.com>'
-data_dir: '/var/lib/webhooks'
+#verbose: 0
+#no_error_mail: true
+#do_sudo: true
+#log_dir: '/var/log/webhooks'
+#default_email: 'puppet@pixelpark.com'
+#default_parent_dir: '/etc/puppetlabs/code'
+#smtp_server: 'localhost'
+#smtp_port: 25
+#mail_cc_addresses: []
+#sender_address: 'Puppetmaster <puppetmaster@pixelpark.com>'
+#data_dir: '/var/lib/webhooks'
self._read_stdin = True
self.tz_name = self.default_tz_name
self._html_title = None
+ self._no_error_mail = False
if not hasattr(self, '_output_type'):
self._output_type = self.default_output_type
def simulate(self, value):
self._simulate = to_bool(value)
+ # -----------------------------------------------------------
+ @property
+ def no_error_mail(self):
+ """Flag to not send any error mails in case of exceptions."""
+ return getattr(self, '_no_error_mail', False)
+
+ @no_error_mail.setter
+ def no_error_mail(self, value):
+ self._no_error_mail = to_bool(value)
+
# -----------------------------------------------------------
@property
def read_stdin(self):
res['output_type'] = self.output_type
res['mime_type'] = self.mime_type
res['html_title'] = self.html_title
+ res['no_error_mail'] = self.no_error_mail
return res
add_help=False,
)
+ arg_parser.add_argument(
+ "-N", "--no-error-mail", action='store_true', dest='no_error_mail',
+ help="Don't send error messages in case of some exceptions.",
+ )
+
arg_parser.add_argument(
"-D", '--data', '--data-dir', metavar='DIR', dest='data_dir',
help="Data directory, default: {!r}.".format(self.data_dir),
yaml_files = []
# ./hooks.yaml
yaml_files.append(os.path.join(self.base_dir, 'hooks.yaml'))
+ # ./hooks.local.yaml
+ yaml_files.append(os.path.join(self.base_dir, 'hooks.local.yaml'))
# ./<appname>.yaml
yaml_files.append(os.path.join(self.base_dir, self.appname + '.yaml'))
+ # ./<appname>.local.yaml
+ yaml_files.append(os.path.join(self.base_dir, self.appname + '.local.yaml'))
# /etc/pixelpark/hooks.yaml
yaml_files.append(os.sep + os.path.join('etc', 'pixelpark', 'hooks.yaml'))
# /etc/pixelpark/<appname>.yaml
if 'simulate' in config and not self.simulate:
self.simulate = config['simulate']
+ if 'no_error_mail' in config and not self.no_error_mail:
+ self.no_error_mail = to_bool(config['no_error_mail'])
+
if 'do_sudo' in config:
self.do_sudo = to_bool(config['do_sudo'])
r=to_addresses, e=pp(self.error_data),
s=self.smtp_server, p=self.smtp_port))
+ if self.no_error_mail:
+ LOG.debug("It's undesired to send error mails.")
+ return
+
if self.simulate:
LOG.info("Simulation mode, don't sending mail.")
return