summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2022-10-28 19:17:13 -0400
committerGitHub <noreply@github.com>2022-10-28 16:17:13 -0700
commit25f8b9829dd42c013e8a84a0868c22829db2ce27 (patch)
tree409cf3f8e731b3962e4305c3a285950c45d69647
parent5c8928fa44286e159a0ad7e4707d5944cd5edb7f (diff)
downloadansible-25f8b9829dd42c013e8a84a0868c22829db2ce27.tar.gz
mention acl in permissions errors (#79209) (#79251)
as chmod/mode is not the only thing we attempt and Ubuntu not shipping acl in newer versions can lead to some confusion fixes #79146 (cherry picked from commit 0f18ddca9f4b04cacd85a8a54a6fcc8f8b2ee38e)
-rw-r--r--changelogs/fragments/mention_acl.yml2
-rw-r--r--lib/ansible/plugins/action/__init__.py8
-rw-r--r--test/units/plugins/action/test_action.py2
3 files changed, 7 insertions, 5 deletions
diff --git a/changelogs/fragments/mention_acl.yml b/changelogs/fragments/mention_acl.yml
new file mode 100644
index 0000000000..bb8093d7c9
--- /dev/null
+++ b/changelogs/fragments/mention_acl.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - updated error messages to include 'acl' and not just mode changes when failing to set required permissions on remote.
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py
index 9ee9a1c122..52795eb8e2 100644
--- a/lib/ansible/plugins/action/__init__.py
+++ b/lib/ansible/plugins/action/__init__.py
@@ -660,7 +660,7 @@ class ActionBase(ABC):
res = self._remote_chmod(remote_paths, 'u+x')
if res['rc'] != 0:
raise AnsibleError(
- 'Failed to set file mode on remote temporary files '
+ 'Failed to set file mode or acl on remote temporary files '
'(rc: {0}, err: {1})'.format(
res['rc'],
to_native(res['stderr'])))
@@ -675,9 +675,9 @@ class ActionBase(ABC):
if remote_user in self._get_admin_users():
raise AnsibleError(
'Failed to change ownership of the temporary files Ansible '
- 'needs to create despite connecting as a privileged user. '
- 'Unprivileged become user would be unable to read the '
- 'file.')
+ '(via chmod nor setfacl) needs to create despite connecting as a '
+ 'privileged user. Unprivileged become user would be unable to read'
+ ' the file.')
# Step 3d: Try macOS's special chmod + ACL
# macOS chmod's +a flag takes its own argument. As a slight hack, we
diff --git a/test/units/plugins/action/test_action.py b/test/units/plugins/action/test_action.py
index 78c6fe0571..3334a7b9fd 100644
--- a/test/units/plugins/action/test_action.py
+++ b/test/units/plugins/action/test_action.py
@@ -425,7 +425,7 @@ class TestActionBase(unittest.TestCase):
'stderr': '',
}
assertThrowRegex(
- 'Failed to set file mode on remote temporary file',
+ 'Failed to set file mode or acl on remote temporary files',
execute=True)
action_base._remote_chmod.return_value = {
'rc': 0,