File openstack-monasca-log-api.spec of Package openstack-monasca-log-api
#
# spec file for package openstack-monasca-log-api
#
# Copyright (c) 2023 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/
#
%define sname monasca-log-api
Name: openstack-monasca-log-api
Version: 2.7.1~dev7
Release: 0
Summary: OpenStack Monasca Log Api plugin
License: Apache-2.0
Group: Development/Languages/Python
URL: https://wiki.openstack.org/wiki/Monasca
Source0: monasca-log-api-stable-rocky.tar.gz
Source1: %{name}-wsgi.conf
BuildRequires: fdupes
BuildRequires: openstack-macros
BuildRequires: python-falcon >= 1.0.0
BuildRequires: python-fixtures
BuildRequires: python-keystonemiddleware >= 4.17.0
BuildRequires: python-mock
BuildRequires: python-monasca-common >= 2.7.0
BuildRequires: python-monasca-statsd >= 1.1.0
BuildRequires: python-os-testr
BuildRequires: python-oslo.config >= 5.2.0
BuildRequires: python-oslo.context >= 2.19.2
BuildRequires: python-oslo.log >= 3.36.0
BuildRequires: python-oslo.middleware >= 3.31.0
BuildRequires: python-oslo.serialization >= 2.18.0
BuildRequires: python-oslo.utils >= 3.33.0
BuildRequires: python-oslotest
BuildRequires: python-pbr >= 2.0.0
BuildRequires: python-simplejson
Requires: python-%{sname} = %{version}
BuildArch: noarch
%if 0%{?suse_version}
BuildRequires: apache2-mod_wsgi
Requires: apache2-mod_wsgi
%else
BuildRequires: mod_wsgi
Requires: mod_wsgi
%endif
%description
monasca-log-api is a RESTful API server receiving logs from the deployed
log agents.
%package -n python-%{sname}
Summary: OpenStack Monasca Log Api plugin
Group: Development/Languages/Python
Requires: python-eventlet >= 0.18.2
Requires: python-falcon >= 1.0.0
Requires: python-keystonemiddleware >= 4.17.0
Requires: python-monasca-common >= 2.7.0
Requires: python-monasca-statsd >= 1.1.0
Requires: python-oslo.config >= 5.2.0
Requires: python-oslo.context >= 2.19.2
Requires: python-oslo.log >= 3.36.0
Requires: python-oslo.middleware >= 3.31.0
Requires: python-oslo.serialization >= 2.18.0
Requires: python-oslo.utils >= 3.33.0
Requires: python-pbr >= 2.0.0
BuildArch: noarch
%description -n python-%{sname}
monasca-log-api is a RESTful API server receiving logs from the deployed
log agents.
%prep
%autosetup -n %{sname}-2.7.1.dev7
%py_req_cleanup
%build
%py2_build
oslo-config-generator \
--config-file config-generator/monasca-log-api.conf \
--output-file etc/monasca/log-api.conf
%install
%py2_install
## directories
install -d -m 755 %{buildroot}%{_sysconfdir}/monasca
install -d -m 750 %{buildroot}%{_var}/log/monasca
install -d -m 755 %{buildroot}%{_var}/lib/monasca-log-api
install -d -m 755 %{buildroot}%{apache_site_dir}
## configuration directory
find %{buildroot}%{_prefix}%{_sysconfdir}/ -type f -name 'log-api-*' -print0 | xargs -0 mv -t %{buildroot}%{_sysconfdir}/monasca/
rm -rf %{buildroot}%{_prefix}%{_sysconfdir}/monasca
# configuration bits
# NOTEtrebskit) file names are hardcoded in monasca-log-api
# should be refactored when Bug#1670277 is resolved
install -D -m 640 etc/monasca/log-api.conf %{buildroot}%{_sysconfdir}/monasca/log-api.conf
install -D -m 640 etc/monasca/log-api-paste.ini %{buildroot}%{_sysconfdir}/monasca/log-api-paste.ini
install -D -m 640 etc/monasca/log-api-logging.conf %{buildroot}%{_sysconfdir}/monasca/log-api-logging.conf
## install apache configuration
install -p -D -m 640 %{SOURCE1} %{buildroot}%{apache_site_dir}/%{sname}.conf.sample
sed -e "
s|__APACHE_NAME__|%{apache_name}|g;
" -i %{buildroot}%{apache_site_dir}/%{sname}.conf.sample
# there is extra directory /etc/monasca/monasca created, get rid of it
rm -rf %{_sysconfdir}/monasca/monasca || true
rm -f %{buildroot}%{python2_sitelib}/monasca_log_api/.gitignore
%fdupes %{buildroot}%{python2_sitelib}
%check
find . -type f -name *.pyc -delete
OS_TEST_PATH=./monasca_log_api/tests PYTHONPATH=. ostestr
%pre
%openstack_pre_user_group_create monasca-log-api monasca
%postun
if [ $1 -eq 0 ] ; then
getent passwd monasca-log-api > /dev/null
if [ "$?" == "0" ] ; then
userdel monasca-log-api
fi
fi
%files
%doc README.rst ChangeLog
%{_bindir}/monasca-log-api
%{_bindir}/monasca-log-api-wsgi
%dir %attr(-, root, monasca) %{_sysconfdir}/monasca
%dir %attr(0750, root, monasca) %{_var}/log/monasca
%dir %attr(0750, monasca-log-api, monasca) %{_var}/lib/monasca-log-api
%config(noreplace) %attr(0640, root, monasca) %{_sysconfdir}/monasca/log-api.conf
%config(noreplace) %attr(0640, root, monasca) %{_sysconfdir}/monasca/log-api-logging.conf
%config(noreplace) %attr(0640, root, monasca) %{_sysconfdir}/monasca/log-api-paste.ini
%config(noreplace) %attr(0640, root, monasca) %{apache_site_dir}/%{sname}.conf.sample
%files -n python-%{sname}
%license LICENSE
%{python2_sitelib}/monasca_log_api
%{python2_sitelib}/*.egg-info
%changelog