diff --git a/rhel7-sausage-api.spec b/rhel7-sausage-api.spec index faa4ae4..4ec9dbc 100644 --- a/rhel7-sausage-api.spec +++ b/rhel7-sausage-api.spec @@ -1,63 +1,67 @@ %define name sausage-api %define version 0.1.0 %define unmangled_version 0.1.0 %define unmangled_version 0.1.0 %define release 1 Summary: SLURM account usage API Name: %{name} Version: %{version} Release: %{release} Source0: %{name}-%{unmangled_version}.tar.gz License: GPLv3 Group: Application/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildArch: noarch Vendor: ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE Url: https://c4science.ch/source/sausage-api/ -BuildRequires: systemd-rpm-macros, python3-setuptools, python36-falcon, python36-gunicorn, python36-elasticsearch6 +BuildRequires: python3-setuptools, python36-falcon, python36-gunicorn, python36-elasticsearch6 %description This project implements a Falcon API service to display CPU / GPU consumption per account in a Slurm cluster. The service queries the elastic instance created by the jobcomp/elasticsearch plugin provided by SchedMD. %package sausage-api Summary: SLURM account usage API Requires: python36-falcon, python36-gunicorn, python36-elasticsearch6 %description sausage-api SLURM account usage Falcon API service %prep %setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version} %build python3 setup.py build %install sausage-api-core python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES install -m 755 sausage_api.service %{buildroot}/etc/systemd/system/ %clean rm -rf $RPM_BUILD_ROOT %files -f INSTALLED_FILES %defattr(-,root,root) %pre getent group sausage >/dev/null || groupadd -r sausage getent passwd sausage >/dev/null || useradd -r -g sausage -d /var/spool/sausage -s /sbin/nologin sausage %post -%systemd_post sausage_api.service - -%preun -%systemd_preun sausage_api.service +%if 0%{?rhel} < 8 +/bin/systemctl --system daemon-reload &> /dev/null +/bin/systemctl --system enable sausage_api &> /dev/null +%endif +%postun +%if 0%{?rhel} < 8 +/bin/systemctl --system daemon-reload &> /dev/nul +%endif