roles/openafs-client: small overhaul of rpm builds

The main failure case for the openafs packages is when the images are
running an old kernel and upstream has moved on, and we only have
headers available for new kernels.  This usually indicates image
building is stuck.  This adds an inline check to make sure the running
kernel has headers available; if not it bails out with a clear
message.

When this does fail to build, we'd like to get some output of why the
service fails.  This adds an error handler to systemctl dump the
status on failure.

We can cleanup the build a bit to remove the centos7 builds now.

Finally, the log copying was broken -- the paths are different on
centos 8 and 9.  The extant "cp" would fail on centos8 and then the
chown would never run, so we wouldn't collect the build logs.  Make
this a find/cp pair too.

Change-Id: Iaa38357a8a683a474c38900f5dc322e088849416
This commit is contained in:
Ian Wienand 2024-01-18 11:01:39 +11:00
parent c163bb33f0
commit 7f2e6f3325
No known key found for this signature in database
3 changed files with 41 additions and 32 deletions

View File

@ -13,11 +13,10 @@
shell: |
DKMS_MAKE_LOGS=/var/lib/dkms-make-logs
mkdir ${DKMS_MAKE_LOGS}
# NOTE(ianw) 2023-04-27 This follwoing find may be redundant
# now; it does not seem to match anything on centos 9-stream
# at least.
# pre ~ 9-stream
find /var/lib/dkms/ -type d -wholename "*/log" -exec cp -r --parents \{\} ${DKMS_MAKE_LOGS} \;
cp /var/lib/dkms/openafs/*/build/make.log ${DKMS_MAKE_LOGS}
# >= 9-stream
find /var/lib/dkms/ -type d -wholename "*/build" -exec cp -r --parents \{\} ${DKMS_MAKE_LOGS} \;
chown zuul:zuul ${DKMS_MAKE_LOGS}
become: yes
- include_role:

View File

@ -91,8 +91,14 @@
- openafs-client
- name: Ensure openafs-client service running
service:
name: openafs-client
state: started
enabled: yes
become: yes
block:
- name: Start service
service:
name: openafs-client
state: started
enabled: yes
become: yes
rescue:
- name: Dump service status
command: systemctl status openafs-client.service
become: yes

View File

@ -28,34 +28,38 @@
gpgcheck: '{{ openafs_client_yum_repo_gpg_check }}'
become: yes
- name: Install kernel modules CentOS 7
yum:
name:
- kernel-devel
- dkms
- gcc
- dkms-openafs
enablerepo: epel # dkms
state: present
become: yes
when: ansible_distribution_version is version('8', '<')
- name: Install kernel modules CentOS 8
- name: Install kernel dev packages
dnf:
name:
- kernel-devel
- dkms
- gcc
- make
- dkms
enablerepo: epel # dkms
state: latest
become: yes
- name: Compare installed headers v running kernel
shell: |
cur=$(uname -r)
rpm=$(rpm -qP kernel-devel | grep uname)
if ! echo ${rpm} | grep -q ${cur}; then
echo "*** Running kernel does not have headers"
echo "cur=${cur}"
echo "kernels"
rpm -qP kernel-devel | grep uname
exit 1
else
echo "Headers look OK"
fi
- name: Install openafs kernel modules
dnf:
name:
- openafs
- openafs-krb5
- openafs-client
- dkms-openafs
enablerepo: epel # dkms
state: present
become: yes
when: ansible_distribution_version is version('8', '>=')
- name: Install client
yum:
name:
- openafs-krb5
- openafs-client
state: present
become: yes