Locally sort remote group information, to prevent differences in sort output.

This commit is contained in:
Mark Verboom 2023-11-02 11:01:45 +01:00
parent 90488d2e9e
commit 3330cb6834
2 changed files with 5 additions and 3 deletions

View File

@ -20,4 +20,4 @@
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
(id -G -n "$user" | tr ' ' '\n' | sort) 2>/dev/null || true
(id -G -n "$user" | tr ' ' '\n') 2>/dev/null || true

View File

@ -26,13 +26,15 @@ os=$(cat "$__global/explorer/os")
mkdir "$__object/files"
# file has to be sorted for comparison with `comm`
sort "$__object/parameter/group" > "$__object/files/group.sorted"
# Use local sort for remote groups
sort "$__object/explorer/group" > "$__object/files/group-remote.sorted"
case "$state_should" in
present)
changed_groups="$(comm -13 "$__object/explorer/group" "$__object/files/group.sorted")"
changed_groups="$(comm -13 "$__object/files/group-remote.sorted" "$__object/files/group.sorted")"
;;
absent)
changed_groups="$(comm -12 "$__object/explorer/group" "$__object/files/group.sorted")"
changed_groups="$(comm -12 "$__object/files/group-remote.sorted" "$__object/files/group.sorted")"
;;
esac