From c64ec6bbf87c37be6b6ea423b20dd4c9685b3a61 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Thu, 15 Apr 2021 14:45:06 -0400 Subject: [PATCH] check if is_k8s --- awx/main/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 59e9d7059d..331a00bad9 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -400,6 +400,8 @@ def purge_old_stdout_files(): @task(queue=get_local_queuename) def cleanup_execution_environment_images(): + if settings.IS_K8S: + return images_in_use = [ee.image for ee in ExecutionEnvironment.objects.all()] images_system = subprocess.run("podman images -a --format json".split(" "), capture_output=True) if len(images_system.stdout) > 0: @@ -414,7 +416,7 @@ def cleanup_execution_environment_images(): logger.debug(f"Cleanup execution environment images: deleting {image_name}, {image_size:.0f} MB") process = subprocess.run(['podman', 'rmi', image_name, '-f'], stdout=subprocess.DEVNULL) if process.returncode != 0: - logger.debug(f"Unsuccessful deletion of image {image_name}") + logger.debug(f"Unsuccessfully deleted image {image_name}") @task(queue=get_local_queuename)