Skip to content

Commit 5f17224

Browse files
committed
Use systemd service and timer to upload katello tracer
Instead of using cron, use systemd service and timer to upload the katello tracer. This is modern solution which is also supported by SUSE Micro distribution (which does not deliver a cron daemon)
1 parent b2e6957 commit 5f17224

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

packages/client/katello-host-tools/katello-host-tools.spec

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
%global katello_libdir %{python_libdir}/katello
3434

3535
Name: katello-host-tools
36-
Version: 4.5.0
37-
Release: 2%{?dist}
36+
Version: 4.6.0
37+
Release: 1%{?dist}
3838
Summary: A set of commands and yum plugins that support a Katello host
3939
Group: Development/Languages
4040
%if 0%{?suse_version}
@@ -54,6 +54,7 @@ BuildArch: noarch
5454
%endif
5555

5656
Requires: subscription-manager
57+
Requires: systemd
5758
Obsoletes: %{name}-fact-plugin < %{version}-%{release}
5859
Obsoletes: katello-agent < %{version}-%{release}
5960

@@ -98,11 +99,6 @@ BuildArch: noarch
9899
Summary: Adds Tracer functionality to a client managed by katello-host-tools
99100
Group: Development/Languages
100101
Requires: %{name} = %{version}-%{release}
101-
%if 0%{?suse_version}
102-
Requires: cronie
103-
%else
104-
Requires: crontabs
105-
%endif
106102
%if %{yum_install}
107103
Requires: python2-tracer >= 0.6.12
108104
%endif
@@ -208,9 +204,12 @@ mkdir -p %{buildroot}%{_sbindir}
208204
cp extra/katello-tracer-upload-dnf %{buildroot}%{_sbindir}/katello-tracer-upload
209205
%endif
210206

211-
# crontab
212-
mkdir -p %{buildroot}%{_sysconfdir}/cron.d/
213-
cp extra/katello-tracer-upload.cron %{buildroot}%{_sysconfdir}/cron.d/katello-tracer-upload
207+
# tracer systemd service and timer
208+
install -Dp -m0644 extra/katello-tracer-upload.service.in %{buildroot}%{_unitdir}/katello-tracer-upload.service
209+
install -Dp -m0644 extra/katello-tracer-upload.timer %{buildroot}%{_unitdir}/katello-tracer-upload.timer
210+
211+
# replace @SBIN_PATH@ in the service file with the actual path to the executable
212+
sed -i "s|@SBIN_PATH@|%{_sbindir}|" %{buildroot}%{_unitdir}/katello-tracer-upload.service
214213
%endif
215214

216215
%clean
@@ -223,6 +222,15 @@ katello-enabled-repos-upload 2> /dev/null
223222
exit 0
224223
%endif
225224

225+
%post
226+
%systemd_post katello-tracer-upload.timer
227+
228+
%preun
229+
%systemd_preun katello-tracer-upload.timer
230+
231+
%postun
232+
%systemd_postun katello-tracer-upload.timer
233+
226234
%files
227235
%defattr(-,root,root,-)
228236
%if 0%{?rhel} == 6
@@ -273,7 +281,6 @@ exit 0
273281
%dir %{_usr}/lib/zypp
274282
%dir %{_usr}/lib/zypp/plugins
275283
%dir %{plugins_dir}
276-
%dir %{_sysconfdir}/cron.d/
277284
%{plugins_dir}/tracer_upload.py
278285
%else
279286
%if %{yum_install}
@@ -284,12 +291,17 @@ exit 0
284291
%endif
285292
%{katello_libdir}/tracer
286293
%{plugins_confdir}/tracer_upload.conf
287-
%config(noreplace) %attr(0644, root, root) %{_sysconfdir}/cron.d/katello-tracer-upload
294+
%{_unitdir}/katello-tracer-upload.service
295+
%{_unitdir}/katello-tracer-upload.timer
288296
%attr(750, root, root) %{_sbindir}/katello-tracer-upload
289297
%endif
290298

291299

292300
%changelog
301+
* Tue Jun 09 2026 Bernhard Suttner <suttner@atix.de> - 4.6.0-1
302+
- Use systemd timer implementation instead of cron based
303+
solution for tracer upload
304+
293305
* Wed Nov 05 2025 Bernhard Suttner <suttner@atix.de> - 4.5.0-2
294306
- Fix missing /etc/cron.d/ dir for SLES / OBS build.
295307

0 commit comments

Comments
 (0)