diff --git a/.idea/misc.xml b/.idea/misc.xml index bc77e74..3ea7c1c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/podlaunch.iml b/.idea/podlaunch.iml index 8437fe6..909438d 100644 --- a/.idea/podlaunch.iml +++ b/.idea/podlaunch.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/image@.service b/image@.service index 1f653ba..8fdda8b 100644 --- a/image@.service +++ b/image@.service @@ -10,7 +10,7 @@ Type=oneshot Environment=PODMAN_SYSTEMD_UNIT=%n LogExtraFields=IMAGE=%i ExecCondition=/usr/bin/bash -c '[[ $(podman images --format json localhost/%i | jq .\\[0\\]) == "null" ]]' -Environment="IMAGE_TAG=localhost/%i" "BUILD_SOURCE=/docker/containers/%i" +Environment="IMAGE_TAG=localhost/%i" "BUILD_SOURCE=/infra/containers/%i" ExecStart=/usr/bin/podman build --tag ${IMAGE_TAG} $EXTRAOPTS ${BUILD_SOURCE} Restart=no RemainAfterExit=no @@ -18,4 +18,3 @@ TimeoutStartSec=1h SendSIGKILL=no LogRateLimitIntervalSec=15min LogRateLimitBurst=1500 - diff --git a/imagerebuild.py b/imagerebuild.py index 49b4da0..086a884 100755 --- a/imagerebuild.py +++ b/imagerebuild.py @@ -11,7 +11,7 @@ import sh from sh import podman from sh import systemctl -SERVICES_BASE_PATH = "/docker/services/" +SERVICES_BASE_PATH = "/infra/services/" def resolve_image_units(): @@ -91,11 +91,8 @@ def resolve_image_units(): @click.option("--verbose", is_flag=True, default=False, help="Enable INFO logging") def main(verbose): if verbose: - loglevel = logging.INFO - else: - loglevel = logging.CRITICAL + logging.root.setLevel(logging.INFO) - logging.basicConfig(level=loglevel) image_units = resolve_image_units() image_tags: Set[str] = set() @@ -172,4 +169,5 @@ def main(verbose): if __name__ == "__main__": + logging.basicConfig(level=logging.ERROR) main() diff --git a/main.py b/main.py index b55ca7b..afbdba0 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ import click import sh from sh import podman -SERVICES_BASE_PATH = "/docker/services/" +SERVICES_BASE_PATH = "/infra/services/" # noinspection PyCallingNonCallable shlog = sh(_out=sys.stdout, _err=sys.stderr) @@ -157,9 +157,13 @@ class PodKeeper: @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("--verbose", is_flag=True, default=False, help="Enable DEBUG logging") @click.argument("identifier") -def main(network, log_driver, log_level, replace, remove, identifier): - logging.basicConfig(level=logging.INFO) +def main(network, log_driver, log_level, replace, remove, verbose, identifier): + if verbose: + logging.root.setLevel(logging.DEBUG) + else: + logging.root.setLevel(logging.INFO) keeper = PodKeeper( network=network, @@ -182,4 +186,5 @@ def main(network, log_driver, log_level, replace, remove, identifier): if __name__ == '__main__': + logging.basicConfig() main() diff --git a/requirements.txt b/requirements.txt index c545a38..9c95504 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -click~=8.0.1 -sh~=1.14.2 +click~=8.1.7 +sh~=1.14.3