Install afsmon to a virtualenv

In preparation for updating mirror-update to Noble we move the afsmon
installation into a virtualenv. This is necessary because pip on Noble
fails by default when installing tools globally. This should be backward
compatbile with the old server too so we land this first and ensure it
continues to work happily there first.

While we are fixing afsmon for Noble we also update file matchers for
afsmon and afs-release roles. Currently they are either missing or miss
applied to the mirror jobs rather than the mirror-update jobs. Fix this.

Change-Id: I4134a6e98f7face59612f9e39c3350129af404ea
This commit is contained in:
Clark Boylan
2025-05-28 08:56:11 -07:00
parent e0d9eb672b
commit 27d638c4a4
4 changed files with 9 additions and 16 deletions

View File

@@ -6,20 +6,12 @@
group: root
mode: 0755
- name: Install dependency packages
package:
name:
- python3-pip
- python3-pbr
- python3-statsd
- python3-prettytable
state: present
- name: Install afsmon
- name: Install afsmon to dedicated venv
pip:
name: afsmon
state: present
executable: pip3
virtualenv: /usr/local/afsmonvenv
virtualenv_command: '/usr/bin/python3 -m venv'
- name: Install configuration file
copy:
@@ -31,7 +23,7 @@
cron:
name: 'afsmon'
state: present
job: '/usr/local/bin/afsmon statsd >> /var/log/afsmon/afsmon.log 2>&1'
job: '/usr/local/afsmonvenv/bin/afsmon statsd >> /var/log/afsmon/afsmon.log 2>&1'
hour: '*'
minute: '30'
@@ -39,4 +31,4 @@
include_role:
name: logrotate
vars:
logrotate_file_name: '/var/log/afsmon/afsmon.log'
logrotate_file_name: '/var/log/afsmon/afsmon.log'

View File

@@ -76,7 +76,7 @@ def test_afs_release_script_run(host):
assert cmd.succeeded
def test_afsmon_installed(host):
f = host.file('/usr/local/bin/afsmon')
f = host.file('/usr/local/afsmonvenv/bin/afsmon')
assert f.exists
f = host.file('/etc/afsmon.cfg')

View File

@@ -264,6 +264,8 @@
- inventory/service/host_vars/mirror
- playbooks/service-mirror-update.yaml
- playbooks/roles/mirror-update/
- playbooks/roles/afs-release/
- playbooks/roles/afsmon/
- playbooks/roles/reprepro/
- playbooks/roles/iptables/
- playbooks/roles/logrotate/
@@ -282,8 +284,6 @@
- inventory/service/host_vars/mirror
- inventory/service/group_vars/mirror.yaml
- playbooks/roles/mirror/
- playbooks/roles/afs-release/
- playbooks/roles/afsmon/
- playbooks/roles/iptables/
- playbooks/roles/logrotate/
- roles/openafs-client/

View File

@@ -548,6 +548,7 @@
- playbooks/roles/mirror-update/
- playbooks/roles/reprepro/
- playbooks/roles/afs-release/
- playbooks/roles/afsmon/
- playbooks/service-mirror-update.yaml
- playbooks/zuul/templates/host_vars/mirror-update99.opendev.org.yaml.j2
- testinfra/test_mirror-update.py