File openstack-monasca-persister.spec of Package openstack-monasca-persister
#
# spec file for package openstack-monasca-persister
#
# Copyright (c) 2024 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 https://bugs.opensuse.org/
#
%global sname monasca-persister
Name: openstack-monasca-persister
Version: 9.0.1~dev2
Release: 0
Summary: Persists state transistions in database
License: Apache-2.0
Group: Development/Languages/Python
URL: https://wiki.openstack.org/wiki/Monasca
Source0: monasca-persister-master.tar.gz
Source1: openstack-monasca-persister.service
Source2: openstack-monasca-persister.logrotate
BuildRequires: openstack-macros
BuildRequires: python3-cassandra-driver
BuildRequires: python3-elasticsearch
BuildRequires: python3-influxdb
BuildRequires: python3-monasca-common
BuildRequires: python3-oslo.config
BuildRequires: python3-oslo.log
BuildRequires: python3-oslotest
BuildRequires: python3-setuptools
BuildRequires: python3-simplejson
BuildRequires: python3-six
BuildRequires: python3-stestr
Requires: logrotate
Requires: python3-monasca-persister = %{version}-%{release}
BuildArch: noarch
%if 0%{?suse_version}
BuildRequires: systemd-rpm-macros
Requires(pre): pwdutils
%{?systemd_requires}
%else
BuildRequires: systemd
Requires(post): systemd
Requires(postun): systemd
Requires(pre): shadow-utils
Requires(preun): systemd
%endif
%description
Consumes metrics and alarm state transitions from message queue and stores them in database.
Data is read from Kafka queue and saved either in InfluxDB or Cassandra
%package -n python3-monasca-persister
Summary: Persists state transistions in database
Group: Development/Languages/Python
Requires: python3-cassandra-driver
Requires: python3-influxdb
Requires: python3-monasca-common
Requires: python3-oslo.config
Requires: python3-oslo.log
Requires: python3-simplejson
Requires: python3-six
%description -n python3-monasca-persister
Consumes metrics and alarm state transitions from message queue and stores them in database.
Data is read from Kafka queue and saved either in InfluxDB or Cassandra
%prep
%autosetup -n %{sname}-9.0.1.dev2
%py_req_cleanup
%build
%{py3_build}
PYTHONPATH=. oslo-config-generator \
--config-file config-generator/persister.conf \
--output-file etc/monasca/persister.conf.sample
%install
%{py3_install}
# create all necessary directories
install -d -m 755 %{buildroot}%{_sysconfdir}/monasca
install -d -m 755 %{buildroot}%{_var}/lib/monasca-persister
install -d -m 755 %{buildroot}%{_var}/log/monasca-persister
# install config
install -D -m 640 etc/monasca/persister-logging.conf %{buildroot}%{_sysconfdir}/monasca/persister-logging.conf
install -D -m 644 etc/monasca/persister.conf.sample %{buildroot}%{_sysconfdir}/monasca/persister.conf
# install systemd service
install -p -D -m 444 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-monasca-persister.service
# install symlinks on SUSE
%if 0%{?suse_version}
mkdir -p %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%endif
# Install logrotate
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-monasca-persister.logrotate
%check
%{openstack_stestr_run}
%pre
%openstack_pre_user_group_create monasca-persister monasca /sbin/nologin
%preun
%systemd_preun openstack-monasca-persister.service
%post
%systemd_post openstack-monasca-persister.service
%postun
%systemd_postun_with_restart openstack-monasca-persister.service
if [ $1 -eq 0 ] ; then
getent passwd monasca-persister > /dev/null
if [ "$?" == "0" ] ; then
userdel monasca-persister
fi
fi
%files
%license LICENSE
%doc README.rst ChangeLog
%dir %attr(-, root, monasca) %{_sysconfdir}/monasca
%dir %attr(0750, monasca-persister, monasca) %{_var}/lib/monasca-persister
%dir %attr(0750, monasca-persister, monasca) %{_var}/log/monasca-persister
%config(noreplace) %attr(0640, root, monasca) %{_sysconfdir}/monasca/persister.conf
%config(noreplace) %attr(0640, root, monasca) %{_sysconfdir}/monasca/persister-logging.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-monasca-persister.logrotate
%{_unitdir}/openstack-monasca-persister.service
%if 0%{?suse_version}
%{_sbindir}/rc%{name}
%endif
%{_bindir}/monasca-persister
%files -n python3-monasca-persister
%license LICENSE
%{python3_sitelib}/monasca_persister
%{python3_sitelib}/monasca_persister-*.egg-info
%changelog