diff options
author | cos <cos> | 2024-04-19 11:00:50 +0200 |
---|---|---|
committer | cos <cos> | 2024-04-19 11:00:50 +0200 |
commit | 0de1713b119eeea01add85051f2db1c12b9dd85a (patch) | |
tree | 230bd814e032d8df05bc3313d46bcb2fdcd4456f | |
parent | d921f2206c52a0abc550d35c7f2da920b13e0625 (diff) | |
download | ansible-0de1713b119eeea01add85051f2db1c12b9dd85a.zip |
wip: Fix become_user with FreeBSDfix/become_user+freebsd-v2.4.13
Details at https://www.netizen.se/docs/ansible-chmod
-rw-r--r-- | lib/ansible/plugins/action/__init__.py | 3 | ||||
-rw-r--r-- | lib/ansible/plugins/shell/__init__.py | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 8f92325395..5f83e29a66 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -820,6 +820,9 @@ class ActionBase(ABC): ''' cmd = self._connection._shell.set_user_facl(paths, user, mode) res = self._low_level_execute_command(cmd, sudoable=sudoable) + if res['rc'] != 0: + cmd = self._connection._shell.set_user_facl_nfs(paths, user, mode) + res = self._low_level_execute_command(cmd, sudoable=sudoable) return res def _execute_remote_stat(self, path, all_vars, follow, tmp=None, checksum=True): diff --git a/lib/ansible/plugins/shell/__init__.py b/lib/ansible/plugins/shell/__init__.py index d5db261f68..766d731652 100644 --- a/lib/ansible/plugins/shell/__init__.py +++ b/lib/ansible/plugins/shell/__init__.py @@ -127,6 +127,14 @@ class ShellBase(AnsiblePlugin): return ' '.join(cmd) + def set_user_facl_nfs(self, paths, user, mode): + """Sets nfs acls for users. Should perhaps be in suffix-less function""" + cmd = ['setfacl', '-m', 'u:%s:%s::allow' % (user, mode)] + cmd.extend(paths) + cmd = [shlex.quote(c) for c in cmd] + + return ' '.join(cmd) + def remove(self, path, recurse=False): path = shlex.quote(path) cmd = 'rm -f ' |