forked from evolix/ansible-roles
userlogrotate: Ensure we use a valid group name
Use user's primary group when user's name is not an existing group.
This commit is contained in:
parent
d67e2b122f
commit
4c9e4a30cc
|
@ -67,6 +67,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
|||
* vrrpd: variable to force update the switch script (default: false)
|
||||
* webapps/nextcloud: Add Ceph volume to fstab
|
||||
* webapps/nextcloud: Set home directory's mode
|
||||
* userlogrotate: Use user's primary group when user's name is not an existing group
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -73,6 +73,9 @@ for path in ${SYSTEM_LOGS_SEARCH_PATHS[@]}; do
|
|||
for file in ${log_paths}; do
|
||||
user="$(user_for "${file}")"
|
||||
group="$(group_for "${file}")"
|
||||
if ! getent group "${user}" > /dev/null 2> /dev/null; then
|
||||
group="$(id -gn "${user}")"
|
||||
fi
|
||||
rotate "${file}" "${group}":"${user}"
|
||||
delete_old "$(dirname "${file}")"
|
||||
done
|
||||
|
@ -85,6 +88,9 @@ for path in ${APPLICATIVE_LOGS_SEARCH_PATHS[@]}; do
|
|||
for file in ${log_paths}; do
|
||||
user="$(user_for "${file}")"
|
||||
group="$(group_for "${file}")"
|
||||
if ! getent group "${user}" > /dev/null 2> /dev/null; then
|
||||
group="$(id -gn "${user}")"
|
||||
fi
|
||||
rotate "${file}" "${group}":"${user}"
|
||||
delete_old "$(dirname "${file}")"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue