Compare commits

...

No commits in common. "imports/c8s/rig-1.1-2.el8" and "c8s" have entirely different histories.

8 changed files with 119 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
SOURCES/rig-1.1.tar.gz
/rig-1.1.tar.gz

View File

@ -1 +0,0 @@
5d4696794a5f5ff18d05a8595bbc53562b5f372a SOURCES/rig-1.1.tar.gz

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -0,0 +1,59 @@
From 90c5505d82b288bbc0b2e8b01e85b78d18a0bd18 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Thu, 9 Jun 2022 14:26:02 -0400
Subject: [PATCH] [rig] Use `tempfile` module for temp directory creation
Previously, a change was made to temp directory creation in an effort to
make it more secure. While that was largely handled, it left us with an
unhandled error in an edge case configuration. Rather than putting a
band-aid over that again, re-write the temp directory creation process
to leverage the `tempfile` module, so that we can safely and completely
ignore the id/name of a rig, and leave the use of that for the
communication socket.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
rigging/rigs/__init__.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/rigging/rigs/__init__.py b/rigging/rigs/__init__.py
index f14f312..29bb8b4 100644
--- a/rigging/rigs/__init__.py
+++ b/rigging/rigs/__init__.py
@@ -18,6 +18,7 @@ import string
import socket
import sys
import tarfile
+import tempfile
import time
from argparse import Action
@@ -110,7 +111,7 @@ class BaseRig():
self.log_debug("Initializing %s rig %s" %
(self.resource_name, self.id))
self._sock, self._sock_address = self._create_rig_socket()
- self._tmp_dir = self._create_temp_dir()
+ self._create_temp_dir()
self.files = []
def set_rig_id(self):
@@ -196,11 +197,11 @@ class BaseRig():
Create a temp directory for rig to use for saving created files too
"""
try:
- _dir = "%s.%s/" % (RIG_TMP_DIR_PREFIX, self.id)
- os.makedirs(_dir)
- return _dir
- except OSError:
- raise CannotConfigureRigError('failed to create temp directory')
+ self._tmp_dir = tempfile.mkdtemp(prefix='rig.', dir='/var/tmp')
+ except Exception as err:
+ raise CannotConfigureRigError(
+ "failed to create temp directory: %s" % err
+ )
def _load_args(self):
"""
--
2.35.3

View File

@ -1,7 +1,7 @@
Name: rig
Summary: Monitor a system for events and trigger specific actions
Version: 1.1
Release: 2%{?dist}
Release: 4%{?dist}
Url: https://github.com/TurboTurtle/rig
Source0: %{url}/archive/%{name}-%{version}.tar.gz
License: GPLv2
@ -16,6 +16,8 @@ BuildRequires: python3dist(systemd-python)
BuildRequires: python3dist(psutil)
Patch1: rig-fix-rig-list.patch
Patch2: rig-full-random-temp.patch
Patch3: sos-modify-sosreport-binary.patch
%description
Rig is a utility designed to watch or monitor specific system resources (e.g.
@ -26,6 +28,8 @@ troubleshooting and data collection for randomly occurring events.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%py3_build
@ -46,6 +50,12 @@ install -p -m644 man/en/rig.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/
%doc README.md
%changelog
* Wed Aug 06 2025 Jose Castillo <jcastill@redhat.com> - 1.1-4
- Add fix to avoid using deprecated sosreport command.
* Mon Jun 13 2022 Jake Hunsaker <jhunsake@redhat.com> - 1.1-3
- Backport change to temp dir creation to ignore rig ID
* Tue May 31 2022 Jake Hunsaker <jhunsake@redhat.com> - 1.1-2
- Backport fix of rig list race condition
@ -58,4 +68,4 @@ install -p -m644 man/en/rig.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/
- RHBZ#1888705
* Tue Jul 28 2020 Jake Hunsaker <jhunsake@redhat.com> - 1.0-1
- Version 1.0 release
- Version 1.0 release

View File

@ -0,0 +1,39 @@
From 57c2d62fd86522714e3eacc3fcd76ff8ad780e0b Mon Sep 17 00:00:00 2001
From: Jose Castillo <jcastillo@redhat.com>
Date: Thu, 7 Aug 2025 09:04:25 +0100
Subject: [PATCH] [sos] Modify sosreport binary
The 'sosreport' command has been deprecated in
sos upstream, and users should use now 'sos report' instead.
This commit prevents an error that occurs
when calling the old sos binary.
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
---
rig-c9s/rig-rig-1.1/rigging/actions/sosreport.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rigging/actions/sosreport.py b/rigging/actions/sosreport.py
index 5f7435a..abf6471 100644
--- a/rigging/actions/sosreport.py
+++ b/rigging/actions/sosreport.py
@@ -14,7 +14,7 @@ from pipes import quote
from rigging.actions import BaseAction
from rigging.exceptions import CannotConfigureRigError
-SOS_BIN = '/usr/sbin/sosreport --batch'
+SOS_BIN = '/usr/sbin/sos report --batch'
class SoSReport(BaseAction):
@@ -23,7 +23,7 @@ class SoSReport(BaseAction):
enabling_opt = 'sosreport'
enabling_opt_desc = 'Generate an sos report when triggered'
priority = 100
- required_binaries = ('sosreport',)
+ required_binaries = ('sos',)
sos_opts = ('only_plugins', 'skip_plugins', 'enable_plugins',
'plugin_option')
--
2.50.1

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (rig-1.1.tar.gz) = d62a46370f55cb700a47ad22b332586cf6b33f0e7b2145847b5a57cc0eb6d4368b6f356fcf97085471251f265596031a51664bad60d6666b959965c412fb20ce