File openstack-masakari.spec of Package openstack-masakari

# spec file for package openstack-masakari
# 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

%global sname masakari
Name:           openstack-masakari
Version:        6.0.0
Release:        0
Summary:        Virtual Machine High Availability (VMHA) service for OpenStack
License:        Apache-2.0
Group:          Development/Languages/Python
Source0:        masakari-6.0.0.tar.gz
Source1:        masakari-api.service
Source2:        masakari-engine.service
Source3:        masakari.tmpfiles
BuildRequires:  openstack-macros
BuildRequires:  python-Sphinx
BuildRequires:  python-ddt
BuildRequires:  python-eventlet
BuildRequires:  python-keystoneauth1
BuildRequires:  python-keystonemiddleware
BuildRequires:  python-microversion_parse
BuildRequires:  python-novaclient
BuildRequires:  python-oslo.db
BuildRequires:  python-oslo.messaging
BuildRequires:  python-oslo.middleware
BuildRequires:  python-oslo.policy
BuildRequires:  python-oslo.service
BuildRequires:  python-oslo.versionedobjects
BuildRequires:  python-oslotest
BuildRequires:  python-python-subunit
BuildRequires:  python-reno
BuildRequires:  python-requests-mock
BuildRequires:  python-setuptools
BuildRequires:  python-taskflow
BuildRequires:  python-testrepository
BuildRequires:  python-testresources
BuildRequires:  python-testscenarios
BuildRequires:  python-testtools
Requires:       python-masakari = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
BuildRequires:  systemd

Masakari is a service providing high availability for VMs in OpenStack.

System package - %{name}
Python package - python-%{sname}

%package        doc
Summary:        Documentation for OpenStack Masakari Service
Group:          Development/Languages/Python
BuildRequires:  openstack-tempest
BuildRequires:  python-WSME
BuildRequires:  python-jsonschema
BuildRequires:  python-networkx
BuildRequires:  python-oslosphinx
BuildRequires:  python-paramiko
BuildRequires:  python-pecan
BuildRequires:  python-pep8
BuildRequires:  python-sphinxcontrib-httpdomain
BuildRequires:  python-sphinxcontrib-pecanwsme
BuildRequires:  python-yaql

%description    doc
Masakari is a service providing high availability for VMs in OpenStack.

This package contains the documentation.

%package -n     python-%{sname}
Summary:        Masakari Python libraries
Group:          Development/Languages/Python
Requires:       python-Babel
Requires:       python-iso8601
Requires:       python-jsonschema
Requires:       python-keystoneauth1
Requires:       python-keystonemiddleware
Requires:       python-microversion_parse
Requires:       python-novaclient
Requires:       python-oslo.config
Requires:       python-oslo.db
Requires:       python-oslo.i18n
Requires:       python-oslo.log
Requires:       python-oslo.messaging
Requires:       python-oslo.middleware
Requires:       python-oslo.policy
Requires:       python-oslo.service
Requires:       python-oslo.utils
Requires:       python-oslo.versionedobjects
Requires:       python-pbr
Requires:       python-six
Requires:       python-stevedore
Requires:       python-taskflow

%description -n python-%{sname}
Masakari is a service providing high availability for VMs in OpenStack.

This package contains the Python libraries.

%package        api
Summary:        OpenStack Masakari API service
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description    api
OpenStack REST API to the Masakari api.

This package contains the REST API.

%package        engine
Summary:        OpenStack Masakari Engine service
Group:          Development/Languages/Python
Requires:       %{name} = %{version}

%description    engine
OpenStack Masakari Engine service.

This package contains the masakari engine, which is one of core services of masakari.

%autosetup -n %{sname}-6.0.0

export PYTHONPATH="."
# from tox.ini's testenv:genconfig
oslo-config-generator --config-file etc/masakari/masakari-config-generator.conf
oslopolicy-sample-generator --config-file etc/masakari/masakari-policy-generator.conf

%{__python2} build_sphinx
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}


mkdir -p %{buildroot}%{_sysconfdir}/masakari/
mkdir -p %{buildroot}%{_localstatedir}/log/masakari
#systemd unitfiles
install -p -D -m 644 %SOURCE1 %{buildroot}%{_unitdir}/openstack-masakari-api.service
install -p -D -m 644 %SOURCE2 %{buildroot}%{_unitdir}/openstack-masakari-engine.service
install -p -D -m 644 %SOURCE3 %{buildroot}/%{_tmpfilesdir}/masakari.conf

install -p -D -m 640 etc/masakari/masakari.conf.sample %{buildroot}%{_sysconfdir}/masakari/masakari.conf
install -p -D -m 640 etc/masakari/api-paste.ini %{buildroot}%{_sysconfdir}/masakari/api-paste.ini
install -p -D -m 640 etc/masakari/policy.yaml.sample %{buildroot}%{_sysconfdir}/masakari/policy.yaml
chmod +x %{buildroot}%{_bindir}/masakari*

# remove usr/etc
rm -rf %{buildroot}%{_prefix}%{_sysconfdir}/

%openstack_pre_user_group_create masakari masakari

%tmpfiles_create %{_tmpfilesdir}/masakari.conf

testr init
testr list-tests > list
testr run --load-list=list

%post api
%systemd_post openstack-masakari-api.service

%preun api
%systemd_preun openstack-masakari-api.service

%postun api
%systemd_postun_with_restart openstack-masakari-api.service

%post engine
%systemd_post openstack-masakari-engine.service

%preun engine
%systemd_preun openstack-masakari-engine.service

%postun engine
%systemd_postun_with_restart openstack-masakari-engine.service

%license LICENSE
%dir %{_sysconfdir}/masakari
%config(noreplace) %attr(0640, root, masakari) %{_sysconfdir}/masakari/*
%dir %attr(750, masakari, masakari) %{_localstatedir}/log/masakari

%files api

%files engine

%files doc
%license LICENSE
%doc doc/build/html

%files -n python-%{sname}

openSUSE Build Service is sponsored by