From befc63304ab2e04f6f41ed74e252a53d12c2c142 Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Tue, 15 Jun 2021 10:23:20 +0200 Subject: [PATCH] Add log-driver option --- main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 9abc3af..25f538d 100644 --- a/main.py +++ b/main.py @@ -19,8 +19,10 @@ sdnotify = sh.Command("systemd-notify") class PodKeeper: - def __init__(self, network, replace, remove, identifier): - self.podnet_args = ("--network", network) if network else () + def __init__(self, network, log_driver, replace, remove, identifier): + self.podnet_args = () + self.podnet_args += ("--network", network) if network else () + self.podnet_args += ("--log-driver", log_driver) if log_driver else () self.replace = replace self.remove = remove identifier_path = pathlib.PurePath(identifier) @@ -141,11 +143,13 @@ class PodKeeper: @click.command() @click.option("--network", default="brodge", help="Network for the created pod") -@click.option("--replace/--no-replace", default=True, help="Controls replacement of previously running pod with the same name") +@click.option("--log-driver", default="", help="Network for the created pod") +@click.option("--replace/--no-replace", default=True, help="Controls replacement of previously running pod with the " + "same name") @click.option("--remove/--keep", default=True, help="Controls removal of pod after stopping") @click.argument("identifier") -def main(network, replace, remove, identifier): - keeper = PodKeeper(network, replace, remove, identifier) +def main(network, log_driver, replace, remove, identifier): + keeper = PodKeeper(network, log_driver, replace, remove, identifier) signal(SIGINT, keeper.destroy) signal(SIGTERM, keeper.destroy)