Stop deleting observability user during upgrades

Adjust the pre-uninstallation phase so that the observability user is
only deleted during full uninstallation. This prevents the user from
being deleted during upgrades and ensures the service contines to work
as intended after a major rhel upgrade. Also add precautionary runtime
requirements for shadow-utils and util-linux as both are required for
the creation of the observability user.

Resolves: RHEL-76915

Signed-off-by: ccowman <ccowman@redhat.com>
This commit is contained in:
ccowman 2025-03-03 12:49:08 +00:00
parent 9585a06293
commit 5f3eb3ff51

View File

@ -12,7 +12,7 @@ Collector with the supported components for a Red Hat build of OpenTelemetry}
%global godocs README.md
Name: opentelemetry-collector
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Red Hat build of OpenTelemetry
License: Apache-2.0
@ -26,6 +26,8 @@ BuildRequires: binutils
BuildRequires: git
BuildRequires: policycoreutils, checkpolicy, selinux-policy-devel
Requires(pre): shadow-utils
Requires(pre): util-linux
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
Requires(postun): /usr/sbin/userdel
@ -69,7 +71,9 @@ install -m 0755 -p ./opentelemetry-collector-with-options %{buildroot}%{_bindir}
/usr/bin/getent passwd observability > /dev/null || /usr/sbin/useradd -r -M -s /sbin/nologin -g observability -G systemd-journal observability
%postun
/usr/sbin/userdel observability
if [ $1 -eq 0 ]; then
/usr/sbin/userdel observability
fi
%post
semodule -i %{_datadir}/selinux/packages/otel_collector_journald.pp
@ -102,6 +106,12 @@ fi
%{_bindir}/*
%changelog
* Mon Mar 03 2025 Conor Cowman <ccowman@redhat.com> - 0.107.0-5
- Bump revision
- Add runtime requirements for shadow-utils and util-linux to ensure successful creation of observability user on installation
- Modify pre-uninstallation stage to only delete delete the observability user on full uninstallation to prevent the user being deleted during upgrades
Resolves: RHEL-76915
* Wed Feb 12 2025 Conor Cowman <ccowman@redhat.com> - 0.107.0-4
- Bump revision
- Fix reversion of previous dependency updates post golang update