From 5fc4b8c1060eacd726934ad823519be21bc80e30 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 23 Sep 2025 08:07:00 -0700 Subject: [PATCH] action: more debugging information (#85839) * action: more debugging information * Allow user to identify underlying problem with chmod, setfacl command. Signed-off-by: Abhijeet Kasurde * Review requests Signed-off-by: Abhijeet Kasurde * Review requests Signed-off-by: Abhijeet Kasurde * Review requests Signed-off-by: Abhijeet Kasurde --------- Signed-off-by: Abhijeet Kasurde --- lib/ansible/plugins/action/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index dd1981f3843..9bcba7fbe99 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -671,8 +671,18 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin): become_user, setfacl_mode) - if res['rc'] == 0: - return remote_paths + match res.get('rc'): + case 0: + return remote_paths + case 2: + # invalid syntax (for example, missing user, missing colon) + self._display.debug(f"setfacl command failed with an invalid syntax. Trying chmod instead. Err: {res!r}") + case 127: + # setfacl binary does not exists or we don't have permission to use it. + self._display.debug(f"setfacl binary does not exist or does not have permission to use it. Trying chmod instead. Err: {res!r}") + case _: + # generic debug message + self._display.debug(f'Failed to set facl {setfacl_mode}, got:{res!r}') # Step 3b: Set execute if we need to. We do this before anything else # because some of the methods below might work but not let us set