File openstack-neutron-lbaas.spec of Package openstack-neutron-lbaas-doc

#
# spec file for package openstack-neutron-lbaas
#
# Copyright (c) 2022 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 component neutron-lbaas
%define groupname %{component}
%define username %{component}

%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

%define version_unconverted 13.0.1.dev16

Name:           openstack-neutron-lbaas
Version:        13.0.1~dev16
Release:        0
Summary:        Neutron Load Balancer As A Service
License:        Apache-2.0
Group:          System/Management
URL:            https://launchpad.net/neutron
Source:         http://tarballs.openstack.org/neutron-lbaas/neutron-lbaas-stable-rocky.tar.gz
Source1:        %{name}.logrotate
Source2:        %name.conf
Source3:        rpmlintrc
# systemd service files
Source10:       %{name}v2-agent.service
Patch1:         0001-neutron-lbaas-haproxy-agent-prevent-vif-unplug-when-.patch
BuildRequires:  crudini
BuildRequires:  fdupes
BuildRequires:  openstack-neutron
BuildRequires:  openstack-suse-macros
BuildRequires:  openstack-suse-sudo
BuildRequires:  python-barbicanclient
BuildRequires:  python-cryptography
BuildRequires:  python-devel
BuildRequires:  python-keystoneauth1
BuildRequires:  python-neutron-lib
BuildRequires:  python-pbr
# Test requirements
BuildRequires:  python-WebTest
BuildRequires:  python-fixtures
BuildRequires:  python-mock
BuildRequires:  python-oslo.config
BuildRequires:  python-oslo.reports
BuildRequires:  python-oslotest
BuildRequires:  python-python-subunit
BuildRequires:  python-requests-mock
BuildRequires:  python-testrepository
BuildRequires:  python-testresources
BuildRequires:  python-testscenarios
BuildRequires:  python-testtools
# Documentation build requirements:
BuildRequires:  python-Sphinx
BuildRequires:  python-oslosphinx
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
Requires:       logrotate
Requires:       openstack-suse-sudo
Requires:       python >= 2.7
Requires:       python-%{component} = %{version}
Requires(pre):  pwdutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
PreReq:         %fillup_prereq

%description
Neutron is a virtual network service for Openstack.

Just like OpenStack Nova provides an API to dynamically request and
configure virtual servers, Neutron provides an API to dynamically
request and configure virtual networks. These networks connect
"interfaces" from other OpenStack services (e.g., vNICs from Nova VMs).
The Neutron API supports extensions to provide advanced network
capabilities (e.g., QoS, ACLs, network monitoring, etc)

%package -n python-neutron-lbaas
Summary:        Neutron Load Balancer As A Service - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.7
Requires:       python-SQLAlchemy >= 1.0.10
Requires:       python-WebOb >= 1.7.1
Requires:       python-alembic >= 0.8.10
Requires:       python-barbicanclient >= 4.5.2
Requires:       python-cryptography >= 2.1
Requires:       python-eventlet >= 0.18.2
Requires:       python-keystoneauth1 >= 3.4.0
Requires:       python-netaddr >= 0.7.18
Requires:       python-neutron-lib >= 1.18.0
Requires:       python-oslo.concurrency >= 3.26.0
Requires:       python-oslo.config >= 5.2.0
Requires:       python-oslo.db >= 4.27.0
Requires:       python-oslo.log >= 3.36.0
Requires:       python-oslo.messaging >= 5.29.0
Requires:       python-oslo.reports >= 1.18.0
Requires:       python-oslo.serialization >= 2.18.0
Requires:       python-oslo.service >= 1.24.0
Requires:       python-oslo.utils >= 3.33.0
Requires:       python-pbr >= 2.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-six >= 1.10.0
Requires:       python-stevedore >= 1.20.0

%description -n python-neutron-lbaas
This package contains the core Python module of OpenStack Neutron LBaaS

%package agent
Summary:        Neutron Load Balancer As A Service - Load Balancing Agent
Group:          Development/Languages/Python
PreReq:         %name = %version
Requires:       haproxy

%description agent
This package provides the Load Balancing as a Service Agent.

%prep
%setup -q -n neutron-lbaas-%{version_unconverted}
%patch1 -p1
%openstack_cleanup_prep

%build
python setup.py build
python setup.py build_sphinx -b man

### configuration files
for x in `ls etc/oslo-config-generator/*`; do
    PYTHONPATH=. oslo-config-generator --config-file $x
done

%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot} --install-data=/

### directories
install -d -m 750 %{buildroot}%{_localstatedir}/lib/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
install -d -m 700 %{buildroot}%{_rundir}/%{component}
install -D -m 644 %{SOURCE2} %{buildroot}/%_tmpfilesdir/%name.conf

### configuration files
install -d -m 755 %{buildroot}%{_sysconfdir}/neutron/
install -d -m 755 %{buildroot}%{_sysconfdir}/neutron/neutron-lbaasv2-agent.conf.d/

# all needed files are installed automatically
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

install -p -D -m 644 etc/neutron_lbaas.conf.sample %{buildroot}%{_sysconfdir}/neutron/neutron_lbaas.conf
install -p -D -m 644 etc/lbaas_agent.ini.sample %{buildroot}%{_sysconfdir}/neutron/lbaas_agent.ini
install -p -D -m 644 etc/services_lbaas.conf.sample %{buildroot}%{_sysconfdir}/neutron/services_lbaas.conf

# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}v2-agent.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}v2-agent

### documentation
install -d %{buildroot}%{_mandir}/man1
install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1

## SUSE configuration defaults
crudini --set %{buildroot}/etc/neutron/lbaas_agent.ini DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
crudini --set %{buildroot}/etc/neutron/neutron_lbaas.conf service_providers service_provider "LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default"

### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
%fdupes %{buildroot}%{_bindir}

### authentication cache dir
mkdir -p %{buildroot}%{_localstatedir}/cache/%{component}

## %check
## python setup.py testr

%pre
%openstack_pre_user_group_create %{username} %{groupname}

%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf

%pre agent
%service_add_pre openstack-neutron-lbaasv2-agent

%post agent
%service_add_post openstack-neutron-lbaasv2-agent

%preun
%service_del_preun openstack-neutron-lbaasv2-agent

%postun
%restart_on_update openstack-neutron-lbaasv2-agent
%service_del_postun openstack-neutron-lbaasv2-agent

%files
%defattr(-,root,root,-)
%doc README.rst
%license LICENSE
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%_tmpfilesdir/%name.conf
%dir %{_sysconfdir}/neutron/neutron-lbaasv2-agent.conf.d/
%config(noreplace) %{_sysconfdir}/neutron/neutron_lbaas.conf
%config(noreplace) %{_sysconfdir}/neutron/services_lbaas.conf
%{_mandir}/man1/neutron-lbaas.1%{?ext_man}

%files agent
%defattr(-,root,root,-)
%license LICENSE
%{_bindir}/neutron-lbaasv2-agent
%config(noreplace) %{_sysconfdir}/neutron/lbaas_agent.ini
%config %{_sysconfdir}/neutron/rootwrap.d/lbaas-haproxy.filters
%{_unitdir}/openstack-neutron-lbaasv2-agent.service
%{_sbindir}/rcopenstack-neutron-lbaasv2-agent

%files -n python-neutron-lbaas
%defattr(-,root,root,-)
%license LICENSE
%{python_sitelib}/neutron_lbaas/
%{python_sitelib}/neutron_lbaas-*.egg-info

%changelog
openSUSE Build Service is sponsored by