File openstack-monasca-persister.spec of Package openstack-monasca-persister
#
# spec file for package openstack-monasca-persister
#
# Copyright (c) 2020 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/
#
Name: openstack-monasca-persister
Version: 1.12.1~dev9
Release: 0
Summary: Consumes metrics and alarm state transitions from message queue and stores them in database
License: Apache-2.0
Group: Development/Languages/Python
URL: https://wiki.openstack.org/wiki/Monasca
Source0: monasca-persister-stable-rocky.tar.gz
Source1: openstack-monasca-persister.service
Source2: openstack-monasca-persister.logrotate
BuildRequires: openstack-macros
BuildRequires: python-elasticsearch
BuildRequires: python-mock
BuildRequires: python-monasca-common
BuildRequires: python-nose
BuildRequires: python-oslo.config
BuildRequires: python-oslo.log
BuildRequires: python-oslotest
BuildRequires: python-setuptools
BuildRequires: python-six
Requires: logrotate
Requires: python-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 python-monasca-persister
Summary: Consumes metrics and alarm state transitions from message queue and stores them in database
Group: Development/Languages/Python
Requires: python-cassandra-driver
Requires: python-influxdb
Requires: python-monasca-common
Requires: python-oslo.config
Requires: python-oslo.log
Requires: python-six
%description -n python-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 monasca-persister-1.12.1.dev9
%py_req_cleanup
%build
%{py2_build}
PYTHONPATH=. oslo-config-generator \
--config-file config-generator/persister.conf \
--output-file etc/monasca/persister.conf.sample
%install
%{py2_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 logrotate
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-monasca-persister.logrotate
%check
find . -type f -name *.pyc -delete
nosetests monasca_persister --verbose
%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
%{_bindir}/monasca-persister
%files -n python-monasca-persister
%defattr(-, root, root,-)
%license LICENSE
%{python2_sitelib}/monasca_persister
%{python2_sitelib}/monasca_persister-*.egg-info
%changelog