From e04138afb8c7ffdfe4be159323d98d404426bb88 Mon Sep 17 00:00:00 2001 From: David Parker Date: Tue, 26 Nov 2024 21:40:39 +0000 Subject: [PATCH] [patch] get_default_storage_classes should always set failed=False (#1578) --- .../plugins/action/get_default_storage_classes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ibm/mas_devops/plugins/action/get_default_storage_classes.py b/ibm/mas_devops/plugins/action/get_default_storage_classes.py index fe4583c9b..c87b8d1da 100644 --- a/ibm/mas_devops/plugins/action/get_default_storage_classes.py +++ b/ibm/mas_devops/plugins/action/get_default_storage_classes.py @@ -27,11 +27,16 @@ def run(self, tmp=None, task_vars=None): dynClient = get_api_client() storageClasses = getDefaultStorageClasses(dynClient) + # We don't want to fail if we can't find any default storage classes, doing so will + # result in roles/playbooks failing in environments where none of the default + # storage classes are available. We use the success=false to track when we couldn't + # find a default storage class, which does not trigger Ansible treating the action as + # failed. if storageClasses.provider is None: return dict( - message=f"Failed to find default storage classes", + message=f"Failed to find any default supported storage classes", success=False, - failed=True, + failed=False, changed=False, **vars(storageClasses) )