~guoqiao/charm-nrpe:LP1906991-chown-nagios-dirs

Last commit made on 2021-02-05
Get this branch:
git clone -b LP1906991-chown-nagios-dirs https://git.launchpad.net/~guoqiao/charm-nrpe
Only Joe Guo can upload to this branch. If you are Joe Guo please log in for upload directions.

Branch merges

Branch information

Name:
LP1906991-chown-nagios-dirs
Repository:
lp:~guoqiao/charm-nrpe

Recent commits

5db37c5... by Joe Guo

nrpe_utils.py: ensure permission for /var/lib/nagios

This nrpe charm will install nagios-nrpe-server deb package.
In its preinst script[0], it will add nagios user and create `/var/lib/nagios` as home dir.

When other charm like hw-health relates to this charm, they will:

1) setup cronjob to run script
2) generate output file into /var/lib/nagios
3) read output file from /var/lib/nagios

Before, these are all done via root user, so no permission issue.
But recently, the cronjob user is switched from root to nagios, which caused following issues:

1) original output file was created by root, cronjob script by nagios user can not write to it.
2) In some situation, owner of `/var/lib/nagios/` is changed to root, cronjob script can not write file into this dir.

related bugs:

LP: #1906991
LP: #1904045
LP: #1866382

In this patch, we:

1) ensure `/var/lib/nagios` is owned by nagios user
2) setgid on dir group, to ensure any new created file in `/var/lib/nagios` has group `nagios`.

NOTE: this patch avoids to chown recursively, which implies, if there is a legacy output file
owned by root, we have to fix it manually, or fix it from the related charm side.

[0]: https://git.launchpad.net/ubuntu/+source/nagios-nrpe/tree/debian/nagios-nrpe-server.preinst#n28

Signed-off-by: Joe Guo <email address hidden>

ce7cc4e... by Joe Guo

check_status_file.py: fix python shebang

On focal, `/usr/bin/python` doesn't exist by default any more.
Change shebang: `/usr/bin/python` -> `/usr/bin/env python3`

Signed-off-by: Joe Guo <email address hidden>

8bbc270... by Celia Wang

Fix lint test

2d96021... by Drew Freiberger

Workaround lp#1897261 resulting in VIP configured in nagios

bdaf268... by Alvaro Uria

Merge branch 'blacken-20.10'

Reviewed-on: https://code.launchpad.net/~aluria/charm-nrpe/+git/nrpe-charm/+merge/392305
Reviewed-by: Drew Freiberger <email address hidden>

28e9f56... by Alvaro Uria

Fix linting by running black

ccbc86d... by Paul Collins

use separate lock file for external-nagios

Reviewed-on: https://code.launchpad.net/~pjdc/charm-nrpe/+git/nrpe-charm/+merge/389052
Reviewed-by: Tom Haddon <email address hidden>
Reviewed-by: Haw Loeung <email address hidden>

4cda701... by Paul Collins

use separate lock file for external-nagios

This ensures that we won't compete with other modules for
connection slots, should "max connections" happen to be set.

d4b8d2c... by Paul Collins

allow direct includes from /etc/rsync-juju.d

Reviewed-on: https://code.launchpad.net/~pjdc/charm-nrpe/+git/nrpe-charm/+merge/388856
Reviewed-by: Tom Haddon <email address hidden>

3d2dddc... by Paul Collins

allow direct includes from /etc/rsync-juju.d

This allows *.inc files to be added that override global settings.

For example, the ubuntu-mirror charm wants to be able to set "motd file",
and currently it can only do this by overwriting /etc/rsyncd.conf.

The *.conf files processed by &include can set defaults at top-level
that affect the rest of the modules in that file, but they cannot
affect the rest of the configuration, or change global options.