Initial package
This commit is contained in:
commit
503a230778
14
.copr/Makefile
Normal file
14
.copr/Makefile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
rpmbuild_src = $(shell rpmbuild --eval '%{_sourcedir}')
|
||||||
|
.PHONY: prepare srpm rpm
|
||||||
|
|
||||||
|
prepare:
|
||||||
|
dnf -y install rpmdevtools rpm-build
|
||||||
|
cp *.patch $(rpmbuild_src) || true
|
||||||
|
spectool -g -R $(spec)
|
||||||
|
|
||||||
|
|
||||||
|
srpm: prepare
|
||||||
|
rpmbuild -bs --define "_srcrpmdir $(outdir)" $(spec)
|
||||||
|
|
||||||
|
rpm: prepare
|
||||||
|
rpmbuild -bb --define "_rpmdir $(outdir)" $(spec)
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.tar.gz
|
||||||
|
rpmbuild
|
94
cloud-init-22.3-nm-default.patch
Normal file
94
cloud-init-22.3-nm-default.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
From 7703aa98b89c8daba207c28a0422268ead10019a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||||
|
Date: Thu, 19 May 2022 15:05:01 +0200
|
||||||
|
Subject: [PATCH] Use Network-Manager and Netplan as default renderers for RHEL
|
||||||
|
and Fedora (#1465)
|
||||||
|
|
||||||
|
This is adapted from Neal Gompa's PR:
|
||||||
|
https://github.com/canonical/cloud-init/pull/1435
|
||||||
|
|
||||||
|
The only difference is that we are not modifying renderers.py (thus
|
||||||
|
modifying the priority of all distros), but just tweaking cloud.cfg to
|
||||||
|
apply this change to Fedora and RHEL. Other distros can optionally
|
||||||
|
add themselves afterwards.
|
||||||
|
|
||||||
|
net: Prefer Netplan and NetworkManager renderers by default
|
||||||
|
|
||||||
|
NetworkManager is used by default on a variety of Linux distributions,
|
||||||
|
and exists as a cross-distribution network management service.
|
||||||
|
|
||||||
|
Additionally, add information about the NetworkManager renderer to
|
||||||
|
the cloud-init documentation.
|
||||||
|
|
||||||
|
Because Netplan can be explicitly used to manage NetworkManager,
|
||||||
|
it needs to be preferred before NetworkManager.
|
||||||
|
|
||||||
|
This change is a follow-up to #1224, which added the native
|
||||||
|
NetworkManager renderer.
|
||||||
|
This patch has been deployed on Fedora's cloud-init package throughout
|
||||||
|
the development of Fedora Linux 36 to verify that it works.
|
||||||
|
|
||||||
|
This should also make it tremendously easier for Linux distributions
|
||||||
|
to use cloud-init because now a standard configuration is supported
|
||||||
|
by default.
|
||||||
|
|
||||||
|
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
|
||||||
|
|
||||||
|
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||||
|
---
|
||||||
|
config/cloud.cfg.tmpl | 3 +++
|
||||||
|
doc/rtd/topics/network-config.rst | 12 +++++++++++-
|
||||||
|
2 files changed, 14 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
|
||||||
|
index 6951a0e3..707a050c 100644
|
||||||
|
--- a/config/cloud.cfg.tmpl
|
||||||
|
+++ b/config/cloud.cfg.tmpl
|
||||||
|
@@ -349,4 +349,7 @@ system_info:
|
||||||
|
{% elif variant in ["dragonfly"] %}
|
||||||
|
network:
|
||||||
|
renderers: ['freebsd']
|
||||||
|
+{% elif variant in ["rhel", "fedora"] %}
|
||||||
|
+ network:
|
||||||
|
+ renderers: ['netplan', 'network-manager', 'networkd', 'sysconfig', 'eni']
|
||||||
|
{% endif %}
|
||||||
|
diff --git a/doc/rtd/topics/network-config.rst b/doc/rtd/topics/network-config.rst
|
||||||
|
index c461a3fe..f503caab 100644
|
||||||
|
--- a/doc/rtd/topics/network-config.rst
|
||||||
|
+++ b/doc/rtd/topics/network-config.rst
|
||||||
|
@@ -188,6 +188,15 @@ generated configuration into an internal network configuration state. From
|
||||||
|
this state `Cloud-init`_ delegates rendering of the configuration to Distro
|
||||||
|
supported formats. The following ``renderers`` are supported in cloud-init:
|
||||||
|
|
||||||
|
+- **NetworkManager**
|
||||||
|
+
|
||||||
|
+`NetworkManager <https://networkmanager.dev>`_ is the standard Linux network
|
||||||
|
+configuration tool suite. It supports a wide range of networking setups.
|
||||||
|
+Configuration is typically stored in ``/etc/NetworkManager``.
|
||||||
|
+
|
||||||
|
+It is the default for a number of Linux distributions, notably Fedora;
|
||||||
|
+CentOS/RHEL; and derivatives.
|
||||||
|
+
|
||||||
|
- **ENI**
|
||||||
|
|
||||||
|
/etc/network/interfaces or ``ENI`` is supported by the ``ifupdown`` package
|
||||||
|
@@ -215,6 +224,7 @@ is as follows:
|
||||||
|
- ENI
|
||||||
|
- Sysconfig
|
||||||
|
- Netplan
|
||||||
|
+- NetworkManager
|
||||||
|
|
||||||
|
When applying the policy, `Cloud-init`_ checks if the current instance has the
|
||||||
|
correct binaries and paths to support the renderer. The first renderer that
|
||||||
|
@@ -223,7 +233,7 @@ supplying an updated configuration in cloud-config. ::
|
||||||
|
|
||||||
|
system_info:
|
||||||
|
network:
|
||||||
|
- renderers: ['netplan', 'eni', 'sysconfig', 'freebsd', 'netbsd', 'openbsd']
|
||||||
|
+ renderers: ['netplan', 'network-manager', 'eni', 'sysconfig', 'freebsd', 'netbsd', 'openbsd']
|
||||||
|
|
||||||
|
|
||||||
|
Network Configuration Tools
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
2
cloud-init-tmpfiles.conf
Normal file
2
cloud-init-tmpfiles.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
d /run/cloud-init 0700 root root - -
|
||||||
|
|
185
cloud-init.spec
Normal file
185
cloud-init.spec
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
Name: cloud-init
|
||||||
|
Version: 22.2.2
|
||||||
|
Release: 0%{?dist}
|
||||||
|
Summary: Cloud instance init scripts
|
||||||
|
License: ASL 2.0 or GPLv3
|
||||||
|
URL: http://launchpad.net/cloud-init
|
||||||
|
|
||||||
|
Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
|
||||||
|
Source1: cloud-init-tmpfiles.conf
|
||||||
|
|
||||||
|
# Default to NetworkManager for configuration renderer
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2014701
|
||||||
|
# From: https://github.com/canonical/cloud-init/commit/7703aa98b89c8daba207c28a0422268ead10019a
|
||||||
|
Patch1: cloud-init-22.3-nm-default.patch
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
BuildRequires: pkgconfig(systemd)
|
||||||
|
BuildRequires: systemd-rpm-macros
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-setuptools
|
||||||
|
BuildRequires: systemd
|
||||||
|
|
||||||
|
# For tests
|
||||||
|
BuildRequires: python3-pytest
|
||||||
|
BuildRequires: python3-pytest-mock
|
||||||
|
BuildRequires: iproute
|
||||||
|
BuildRequires: passwd
|
||||||
|
BuildRequires: python3-configobj
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1695953
|
||||||
|
BuildRequires: python3-distro
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1417029
|
||||||
|
BuildRequires: python3-httpretty >= 0.8.14-2
|
||||||
|
BuildRequires: python3-jinja2
|
||||||
|
BuildRequires: python3-jsonpatch
|
||||||
|
BuildRequires: python3-jsonschema
|
||||||
|
BuildRequires: python3-tox
|
||||||
|
BuildRequires: python3-oauthlib
|
||||||
|
BuildRequires: python3-prettytable
|
||||||
|
BuildRequires: python3-pyserial
|
||||||
|
BuildRequires: python3-PyYAML
|
||||||
|
BuildRequires: python3-requests
|
||||||
|
BuildRequires: python3-responses
|
||||||
|
BuildRequires: python3-six
|
||||||
|
BuildRequires: python3-netifaces
|
||||||
|
# dnf is needed to make cc_ntp unit tests work
|
||||||
|
# https://bugs.launchpad.net/cloud-init/+bug/1721573
|
||||||
|
BuildRequires: /usr/bin/dnf
|
||||||
|
|
||||||
|
Requires: dhcp-client
|
||||||
|
Requires: hostname
|
||||||
|
Requires: e2fsprogs
|
||||||
|
Requires: iproute
|
||||||
|
Requires: python3-libselinux
|
||||||
|
Requires: net-tools
|
||||||
|
Requires: policycoreutils-python3
|
||||||
|
Requires: procps
|
||||||
|
Requires: python3-configobj
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1695953
|
||||||
|
Requires: python3-distro
|
||||||
|
Requires: python3-jinja2
|
||||||
|
Requires: python3-jsonpatch
|
||||||
|
Requires: python3-jsonschema
|
||||||
|
Requires: python3-oauthlib
|
||||||
|
Requires: python3-prettytable
|
||||||
|
Requires: python3-pyserial
|
||||||
|
Requires: python3-PyYAML
|
||||||
|
Requires: python3-requests
|
||||||
|
Requires: python3-six
|
||||||
|
Requires: shadow-utils
|
||||||
|
Requires: util-linux
|
||||||
|
Requires: xfsprogs
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1974262
|
||||||
|
Requires: gdisk
|
||||||
|
Requires: openssl
|
||||||
|
|
||||||
|
%{?systemd_requires}
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
Cloud-init is a set of init scripts for cloud instances. Cloud instances
|
||||||
|
need special scripts to run during initialization to retrieve and install
|
||||||
|
ssh keys and to let the user run various scripts.
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
|
||||||
|
# Change shebangs
|
||||||
|
sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/env python3|' \
|
||||||
|
-e 's|#!/usr/bin/python|#!/usr/bin/python3|' tools/* cloudinit/ssh_util.py
|
||||||
|
|
||||||
|
# Removing shebang manually because of rpmlint, will update upstream later
|
||||||
|
sed -i -e 's|#!/usr/bin/python||' cloudinit/cmd/main.py
|
||||||
|
|
||||||
|
# Use unittest from the standard library. unittest2 is old and being
|
||||||
|
# retired in Fedora. See https://bugzilla.redhat.com/show_bug.cgi?id=1794222
|
||||||
|
find tests/ -type f | xargs sed -i s/unittest2/unittest/
|
||||||
|
find tests/ -type f | xargs sed -i s/assertItemsEqual/assertCountEqual/
|
||||||
|
|
||||||
|
%build
|
||||||
|
%py3_build
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
%py3_install -- --init-system=systemd
|
||||||
|
|
||||||
|
# Generate cloud-config file
|
||||||
|
python3 tools/render-cloudcfg --variant %{?rhel:rhel}%{!?rhel:fedora} > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
|
||||||
|
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
|
||||||
|
|
||||||
|
# /run/cloud-init needs a tmpfiles.d entry
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/run/cloud-init
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
|
||||||
|
cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
|
||||||
|
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
|
||||||
|
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
|
||||||
|
|
||||||
|
# installing man pages
|
||||||
|
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1/
|
||||||
|
for man in cloud-id.1 cloud-init.1 cloud-init-per.1; do
|
||||||
|
install -c -m 0644 doc/man/${man} ${RPM_BUILD_ROOT}%{_mandir}/man1/${man}
|
||||||
|
chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/*
|
||||||
|
done
|
||||||
|
|
||||||
|
# Put files in /etc/systemd/system in the right place
|
||||||
|
cp -a %{buildroot}/etc/systemd %{buildroot}/usr/lib
|
||||||
|
rm -rf %{buildroot}/etc/systemd
|
||||||
|
|
||||||
|
%check
|
||||||
|
python3 -m pytest tests/unittests
|
||||||
|
|
||||||
|
%post
|
||||||
|
%systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
|
||||||
|
|
||||||
|
|
||||||
|
%preun
|
||||||
|
%systemd_preun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
|
||||||
|
|
||||||
|
|
||||||
|
%postun
|
||||||
|
%systemd_postun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE LICENSE-Apache2.0 LICENSE-GPLv3
|
||||||
|
%doc ChangeLog
|
||||||
|
%doc doc/*
|
||||||
|
%{_mandir}/man1/*
|
||||||
|
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
|
||||||
|
%dir %{_sysconfdir}/cloud/cloud.cfg.d
|
||||||
|
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
|
||||||
|
%doc %{_sysconfdir}/cloud/cloud.cfg.d/README
|
||||||
|
%dir %{_sysconfdir}/cloud/templates
|
||||||
|
%config(noreplace) %{_sysconfdir}/cloud/templates/*
|
||||||
|
%dir %{_sysconfdir}/rsyslog.d
|
||||||
|
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
|
||||||
|
%{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager
|
||||||
|
%{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient
|
||||||
|
/lib/udev/rules.d/66-azure-ephemeral.rules
|
||||||
|
%{_unitdir}/cloud-config.service
|
||||||
|
%{_unitdir}/cloud-final.service
|
||||||
|
%{_unitdir}/cloud-init.service
|
||||||
|
%{_unitdir}/cloud-init-local.service
|
||||||
|
%{_unitdir}/cloud-config.target
|
||||||
|
%{_unitdir}/cloud-init.target
|
||||||
|
/usr/lib/systemd/system-generators/cloud-init-generator
|
||||||
|
%{_unitdir}/cloud-init-hotplugd.service
|
||||||
|
%{_unitdir}/cloud-init-hotplugd.socket
|
||||||
|
%{_unitdir}/sshd-keygen@.service.d/disable-sshd-keygen-if-cloud-init-active.conf
|
||||||
|
%{_tmpfilesdir}/%{name}.conf
|
||||||
|
%{python3_sitelib}/*
|
||||||
|
%{_libexecdir}/%{name}
|
||||||
|
%{_bindir}/cloud-init*
|
||||||
|
%{_bindir}/cloud-id
|
||||||
|
%dir /run/cloud-init
|
||||||
|
%dir /var/lib/cloud
|
||||||
|
%{_datadir}/bash-completion/completions/cloud-init
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Feb 16 2023 Neil Hanlon <neil@shrug.pw> - 22.2.2-0
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
Loading…
Reference in New Issue
Block a user