File openstack-horizon-plugin-octavia-ui.spec of Package openstack-horizon-plugin-octavia-ui

#
# spec file for package openstack-horizon-plugin-octavia-ui
#
# 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/
#


%if 0%{?rhel} || 0%{?fedora}
%global http_dashboard_dir %{_datarootdir}/openstack-dashboard
%else
%global http_dashboard_dir /srv/www/openstack-dashboard
%endif
%define version_unconverted 2.0.2.dev1

Name:           openstack-horizon-plugin-octavia-ui
Version:        2.0.2~dev1
Release:        0
Summary:        Horizon plugin for octavia
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/octavia-dashboard
Source0:        octavia-dashboard-stable-rocky.tar.gz
BuildRequires:  fdupes
BuildRequires:  openstack-dashboard >= 13.0.0
BuildRequires:  openstack-macros
BuildRequires:  openstack-octavia
BuildRequires:  python-XStatic-Angular-UUID
BuildRequires:  python-XStatic-Angular-Vis
BuildRequires:  python-XStatic-FileSaver
BuildRequires:  python-XStatic-JS-Yaml
BuildRequires:  python-XStatic-Json2yaml
BuildRequires:  python-mock
BuildRequires:  python-mox3
BuildRequires:  python-octaviaclient
BuildRequires:  python-oslo.policy
BuildRequires:  python-pbr >= 2.0.0
Requires:       python-horizon-plugin-octavia-ui = %{version}
BuildArch:      noarch

%description
Octavia dashboard is a horizon plugin for Octavia.

%package -n     python-horizon-plugin-octavia-ui
Summary:        Horizon plugin for octavia - Python Module
Group:          Development/Languages/Python
Requires:       python-XStatic-Angular-UUID
Requires:       python-XStatic-Angular-Vis
Requires:       python-XStatic-FileSaver
Requires:       python-XStatic-JS-Yaml
Requires:       python-XStatic-Json2yaml
Requires:       python-octaviaclient
Requires:       python-pbr >= 2.0.0

%description -n python-horizon-plugin-octavia-ui
OpenStack Octavia plugin for Horizon.

This package contains the core Python module of the octavia-ui.

%package test
Summary:        Octavia Management Plugin for Horizon - Testsuite
Group:          Development/Languages/Python
Requires:       python-mock
#Requires:      python-nodeenv
Requires:       python-testtools

%description test
OpenStack Octavia management plugin for Horizon.
It is used to verify the functionality of the Octavia UI Plugin.

%prep
%autosetup -p1 -n octavia-dashboard-2.0.2.dev1
%py_req_cleanup

%build
%py2_build

%check
PYTHONPATH=%{http_dashboard_dir} python manage.py test octavia_dashboard --settings=octavia_dashboard.tests.settings

%install
%py2_install

oslopolicy-sample-generator --namespace octavia --format yaml \
    --output octavia_dashboard/conf/octavia_policy.yaml

install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/enabled/
cp -a %{buildroot}%{python2_sitelib}/octavia_dashboard/enabled/_1482_project_load_balancer_panel.py* %{buildroot}%{http_dashboard_dir}/openstack_dashboard/enabled/
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/local_settings.d/
cp -a %{buildroot}%{python2_sitelib}/octavia_dashboard/local_settings.d/_1499_load_balancer_settings.py* \
     %{buildroot}%{http_dashboard_dir}/openstack_dashboard/local/local_settings.d/
install -m 0755 -d %{buildroot}%{http_dashboard_dir}/openstack_dashboard/conf/
cp -a octavia_dashboard/conf/octavia_policy.yaml %{buildroot}%{http_dashboard_dir}/openstack_dashboard/conf/

%fdupes %{buildroot}%{python2_sitelib}
%fdupes %{buildroot}%{http_dashboard_dir}

%post
su %{apache_user} -s /bin/sh -c "python %{http_dashboard_dir}/manage.py collectstatic --noinput --clear > /dev/null"

%postun
su %{apache_user} -s /bin/sh -c "python %{http_dashboard_dir}/manage.py collectstatic --noinput --clear > /dev/null"

%files
%doc ChangeLog README.rst
%license LICENSE
%{http_dashboard_dir}/openstack_dashboard/enabled
%{http_dashboard_dir}/openstack_dashboard/local/local_settings.d/_1499_load_balancer_settings.py*
%config(noreplace) %{http_dashboard_dir}/openstack_dashboard/conf/octavia_policy.yaml

%files -n python-horizon-plugin-octavia-ui
%doc README.rst
%license LICENSE
%{python2_sitelib}/octavia_dashboard/
%{python2_sitelib}/octavia_dashboard-*.egg-info
%exclude %{python_sitelib}/octavia_dashboard/tests*

%files test
%{python_sitelib}/octavia_dashboard/tests*

%changelog
openSUSE Build Service is sponsored by