From 01bed38f3148f46dcf12187ac3fe48326df5fa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 27 Sep 2023 20:33:03 +0200 Subject: [PATCH] server: fix import of CalledProcessError from subprocess MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- files/server.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/server.py b/files/server.py index cf72591..c9f220c 100644 --- a/files/server.py +++ b/files/server.py @@ -5,10 +5,10 @@ import logging as log from flask import Flask from git import Repo, util from webhook import Webhook -from subprocess import check_output from os import environ as env, path from urllib.parse import urlparse from argparse import ArgumentParser +from subprocess import check_output, CalledProcessError app = Flask(__name__) webhook = Webhook(app, endpoint='/gh_webhook') @@ -85,14 +85,14 @@ def remove_prefix(text, prefix): return text[text.startswith(prefix) and len(prefix):] def run_command(command): - log.info('Running command: %s' % command) + log.info('Running command: %s', command) try: output = check_output(command.split()) - except subprocess.CalledProcessError as err: + except CalledProcessError as err: log.error('Command failed, return code: %d' % err.returncode) - log.error('Command stdout:\n%s' % err.output) + log.error('Command stdout:\n%s', err.output) else: - log.info('Command success:\n%s' % output) + log.info('Command success:\n%s', output) def define_push_hook(repo, post_action): @webhook.hook()