From 8dcf6a216d0c8bb835427270bd5a2d280eb18342 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 25 Aug 2021 13:18:47 +0200 Subject: [PATCH] Changing output of generated mail --- lib/webhooks/base_app.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/webhooks/base_app.py b/lib/webhooks/base_app.py index 2511947..8917994 100644 --- a/lib/webhooks/base_app.py +++ b/lib/webhooks/base_app.py @@ -1168,17 +1168,14 @@ class BaseHookApp(BaseApplication): msg['X-Mailer'] = "Puppetmaster deploy script v.{}".format(__version__) - if self.verbose: - LOG.info(_("Sending the following mail to {r!r} via {s}:{p}:\n{m}").format( - r=to_addresses, m=msg.as_string(unixfrom=True), - s=self.smtp_server, p=self.smtp_port)) - else: - LOG.info(_("Sending a mail to {r!r} via {s}:{p}:\n{e}").format( - r=to_addresses, e=pp(self.error_data), - s=self.smtp_server, p=self.smtp_port)) + LOG.info(_("Sending a mail to {r!r} via {s}:{p}.").format( + r=to_addresses, s=self.smtp_server, p=self.smtp_port)) + + if self.verbose or self.no_error_mail: + print(self.colored(_('Content of the mail:'), 'AQUA') + '\n' + body) if self.no_error_mail: - LOG.debug(_("It's undesired to send error mails.")) + LOG.info(_("It's undesired to send error mails.")) return if self.simulate: -- 2.39.5