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) 2024 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
Name:           openstack-horizon-plugin-octavia-ui
Version:        13.1.0~dev12
Release:        0
Summary:        Horizon plugin for octavia
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/octavia-dashboard
Source0:        octavia-dashboard-master.tar.gz
BuildRequires:  fdupes
BuildRequires:  openstack-dashboard
BuildRequires:  openstack-macros
BuildRequires:  openstack-octavia
BuildRequires:  python3-XStatic-Angular-UUID
BuildRequires:  python3-XStatic-Angular-Vis
BuildRequires:  python3-XStatic-FileSaver
BuildRequires:  python3-XStatic-JS-Yaml
BuildRequires:  python3-XStatic-Json2yaml
BuildRequires:  python3-mock
BuildRequires:  python3-octaviaclient
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-pbr
Requires:       python3-horizon-plugin-octavia-ui = %{version}
BuildArch:      noarch

%description
Octavia dashboard is a horizon plugin for Octavia.

%package -n     python3-horizon-plugin-octavia-ui
Summary:        Horizon plugin for octavia - Python Module
Requires:       python3-XStatic-Angular-UUID
Requires:       python3-XStatic-Angular-Vis
Requires:       python3-XStatic-FileSaver
Requires:       python3-XStatic-JS-Yaml
Requires:       python3-XStatic-Json2yaml
Requires:       python3-octaviaclient
Requires:       python3-pbr

%description -n python3-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
Requires:       python3-mock
Requires:       python3-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-13.1.0.dev12
%py_req_cleanup

%build
%py3_build

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

%install
%py3_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}%{python3_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}%{python3_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}%{python3_sitelib}
%fdupes %{buildroot}%{http_dashboard_dir}

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

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

%files
%doc ChangeLog README.rst
%license LICENSE
%{http_dashboard_dir}/openstack_dashboard/enabled
%config(noreplace) %{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 python3-horizon-plugin-octavia-ui
%doc README.rst
%license LICENSE
%{python3_sitelib}/octavia_dashboard/
%{python3_sitelib}/octavia_dashboard-*.egg-info
%exclude %{python3_sitelib}/octavia_dashboard/tests*

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

%changelog
openSUSE Build Service is sponsored by