From 392fd0deaaacaeec75ff786b8b48a6ed10c47eb0 Mon Sep 17 00:00:00 2001 From: Silejonu <48565914+Silejonu@users.noreply.github.com> Date: Wed, 7 May 2025 16:03:42 +0200 Subject: [PATCH] fix(acl): correctly assert needed changes when recursive is true --- changelogs/fragments/638_fix_recursive_acl.yml | 2 ++ plugins/modules/acl.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/638_fix_recursive_acl.yml diff --git a/changelogs/fragments/638_fix_recursive_acl.yml b/changelogs/fragments/638_fix_recursive_acl.yml new file mode 100644 index 0000000..cf4ed39 --- /dev/null +++ b/changelogs/fragments/638_fix_recursive_acl.yml @@ -0,0 +1,2 @@ +bugfixes: + - acl - correctly assert needed changes when pointing to a directory and recursive is set to true. diff --git a/plugins/modules/acl.py b/plugins/modules/acl.py index 4cc94e7..3e9549c 100644 --- a/plugins/modules/acl.py +++ b/plugins/modules/acl.py @@ -243,13 +243,19 @@ def acl_changed(module, cmd, entry, use_nfsv4_acls=False): cmd.insert(1, '--test') lines = run_acl(module, cmd) counter = 0 + lines_checked = 0 + lines_unchanged = 0 for line in lines: + lines_checked += 1 if line.endswith('*,*') and not use_nfsv4_acls: - return False + lines_unchanged += 1 # if use_nfsv4_acls and entry is listed if use_nfsv4_acls and entry == line: counter += 1 + if lines_unchanged == lines_checked: + return False + # The current 'nfs4_setfacl --test' lists a new entry, # which will be added at the top of list, followed by the existing entries. # So if the entry has already been registered, the entry should be find twice.