From 331c3e1ce7326d3f3e73be8f9f736b1bc0e0d94f Mon Sep 17 00:00:00 2001 From: ccowman Date: Thu, 6 Mar 2025 14:50:13 +0000 Subject: [PATCH] Stop deleting observability user during upgrades Adjust the post-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. The %postun section of the spec was accidentally removed in the previously merged fix for this issue. This commit is identical but fixes this error. Resolves: RHEL-81967 Signed-off-by: ccowman --- opentelemetry-collector.spec | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/opentelemetry-collector.spec b/opentelemetry-collector.spec index 892f49d..9bd2d6d 100644 --- a/opentelemetry-collector.spec +++ b/opentelemetry-collector.spec @@ -12,7 +12,7 @@ Collector with the supported components for a Red Hat build of OpenTelemetry} %global godocs README.md Name: opentelemetry-collector -Release: 3%{?dist} +Release: 4%{?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 +* Thu Mar 06 2025 Conor Cowman - 0.107.0-4 +- Bump revision +- Add runtime requirements for shadow-utils and util-linux to ensure successful creation of observability user on installation +- Modify post-uninstallation stage to only delete delete the observability user on full uninstallation to prevent the user being deleted during upgrades + Resolves: RHEL-81967 + * Wed Feb 12 2025 Conor Cowman - 0.107.0-3 - Bump revision - Update tarball golang from 1.21.0 to 1.22.11