__init__.py (ansible-2.14.0) | : | __init__.py (ansible-2.14.1rc1) | ||
---|---|---|---|---|
skipping to change at line 676 | skipping to change at line 676 | |||
if res['rc'] == 0: | if res['rc'] == 0: | |||
return remote_paths | return remote_paths | |||
# Step 3b: Set execute if we need to. We do this before anything else | # 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 +x | # because some of the methods below might work but not let us set +x | |||
# as part of them. | # as part of them. | |||
if execute: | if execute: | |||
res = self._remote_chmod(remote_paths, 'u+x') | res = self._remote_chmod(remote_paths, 'u+x') | |||
if res['rc'] != 0: | if res['rc'] != 0: | |||
raise AnsibleError( | 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( | '(rc: {0}, err: {1})'.format( | |||
res['rc'], | res['rc'], | |||
to_native(res['stderr']))) | to_native(res['stderr']))) | |||
# Step 3c: File system ACLs failed above; try falling back to chown. | # Step 3c: File system ACLs failed above; try falling back to chown. | |||
res = self._remote_chown(remote_paths, become_user) | res = self._remote_chown(remote_paths, become_user) | |||
if res['rc'] == 0: | if res['rc'] == 0: | |||
return remote_paths | return remote_paths | |||
# Check if we are an admin/root user. If we are and got here, it means | # Check if we are an admin/root user. If we are and got here, it means | |||
# we failed to chown as root and something weird has happened. | # we failed to chown as root and something weird has happened. | |||
if remote_user in self._get_admin_users(): | if remote_user in self._get_admin_users(): | |||
raise AnsibleError( | raise AnsibleError( | |||
'Failed to change ownership of the temporary files Ansible ' | 'Failed to change ownership of the temporary files Ansible ' | |||
'needs to create despite connecting as a privileged user. ' | '(via chmod nor setfacl) needs to create despite connecting as a | |||
'Unprivileged become user would be unable to read the ' | ' | |||
'file.') | 'privileged user. Unprivileged become user would be unable to re | |||
ad' | ||||
' the file.') | ||||
# Step 3d: Try macOS's special chmod + ACL | # Step 3d: Try macOS's special chmod + ACL | |||
# macOS chmod's +a flag takes its own argument. As a slight hack, we | # macOS chmod's +a flag takes its own argument. As a slight hack, we | |||
# pass that argument as the first element of remote_paths. So we end | # pass that argument as the first element of remote_paths. So we end | |||
# up running `chmod +a [that argument] [file 1] [file 2] ...` | # up running `chmod +a [that argument] [file 1] [file 2] ...` | |||
try: | try: | |||
res = self._remote_chmod([chmod_acl_mode] + list(remote_paths), '+a' ) | res = self._remote_chmod([chmod_acl_mode] + list(remote_paths), '+a' ) | |||
except AnsibleAuthenticationFailure as e: | except AnsibleAuthenticationFailure as e: | |||
# Solaris-based chmod will return 5 when it sees an invalid mode, | # Solaris-based chmod will return 5 when it sees an invalid mode, | |||
# and +a is invalid there. Because it returns 5, which is the same | # and +a is invalid there. Because it returns 5, which is the same | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 6 lines changed or added |