Name: nodepool
Version: 3.0.0
Release: 6%{?dist}
Summary: Node pool management for a distributed test infrastructure
License: ASL 2.0
URL: https://zuul-ci.org
Source0: http://tarballs.openstack.org/nodepool/nodepool-%{version}.tar.gz
Source1: nodepool-launcher.service
Source2: nodepool-builder.service
Source3: nodepool.yaml
Source4: logging.conf
Source5: launcher-logging.yaml
Source6: builder-logging.yaml
Source7: nodepool.logrotate
BuildArch: noarch
Requires: python3
Requires: python3-pbr
Requires: python3-PyYAML
Requires: python3-daemon
Requires: python3-extras
Requires: python3-statsd
Requires: python3-sqlalchemy
Requires: python3-prettytable
Requires: python3-six
Requires: python3-voluptuous
Requires: python3-kazoo
Requires: python3-paste
Requires: python3-webob
BuildRequires: python3-devel
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
# Doc building requirements
BuildRequires: python3-sphinxcontrib-programoutput
BuildRequires: python3-sphinxcontrib-httpdomain
BuildRequires: python3-kazoo
BuildRequires: python3-daemon
BuildRequires: python3-extras
BuildRequires: python3-PyYAML
BuildRequires: python3-statsd
BuildRequires: python3-paste
BuildRequires: python3-webob
BuildRequires: python3-prettytable
BuildRequires: python3-voluptuous
BuildRequires: help2man
%{?systemd_requires}
BuildRequires: systemd
%description
Nodepool is a service used by the OpenStack CI team to deploy and manage a pool
of devstack images on a cloud server for use in OpenStack project testing.
%package driver-openstack
Summary: Nodepool OpenStack driver
Requires: nodepool-launcher
Requires: python3-os-client-config
Requires: python3-shade
Requires: python3-paramiko
%description driver-openstack
Nodepool OpenStack driver
%package driver-static
Summary: Nodepool OpenStack driver
Requires: nodepool-launcher
%description driver-static
Nodepool Static driver
%package launcher
Summary: Nodepool launcher service
Requires: nodepool
%description launcher
Nodepool launcher service
%package builder
Summary: Nodepool builder service
Requires: nodepool
Requires: dnf-utils
Requires: sudo
Requires: qemu-img
%description builder
Nodepool builder service
%package doc
Summary: The Nodepool documentation
%description doc
The Nodepool documentation
%prep
%autosetup -n nodepool-%{version}
rm -Rf *requirements.txt *.egg-info
# Remove test files
rm -Rf nodepool/tests nodepool/driver/fake
# Remove interpreter
find nodepool/ -type f -exec sed -i -e '/#!\/usr\/bin\/.*python.*/{1D}' {} \;
%build
PBR_VERSION=%{version} %py3_build
PBR_VERSION=%{version} SPHINX_DEBUG=1 sphinx-build -b html doc/source build/html
rm -Rf build/html/.buildinfo
# Generate man pages
mkdir man
pushd man
echo -e "#!/usr/bin/python3\nimport sys\nfrom nodepool.cmd.nodepoolcmd import main\nmain()" > nodepool
echo -e "#!/usr/bin/python3\nimport sys\nfrom nodepool.cmd.launcher import main\nmain()" > nodepool-launcher
echo -e "#!/usr/bin/python3\nimport sys\nfrom nodepool.cmd.builder import main\nmain()" > nodepool-builder
chmod +x nodepool*
# Test the command first to output missing BuildRequirements
PYTHONPATH=../ ./nodepool-builder --help
PYTHONPATH=../ ./nodepool-launcher --help
PYTHONPATH=../ ./nodepool --help
PYTHONPATH=../ help2man --no-info -o nodepool-builder.man ./nodepool-builder
PYTHONPATH=../ help2man --no-info -o nodepool-launcher.man ./nodepool-launcher
PYTHONPATH=../ help2man --no-info -o nodepool.man ./nodepool
popd
%install
PBR_VERSION=%{version} %py3_install
# Remove executable bit from libraries
find %{buildroot}%{python3_sitelib}/nodepool -type f -exec chmod -x {} \;
# Man pages
install -p -D -m 0644 man/nodepool-builder.man %{buildroot}%{_mandir}/man1/nodepool-builder.1
install -p -D -m 0644 man/nodepool-launcher.man %{buildroot}%{_mandir}/man1/nodepool-launcher.1
install -p -D -m 0644 man/nodepool.man %{buildroot}%{_mandir}/man1/nodepool.1
# Service unit
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/nodepool-launcher.service
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/nodepool-builder.service
# Basic configuration
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/nodepool/nodepool.yaml
install -p -d -m 0755 %{buildroot}%{_sysconfdir}/nodepool/elements
touch %{buildroot}%{_sysconfdir}/nodepool/secure.conf
install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/nodepool/logging.conf
install -p -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/nodepool/launcher-logging.yaml
install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/nodepool/builder-logging.yaml
install -p -D -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/logrotate.d/nodepool
# Service base directories
install -p -d -m 0700 %{buildroot}%{_sharedstatedir}/nodepool
install -p -d -m 0700 %{buildroot}%{_sharedstatedir}/nodepool/dib
install -p -d -m 0700 %{buildroot}%{_sharedstatedir}/nodepool/.config/openstack
install -p -d -m 0700 %{buildroot}%{_localstatedir}/log/nodepool
install -p -d -m 0755 %{buildroot}%{_localstatedir}/cache/nodepool/dib_cache
install -p -d -m 0755 %{buildroot}%{_localstatedir}/cache/nodepool/dib_tmp
%pre
getent group nodepool >/dev/null || groupadd -r nodepool
if ! getent passwd nodepool >/dev/null; then
useradd -r -g nodepool -G nodepool -d %{_sharedstatedir}/nodepool -s /sbin/nologin -c "Nodepool Daemon" nodepool
fi
exit 0
%post launcher
%systemd_post nodepool-launcher.service
%post builder
%systemd_post nodepool-builder.service
%preun launcher
%systemd_preun nodepool-launcher.service
%preun builder
%systemd_preun nodepool-builder.service
%postun launcher
%systemd_postun nodepool-launcher.service
%postun builder
%systemd_postun nodepool-builder.service
%files
%license LICENSE
%{_mandir}/man1/nodepool.1*
%{_bindir}/nodepool
%exclude %{python3_sitelib}/nodepool/driver/openstack
%{python3_sitelib}/nodepool
%{python3_sitelib}/nodepool-*.egg-info
%dir %{_sysconfdir}/nodepool/elements
%dir %{_sysconfdir}/nodepool/
%config(noreplace) %{_sysconfdir}/nodepool/nodepool.yaml
%config(noreplace) %{_sysconfdir}/nodepool/logging.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/nodepool
%config(noreplace) %attr(0640, root, nodepool) %{_sysconfdir}/nodepool/secure.conf
%attr(0750, nodepool, nodepool) %{_sharedstatedir}/nodepool
%dir %attr(0750, nodepool, nodepool) %{_localstatedir}/log/nodepool
%files driver-openstack
%license LICENSE
%{python3_sitelib}/nodepool/driver/openstack
%files driver-static
%license LICENSE
%{python3_sitelib}/nodepool/driver/static
%files launcher
%license LICENSE
%{_mandir}/man1/nodepool-launcher.1*
%{_bindir}/nodepool-launcher
%config(noreplace) %attr(0644, root, root) %{_sysconfdir}/nodepool/launcher-logging.yaml
%{_unitdir}/nodepool-launcher.service
%files builder
%license LICENSE
%{_mandir}/man1/nodepool-builder.1*
%{_bindir}/nodepool-builder
%config(noreplace) %{_sysconfdir}/nodepool/builder-logging.yaml
%{_unitdir}/nodepool-builder.service
%attr(0755, nodepool, nodepool) %{_localstatedir}/cache/nodepool
%files doc
%license LICENSE
%doc build/html
%changelog
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.0.0-6
- Rebuilt for Python 3.8
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.0.0-2
- Rebuilt for Python 3.7
* Mon Apr 02 2018 Tristan Cacqueray <tdecacqu@redhat.com> - 3.0.0-1
- Import from software factory repository