From: Frank Brehm Date: Wed, 15 Feb 2017 16:38:23 +0000 (+0100) Subject: Changing logging output X-Git-Tag: 0.8.4~17 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=bf230655ac06ac3c38bc4a8e63ee3dba68ee927f;p=pixelpark%2Fpuppetmaster-webhooks.git Changing logging output --- diff --git a/lib/webhooks/__init__.py b/lib/webhooks/__init__.py index 6b99eaf..24b9f3e 100644 --- a/lib/webhooks/__init__.py +++ b/lib/webhooks/__init__.py @@ -1,6 +1,6 @@ #!/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '0.5.3' +__version__ = '0.5.4' # vim: ts=4 et list diff --git a/lib/webhooks/deploy.py b/lib/webhooks/deploy.py index 7df4749..33fde3b 100644 --- a/lib/webhooks/deploy.py +++ b/lib/webhooks/deploy.py @@ -284,7 +284,7 @@ class WebhookDeployApp(BaseHookApp): if self.verbose > 2: LOG.debug("Cmd: {}".format(pp(cmd))) cmd_str = ' '.join(map(lambda x: pipes.quote(x), cmd)) - LOG.debug("Executing: {}".format(cmd_str)) + LOG.info("Executing: {}".format(cmd_str)) git = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = git.communicate() @@ -293,7 +293,7 @@ class WebhookDeployApp(BaseHookApp): LOG.debug("Return value: {}".format(ret_val)) if stdoutdata: msg = "Output:\n{}".format(to_str(stdoutdata)) - LOG.debug(msg) + LOG.info(msg) self.print_out(msg) else: LOG.debug("No output.") @@ -303,7 +303,7 @@ class WebhookDeployApp(BaseHookApp): LOG.warn(msg) self.error_data.append(msg) else: - LOG.debug(msg) + LOG.info(msg) self.print_out(msg) finally: os.chdir(cur_dir) diff --git a/lib/webhooks/r10k.py b/lib/webhooks/r10k.py index a7dea8d..d40b6f9 100644 --- a/lib/webhooks/r10k.py +++ b/lib/webhooks/r10k.py @@ -186,24 +186,28 @@ class R10kHookApp(BaseHookApp): urllib.parse.quote(self.ref)) url = 'https://{h}:{po}{pa}'.format( h=self.puppetmaster_host, po=self.puppetmaster_api_port, pa=path) - LOG.info("Requesting DELETE from {} ...".format(url)) + LOG.debug("Requesting DELETE from {} ...".format(url)) cmd = [] if self.do_sudo: cmd = ['sudo', '-n'] + cmd.append(self.curl_bin) + if self.verbose: + cmd.append('-i') + cmd += [ - self.curl_bin, '-i', '--cert', cert_file, '--key', key_file, '--cacert', ca_file, + '--silent', '--show-error', '-X', 'DELETE', url, ] cmd_str = ' '.join(map(lambda x: pipes.quote(x), cmd)) if self.verbose > 2: LOG.debug("Cmd: {}".format(pp(cmd))) - LOG.debug("Executing: {}".format(cmd_str)) + LOG.info("Executing: {}".format(cmd_str)) if self.simulate: LOG.info("Simulation mode, don't executing {}.".format(self.curl_bin)) @@ -216,7 +220,7 @@ class R10kHookApp(BaseHookApp): LOG.debug("Return value: {}".format(ret_val)) if stdoutdata: msg = "Output:\n{}".format(to_str(stdoutdata)) - LOG.debug(msg) + LOG.info(msg) self.print_out(msg) else: LOG.debug("No output.") @@ -226,7 +230,7 @@ class R10kHookApp(BaseHookApp): LOG.warn(msg) self.error_data.append(msg) else: - LOG.debug(msg) + LOG.info(msg) self.print_out(msg) return @@ -256,7 +260,7 @@ class R10kHookApp(BaseHookApp): cmd_str = ' '.join(map(lambda x: pipes.quote(x), cmd)) if self.verbose > 2: LOG.debug("Cmd: {}".format(pp(cmd))) - LOG.debug("Executing: {}".format(cmd_str)) + LOG.info("Executing: {}".format(cmd_str)) if self.simulate: LOG.info("Simulation mode, don't executing {!r}.".format(self.r10k_bin)) @@ -269,7 +273,7 @@ class R10kHookApp(BaseHookApp): LOG.debug("Return value: {}".format(ret_val)) if stdoutdata: msg = "Output:\n{}".format(to_str(stdoutdata)) - LOG.debug(msg) + LOG.info(msg) self.print_out(msg) else: LOG.debug("No output.") @@ -280,7 +284,7 @@ class R10kHookApp(BaseHookApp): self.error_data.append(msg) res = False else: - LOG.debug(msg) + LOG.info(msg) self.print_out(msg) return res