File golang-github-vpenso-prometheus_slurm_exporter.spec of Package golang-github-vpenso-prometheus_slurm_exporter

# spec file for package golang-github-vpenso-prometheus_slurm_exporter
# Copyright (c) 2021 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via


Name:           golang-github-vpenso-prometheus_slurm_exporter
Version:        0.19
Release:        0
Summary:        Prometheus exporter for Slurm metrics
License:        GPL-3.0-or-later
Group:          System/Management
Source1:        vendor.tar.gz
Patch0:         use_sbin.patch
BuildRequires:  golang-packaging
Requires(pre):  shadow
Requires:       /usr/bin/sinfo
Requires:       /usr/bin/squeue

Prometheus collector and exporter for metrics extracted from the Slurm
resource scheduling system.

%setup -q -n prometheus-slurm-exporter-%{version}
%setup -q -n prometheus-slurm-exporter-%{version} -T -D -a 1
%patch0 -p1

%{gobuild} -mod=vendor ""

# No %%{gosrc}
install -D -m 0644 lib/systemd/prometheus-slurm-exporter.service %{buildroot}%{_unitdir}/prometheus-slurm_exporter.service
mv %{buildroot}%{_bindir}/ %{buildroot}%{_sbindir}/
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcprometheus-slurm_exporter

%service_add_pre prometheus-slurm_exporter.service
getent group prometheus >/dev/null || %{_sbindir}/groupadd -r prometheus
getent passwd prometheus >/dev/null || %{_sbindir}/useradd -r -g prometheus -d %{_localstatedir}/lib/prometheus -M -s /sbin/nologin prometheus

%service_add_post prometheus-slurm_exporter.service

%service_del_preun prometheus-slurm_exporter.service

%service_del_postun prometheus-slurm_exporter.service

%files -f file.lst
%license LICENSE

openSUSE Build Service is sponsored by