diff --git a/rhel7-sausage-api.spec b/rhel7-sausage-api.spec index ad8aba0..07d4c9c 100644 --- a/rhel7-sausage-api.spec +++ b/rhel7-sausage-api.spec @@ -1,67 +1,69 @@ %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: 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 python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES +/usr/bin/mkdir -p %{buildroot}/etc/systemd/system/ install -m 755 sausage_api.service %{buildroot}/etc/systemd/system/ %clean rm -rf $RPM_BUILD_ROOT %files -f INSTALLED_FILES %defattr(-,root,root) +/etc/systemd/system/sausage_api.service %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 %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