File openstack-octavia.spec of Package openstack-octavia
#
# spec file for package openstack-octavia
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 component octavia
%define groupname %{component}
%define username %{component}
%define version_unconverted 4.0.2.dev21
Name: openstack-%{component}
Version: 4.0.2~dev21
Release: 0
Summary: OpenStack load balancer (Octavia)
License: Apache-2.0
Group: System/Management
Url: http://launchpad.net/%{component}/
Source0: http://tarballs.openstack.org/%{component}/%{component}-stable-stein.tar.gz
Source1: openstack-octavia-amphora-agent.service
Source2: openstack-octavia-api.service
Source3: openstack-octavia-health-manager.service
Source4: openstack-octavia-housekeeping.service
Source5: openstack-octavia-worker.service
Source6: openstack-%{component}.logrotate
Source7: openstack-%{component}.conf
Source8: README.config
Source9: ifup.ns
Source10: ifup-route
Source11: dhclient-script.ns
Source12: openstack-octavia-driver-agent.service
# PATCH-FEATURE-UPSTREAM 0001-Update-osutil-support-for-SUSE-distro.patch -- https://review.openstack.org/#/c/498909/
Patch0: 0001-Update-osutil-support-for-SUSE-distro.patch
BuildRequires: crudini
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: python-base
BuildRequires: python-oslosphinx
BuildRequires: python-pbr
BuildRequires: python-setuptools
BuildRequires: systemd
BuildRequires: systemd-rpm-macros
BuildRequires: tree
%{?systemd_requires}
Requires(pre): pwdutils
Requires: logrotate
Requires: python-%{component} = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Octavia is an scalable load balancer for OpenStack.
%package -n python-%{component}
Summary: OpenStack load balancer (Octavia) - Python module
Group: Development/Languages/Python
Requires: python-Babel >= 2.3.4
Requires: python-Flask >= 0.10
Requires: python-Jinja2 >= 2.10
Requires: python-PyMySQL >= 0.7.6
Requires: python-SQLAlchemy >= 1.0.10
Requires: python-WSME >= 0.8.0
Requires: python-WebOb >= 1.7.1
Requires: python-alembic >= 0.8.10
Requires: python-barbicanclient >= 4.5.2
Requires: python-castellan >= 0.16.0
Requires: python-cotyledon >= 1.3.0
Requires: python-cryptography >= 2.1
Requires: python-debtcollector >= 1.19.0
Requires: python-distro >= 1.2.0
Requires: python-futures >= 3.0.0
Requires: python-futurist >= 1.2.0
Requires: python-glanceclient >= 2.8.0
Requires: python-ipaddress >= 1.0.17
Requires: python-jsonschema >= 2.6.0
Requires: python-keystoneauth1 >= 3.4.0
Requires: python-keystonemiddleware >= 4.17.0
Requires: python-netifaces >= 0.10.4
Requires: python-neutronclient >= 6.7.0
Requires: python-novaclient >= 9.1.0
Requires: python-octavia-lib >= 1.1.1
Requires: python-oslo.config >= 5.2.0
Requires: python-oslo.context >= 2.19.2
Requires: python-oslo.db >= 4.27.0
Requires: python-oslo.i18n >= 3.15.3
Requires: python-oslo.log >= 3.36.0
Requires: python-oslo.messaging >= 6.3.0
Requires: python-oslo.middleware >= 3.31.0
Requires: python-oslo.policy >= 1.30.0
Requires: python-oslo.reports >= 1.18.0
Requires: python-oslo.serialization >= 2.18.0
Requires: python-oslo.upgradecheck >= 0.1.0
Requires: python-oslo.utils >= 3.33.0
Requires: python-pbr >= 2.0.0
Requires: python-pecan >= 1.0.0
Requires: python-pyOpenSSL >= 17.1.0
Requires: python-pyasn1 >= 0.1.8
Requires: python-pyasn1-modules >= 0.0.6
Requires: python-requests >= 2.14.2
Requires: python-rfc3986 >= 0.3.1
Requires: python-six >= 1.10.0
Requires: python-stevedore >= 1.20.0
Requires: python-taskflow >= 2.16.0
Requires: python-tenacity >= 4.9.0
%description -n python-%{component}
Octavia is an scalable load balancer for OpenStack.
This package contains the Octavia Python library.
%package test
Summary: OpenStack load balancer (Octavia) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
Requires: python-WebTest >= 2.0
Requires: python-mock >= 2.0.0
Requires: python-oslotest >= 3.2.0
Requires: python-pyroute2 >= 0.4.21
Requires: python-python-subunit >= 1.0.0
Requires: python-requests-mock >= 1.2.0
Requires: python-testrepository >= 0.0.18
Requires: python-testresources >= 2.0.0
Requires: python-testtools >= 2.2.0
%description test
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia Testsuite.
%package api
Summary: OpenStack load balancer (Octavia) - API
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description api
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia API service.
%package worker
Summary: OpenStack load balancer (Octavia) - worker
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description worker
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia worker service.
%package health-manager
Summary: OpenStack load balancer (Octavia) - health-manager
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description health-manager
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia health-manager service.
%package housekeeping
Summary: OpenStack load balancer (Octavia) - housekeeping
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description housekeeping
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia housekeeping service.
%package amphora-agent
Summary: OpenStack load balancer (Octavia) - amphora-agent
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
Requires: python-Flask >= 0.10
Requires: python-cryptography >= 2.1
Requires: python-gunicorn >= 19.0.0
Requires: python-ipaddress >= 1.0.17
Requires: python-netifaces >= 0.10.4
Requires: python-pyroute2 >= 0.4.21
%description amphora-agent
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia amphora-agent service.
%package driver-agent
Summary: OpenStack load balancer (Octavia) - driver-agent
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description driver-agent
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia driver-agent service.
%package network-namespace-scripts
Summary: OpenStack load balancer (Octavia) - network-namespace-scripts
Group: Development/Languages/Python
Requires: %{name} = %{version}-%{release}
%description network-namespace-scripts
Octavia is an scalable load balancer for OpenStack.
This package contains OpenStack Octavia network-namespace-scripts.
%prep
%setup -q -n %{component}-%{version_unconverted}
%openstack_cleanup_prep
%build
python setup.py build
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
### directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
install -d -m 700 %{buildroot}%{_localstatedir}/run/%{component}
install -D -m 644 %{SOURCE7} %{buildroot}/%_tmpfilesdir/%name.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
### README.config
cp %{SOURCE8} %{buildroot}%{_sysconfdir}/%{component}/
### config files
install -p -D -m 644 etc/%{component}.conf %{buildroot}/%{_sysconfdir}/%{component}/%{component}.conf
rm -rf %{buildroot}/usr/etc/%{component}/%{component}.conf
### systemd services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -m 444 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-octavia-amphora-agent.service
install -m 444 %{SOURCE2} %{buildroot}%{_unitdir}/openstack-octavia-api.service
install -m 444 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-octavia-health-manager.service
install -m 444 %{SOURCE4} %{buildroot}%{_unitdir}/openstack-octavia-housekeeping.service
install -m 444 %{SOURCE5} %{buildroot}%{_unitdir}/openstack-octavia-worker.service
install -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/openstack-octavia-driver-agent.service
for i in api worker health-manager housekeeping amphora-agent driver-agent; do
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-$i
done
### Install Network scripts
# Copy ifup.ns to the /usr/sbin
install -m 755 %{SOURCE9} %{buildroot}%{_sbindir}
# Copy ifup-route to /usr/sbin
install -m 755 %{SOURCE10} %{buildroot}%{_sbindir}
# Copy dhclient-script.ns to /usr/sbin
install -m 755 %{SOURCE11} %{buildroot}%{_sbindir}
# bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -m 755 \
%{buildroot}%{_datadir}/octavia/diskimage-create/diskimage-create.sh \
%{buildroot}%{_bindir}
rm -rf %{buildroot}%{_datadir}/octavia
### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test
### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
### set default configuration (mostly applies to package-only setups and quickstart, i.e. not generally crowbar)
%define octavia_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{octavia_conf} DEFAULT log_dir /var/log/octavia
crudini --set %{octavia_conf} DEFAULT state_path /var/lib/octavia
%pre
%openstack_pre_user_group_create %{username} %{groupname}
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%pre api
%service_add_pre %{name}-api.service
%post api
%service_add_post %{name}-api.service
%preun api
%stop_on_removal %{name}-api.service
%service_del_preun %{name}-api.service
%postun api
%restart_on_update %{name}-api.service
%service_del_postun %{name}-api.service
%pre worker
%service_add_pre %{name}-worker.service
%post worker
%service_add_post %{name}-worker.service
%preun worker
%stop_on_removal %{name}-worker.service
%service_del_preun %{name}-worker.service
%postun worker
%service_del_postun %{name}-worker.service
%pre health-manager
%service_add_pre %{name}-health-manager.service
%post health-manager
%service_add_post %{name}-health-manager.service
%preun health-manager
%stop_on_removal %{name}-health-manager.service
%service_del_preun %{name}-health-manager.service
%postun health-manager
%service_del_postun %{name}-health-manager.service
%pre housekeeping
%service_add_pre %{name}-housekeeping.service
%post housekeeping
%service_add_post %{name}-housekeeping.service
%preun housekeeping
%stop_on_removal %{name}-housekeeping.service
%service_del_preun %{name}-housekeeping.service
%postun housekeeping
%service_del_postun %{name}-housekeeping.service
%pre amphora-agent
%service_add_pre %{name}-amphora-agent.service
%post amphora-agent
%service_add_post %{name}-amphora-agent.service
%preun amphora-agent
%stop_on_removal %{name}-amphora-agent.service
%service_del_preun %{name}-amphora-agent.service
%postun amphora-agent
%service_del_postun %{name}-amphora-agent.service
%files
%defattr(-,root,root)
%doc README.rst
%license LICENSE
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%{_tmpfilesdir}/%name.conf
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/%{component}.conf.d/
%{_sysconfdir}/%{component}/README.config
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%{_bindir}/diskimage-create.sh
%{_bindir}/%{component}-db-manage
%{_bindir}/%{component}-status
%{_bindir}/haproxy-vrrp-check
%files -n python-%{component}
%defattr(-,root,root,-)
%license LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
%exclude %{python_sitelib}/%{component}/tests*
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/%{component}/tests*
%files api
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api
%{_bindir}/%{component}-wsgi
%files worker
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-worker.service
%{_sbindir}/rc%{name}-worker
%{_bindir}/%{component}-worker
%files health-manager
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-health-manager.service
%{_sbindir}/rc%{name}-health-manager
%{_bindir}/%{component}-health-manager
%files housekeeping
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-housekeeping.service
%{_sbindir}/rc%{name}-housekeeping
%{_bindir}/%{component}-housekeeping
%files amphora-agent
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-amphora-agent.service
%{_sbindir}/rc%{name}-amphora-agent
%{_bindir}/amphora-agent
%files driver-agent
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-driver-agent.service
%{_sbindir}/rc%{name}-driver-agent
%{_bindir}/octavia-driver-agent
%files network-namespace-scripts
%defattr(-,root,root,-)
%license LICENSE
%{_sbindir}/ifup.ns
%{_sbindir}/ifup-route
%{_sbindir}/dhclient-script.ns
%changelog