userlogrotate: Ensure we use a valid group name
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2697|8|2689|7|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/465//ansiblelint">Evolix » ansible-roles » unstable #465</a>
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2697|8|2689|7|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/465//ansiblelint">Evolix » ansible-roles » unstable #465</a>
gitea/ansible-roles/pipeline/head This commit looks good
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)
|
* vrrpd: variable to force update the switch script (default: false)
|
||||||
* webapps/nextcloud: Add Ceph volume to fstab
|
* webapps/nextcloud: Add Ceph volume to fstab
|
||||||
* webapps/nextcloud: Set home directory's mode
|
* webapps/nextcloud: Set home directory's mode
|
||||||
|
* userlogrotate: Use user's primary group when user's name is not an existing group
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ for path in ${SYSTEM_LOGS_SEARCH_PATHS[@]}; do
|
||||||
for file in ${log_paths}; do
|
for file in ${log_paths}; do
|
||||||
user="$(user_for "${file}")"
|
user="$(user_for "${file}")"
|
||||||
group="$(group_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}"
|
rotate "${file}" "${group}":"${user}"
|
||||||
delete_old "$(dirname "${file}")"
|
delete_old "$(dirname "${file}")"
|
||||||
done
|
done
|
||||||
|
@ -85,6 +88,9 @@ for path in ${APPLICATIVE_LOGS_SEARCH_PATHS[@]}; do
|
||||||
for file in ${log_paths}; do
|
for file in ${log_paths}; do
|
||||||
user="$(user_for "${file}")"
|
user="$(user_for "${file}")"
|
||||||
group="$(group_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}"
|
rotate "${file}" "${group}":"${user}"
|
||||||
delete_old "$(dirname "${file}")"
|
delete_old "$(dirname "${file}")"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue