Added more detailled output why stopped

This commit is contained in:
2025-07-17 00:05:44 +02:00
parent 627187cecb
commit 84d0fd6346

View File

@@ -226,11 +226,21 @@ def is_image_whitelisted(container, images):
return any(img in info for img in images) return any(img in info for img in images)
def is_container_stop_required(containers): def is_container_stop_required(containers):
"""Check if any of the containers are using images that are not whitelisted.""" """
return any( Check if any of the containers are using images that are not whitelisted.
not is_image_whitelisted(c, IMAGES_NO_STOP_REQUIRED) If so, print them out and return True; otherwise return False.
for c in containers """
) # Find all containers whose image isnt on the whitelist
not_whitelisted = [
c for c in containers
if not is_image_whitelisted(c, IMAGES_NO_STOP_REQUIRED)
]
if not_whitelisted:
print(f"Containers requiring stop because they are not whitelisted: {', '.join(not_whitelisted)}")
return True
return False
def create_volume_directory(volume_name): def create_volume_directory(volume_name):
"""Create necessary directories for backup.""" """Create necessary directories for backup."""