File openstack-ironic.spec of Package openstack-ironic
#
# spec file
#
# 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/
#
%define component ironic
%define groupname %{component}
%define username %{component}
%define version_unconverted 11.1.5.dev18
Name: openstack-%{component}
Version: 11.1.5~dev18
Release: 0
Summary: Openstack Provisioning of Bare Metal Servers
License: Apache-2.0
Group: System/Management
URL: https://launchpad.net/ironic
Source: http://tarballs.openstack.org/ironic/ironic-stable-rocky.tar.gz
Source1: %{name}.logrotate
Source2: %name.conf
Source3: ironic-sudoers
# systemd service files
Source10: %{name}-api.service
Source11: %{name}-conductor.service
Source50: README.config
BuildRequires: crudini
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: openstack-suse-sudo
BuildRequires: python-WSME >= 0.5b6
BuildRequires: python-automaton
BuildRequires: python-cinderclient
BuildRequires: python-devel
BuildRequires: python-ironic-lib >= 2.14.2
BuildRequires: python-neutronclient
BuildRequires: python-openstackdocstheme
BuildRequires: python-os-traits
BuildRequires: python-oslo.config
BuildRequires: python-oslo.db
BuildRequires: python-oslo.i18n
BuildRequires: python-oslo.log
BuildRequires: python-oslo.reports
BuildRequires: python-oslo.utils
BuildRequires: python-oslo.versionedobjects
BuildRequires: python-oslotest
BuildRequires: python-osprofiler
BuildRequires: python-pbr
BuildRequires: python-pecan
BuildRequires: python-retrying
BuildRequires: python-sphinxcontrib-seqdiag
# Documentation requirements:
BuildRequires: python-Babel
BuildRequires: python-Sphinx
BuildRequires: python-alembic
BuildRequires: python-eventlet
BuildRequires: python-glanceclient
BuildRequires: python-iso8601
BuildRequires: python-jsonpatch
BuildRequires: python-keystonemiddleware
BuildRequires: python-oslo.concurrency
BuildRequires: python-oslo.messaging
BuildRequires: python-oslo.policy
BuildRequires: python-paramiko
BuildRequires: python-pysendfile
BuildRequires: python-singledispatch
BuildRequires: python-sphinxcontrib-apidoc
BuildRequires: python-sphinxcontrib-httpdomain
BuildRequires: python-sphinxcontrib-pecanwsme
BuildRequires: python-stevedore
BuildRequires: python-swiftclient
BuildRequires: python-testresources
BuildRequires: python-tooz
# Runtime requires
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
Requires: logrotate
Requires: openstack-suse-sudo
Requires: python >= 2.7
Requires: python-ironic = %{version}
Requires(pre): pwdutils
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Ironic is an Incubated OpenStack project which aims to provision bare metal
machines instead of virtual machines, forked from the Nova Baremetal driver.
It is best thought of as a bare metal hypervisor API and a set of plugins
which interact with the bare metal hypervisors. By default, it will use
PXE and IPMI in concert to provision and turn on/off machines, but Ironic
also supports vendor-specific plugins which may implement additional functionality.
%package -n python-ironic
Summary: Openstack Ironic - Python module
Group: Development/Languages/Python
Requires: python >= 2.7
Requires: python-Babel >= 2.3.4
Requires: python-Jinja2 >= 2.10
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-automaton >= 1.9.0
Requires: python-cinderclient >= 3.3.0
Requires: python-eventlet >= 0.18.2
Requires: python-futurist >= 1.2.0
Requires: python-ironic-lib >= 2.14.0
Requires: python-ironicclient >= 1.14.0
Requires: python-iso8601 >= 0.1.11
Requires: python-jsonpatch >= 1.16
Requires: python-jsonschema >= 2.6.0
Requires: python-keystoneauth1 >= 3.4.0
Requires: python-keystonemiddleware >= 4.17.0
Requires: python-neutronclient >= 6.7.0
Requires: python-os-traits >= 0.4.0
Requires: python-oslo.concurrency >= 3.26.0
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 >= 5.29.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.rootwrap >= 5.8.0
Requires: python-oslo.serialization >= 2.18.0
Requires: python-oslo.service >= 1.24.0
Requires: python-oslo.utils >= 3.33.0
Requires: python-oslo.versionedobjects >= 1.31.2
Requires: python-osprofiler >= 1.5.0
Requires: python-pbr >= 2.0.0
Requires: python-pecan >= 1.0.0
Requires: python-proliantutils
Requires: python-psutil >= 3.2.2
Requires: python-psycopg2 >= 2.6.2
Requires: python-pysendfile >= 2.0.0
Requires: python-pytz >= 2013.6
Requires: python-requests >= 2.14.2
Requires: python-retrying >= 1.2.3
Requires: python-rfc3986 >= 0.3.1
Requires: python-six >= 1.10.0
Requires: python-stevedore >= 1.20.0
Requires: python-sushy
Requires: python-swiftclient >= 3.2.0
Requires: python-tooz >= 1.58.0
%description -n python-ironic
This package contains the core code of OpenStack Ironic.
%package api
Summary: OpenStack Ironic - API
Group: System/Management
Requires: %{name} = %{version}
%description api
This package contains the OpenStack Ironic API Daemon.
%package conductor
Summary: OpenStack Ironic - Conductor
Group: System/Management
Requires: %{name} = %{version}
%description conductor
This package contains the OpenStack Ironic Conductor Manager Daemon.
%package test
Summary: Openstack Ironic - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-WebTest >= 2.0.27
Requires: python-fixtures >= 3.0.0
Requires: python-glanceclient >= 2.8.0
Requires: python-mock >= 2.0.0
Requires: python-os-testr >= 1.0.0
Requires: python-paramiko >= 2.0
Requires: python-python-subunit >= 0.0.18
Requires: python-sphinxcontrib-pecanwsme >= 0.8.0
Requires: python-testscenarios >= 0.4
Requires: python-testtools >= 2.2.0
%description test
This package contains testsuite files for %{name}.
%prep
%setup -q -n %{component}-%{version_unconverted}
%openstack_cleanup_prep
%build
python setup.py build
PBR_VERSION=%version_unconverted PYTHONPATH=. sphinx-build -b man doc/source doc/build/man
# configuration files
PYTHONPATH=. oslo-config-generator --config-file tools/config/ironic-config-generator.conf --output-file etc/ironic.conf.sample
PYTHONPATH=. oslopolicy-sample-generator --config-file=tools/policy/ironic-policy-generator.conf --output etc/policy.json.sample
%install
python setup.py install --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 %{SOURCE2} %{buildroot}/%_tmpfilesdir/%name.conf
### configuration files
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
mv %{buildroot}/usr/etc/ironic/* %{buildroot}%{_sysconfdir}/%{component}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
install -p -D -m 644 etc/%{component}.conf.sample %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf
install -p -D -m 644 etc/policy.json.sample %{buildroot}%{_sysconfdir}/%{component}/policy.json
install -p -D -m 644 etc/ironic/rootwrap.conf %{buildroot}%{_sysconfdir}/ironic/
cp -a etc/ironic/rootwrap.d/ %{buildroot}%{_sysconfdir}/ironic/
# remove redundant file included also in ironic-lib package
rm -f %{buildroot}%{_sysconfdir}/ironic/rootwrap.d/ironic-lib.filters
### bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-conductor.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-conductor
### sudoers configuration for ironic-rootwrap:
install -D -m 440 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers.d/openstack-ironic
### documentation
#install -d %{buildroot}%{_mandir}/man1
#install -m 644 build/sphinx/man/*.1 %{buildroot}%{_mandir}/man1
### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test
### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
### set default configuration
%define ironic_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{ironic_conf} DEFAULT log_dir /var/log/%{component}
crudini --set %{ironic_conf} DEFAULT lock_path /var/run/%{component}
crudini --set %{ironic_conf} DEFAULT rootwrap_config /etc/%{component}/rootwrap.conf
crudini --set %{ironic_conf} DEFAULT state_path /var/lib/%{component}
%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
%service_del_preun %{name}-api.service
%postun api
%restart_on_update %{name}-api.service
%service_del_postun %{name}-api.service
%pre conductor
%service_add_pre %{name}-conductor.service
%post conductor
%service_add_post %{name}-conductor.service
%preun conductor
%service_del_preun %{name}-conductor
%postun conductor
%restart_on_update %{name}-conductor.service
%service_del_postun %{name}-conductor.service
%files
%defattr(-,root,root)
%license LICENSE
%doc README.rst
%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 %{_sysconfdir}/sudoers.d/openstack-ironic
%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
%config(noreplace) %{_sysconfdir}/%{component}/rootwrap.conf
%config(noreplace) %{_sysconfdir}/%{component}/policy.json
%dir %{_sysconfdir}/%{component}/rootwrap.d
%config(noreplace) %{_sysconfdir}/%{component}/rootwrap.d/ironic-images.filters
%config(noreplace) %{_sysconfdir}/%{component}/rootwrap.d/ironic-utils.filters
%{_bindir}/ironic-rootwrap
%{_bindir}/ironic-api-wsgi
%files -n python-%{component}
%defattr(-,root,root,-)
%license LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
%files api
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/ironic-api
%{_bindir}/ironic-dbsync
%files conductor
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-conductor.service
%{_sbindir}/rc%{name}-conductor
%{_bindir}/ironic-conductor
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%changelog