Add log-driver option

This commit is contained in:
Ben 2021-06-15 10:23:20 +02:00
parent 8d02bce0d8
commit befc63304a
Signed by: ben
GPG key ID: 0F54A7ED232D3319

14
main.py
View file

@ -19,8 +19,10 @@ sdnotify = sh.Command("systemd-notify")
class PodKeeper: class PodKeeper:
def __init__(self, network, replace, remove, identifier): def __init__(self, network, log_driver, replace, remove, identifier):
self.podnet_args = ("--network", network) if network else () 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.replace = replace
self.remove = remove self.remove = remove
identifier_path = pathlib.PurePath(identifier) identifier_path = pathlib.PurePath(identifier)
@ -141,11 +143,13 @@ class PodKeeper:
@click.command() @click.command()
@click.option("--network", default="brodge", help="Network for the created pod") @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.option("--remove/--keep", default=True, help="Controls removal of pod after stopping")
@click.argument("identifier") @click.argument("identifier")
def main(network, replace, remove, identifier): def main(network, log_driver, replace, remove, identifier):
keeper = PodKeeper(network, replace, remove, identifier) keeper = PodKeeper(network, log_driver, replace, remove, identifier)
signal(SIGINT, keeper.destroy) signal(SIGINT, keeper.destroy)
signal(SIGTERM, keeper.destroy) signal(SIGTERM, keeper.destroy)