Rebase to 22.2

This commit is contained in:
Neal Gompa 2022-05-19 09:44:52 -04:00
parent f0a6cf49bd
commit a32e90573f
6 changed files with 106 additions and 2595 deletions

View File

@ -1,88 +0,0 @@
From d46ac3af1e964916f65dd920fc54bd8c0c8e32de Mon Sep 17 00:00:00 2001
From: Eduardo Otubo <otubo@redhat.com>
Date: Thu, 10 Dec 2020 17:43:15 +0100
Subject: [PATCH] Adding RHEL default cloud.cfg
---
rhel/cloud.cfg | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
create mode 100644 rhel/cloud.cfg
diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg
new file mode 100644
index 00000000..9ecba215
--- /dev/null
+++ b/rhel/cloud.cfg
@@ -0,0 +1,69 @@
+users:
+ - default
+
+disable_root: 1
+ssh_pwauth: 0
+
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
+resize_rootfs_tmp: /dev
+ssh_deletekeys: 1
+ssh_genkeytypes: ~
+syslog_fix_perms: ~
+disable_vmware_customization: false
+
+cloud_init_modules:
+ - disk_setup
+ - migrator
+ - bootcmd
+ - write-files
+ - growpart
+ - resizefs
+ - set_hostname
+ - update_hostname
+ - update_etc_hosts
+ - rsyslog
+ - users-groups
+ - ssh
+
+cloud_config_modules:
+ - mounts
+ - locale
+ - set-passwords
+ - rh_subscription
+ - yum-add-repo
+ - package-update-upgrade-install
+ - timezone
+ - puppet
+ - chef
+ - salt-minion
+ - mcollective
+ - disable-ec2-metadata
+ - runcmd
+
+cloud_final_modules:
+ - rightscale_userdata
+ - scripts-per-once
+ - scripts-per-boot
+ - scripts-per-instance
+ - scripts-user
+ - ssh-authkey-fingerprints
+ - keys-to-console
+ - phone-home
+ - final-message
+ - power-state-change
+
+system_info:
+ default_user:
+ name: cloud-user
+ lock_passwd: true
+ gecos: Cloud User
+ groups: [adm, systemd-journal]
+ sudo: ["ALL=(ALL) NOPASSWD:ALL"]
+ shell: /bin/bash
+ distro: rhel
+ paths:
+ cloud_dir: /var/lib/cloud
+ templates_dir: /etc/cloud/templates
+ ssh_svcname: sshd
+
+# vim:syntax=yaml
--
2.27.0

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
From b813d8b59c46148dcbc7ff9f36e2aac7cce38373 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
Date: Tue, 22 Feb 2022 07:20:17 -0500
Subject: [PATCH] net: Prefer NetworkManager renderer by default
NetworkManager is used by default on a variety of Linux distributions,
and exists as a cross-distribution network management service.
Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
---
cloudinit/net/renderers.py | 2 +-
tests/unittests/test_net.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cloudinit/net/renderers.py b/cloudinit/net/renderers.py
index 7edc34b5..d958c652 100644
--- a/cloudinit/net/renderers.py
+++ b/cloudinit/net/renderers.py
@@ -27,10 +27,10 @@ NAME_TO_RENDERER = {
}
DEFAULT_PRIORITY = [
+ "network-manager",
"eni",
"sysconfig",
"netplan",
- "network-manager",
"freebsd",
"netbsd",
"openbsd",
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 9552ac12..668f2c45 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -7194,8 +7194,8 @@ class TestRenderersSelect:
("netplan", True, False, False, False, False),
# -netplan -ifupdown +sys -nm -networkd selects sysconfig
("sysconfig", False, False, True, False, False),
- # -netplan -ifupdown +sys +nm -networkd selects sysconfig
- ("sysconfig", False, False, True, True, False),
+ # -netplan -ifupdown +sys +nm -networkd selects network-manager
+ ("network-manager", False, False, True, True, False),
# -netplan -ifupdown -sys +nm -networkd selects nm
("network-manager", False, False, False, True, False),
# -netplan -ifupdown -sys +nm +networkd selects nm
--
2.34.1

View 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

View File

@ -1,6 +1,6 @@
Name: cloud-init Name: cloud-init
Version: 22.1 Version: 22.2
Release: 3%{?dist} Release: 1%{?dist}
Summary: Cloud instance init scripts Summary: Cloud instance init scripts
License: ASL 2.0 or GPLv3 License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init URL: http://launchpad.net/cloud-init
@ -8,17 +8,10 @@ URL: http://launchpad.net/cloud-init
Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
Source1: cloud-init-tmpfiles.conf Source1: cloud-init-tmpfiles.conf
# Add full support for NetworkManager
# From: https://github.com/canonical/cloud-init/pull/1224
# https://bugzilla.redhat.com/show_bug.cgi?id=2014701
Patch1: cloud-init-22.1-PR1224-full-nm-support.patch
# Default to NetworkManager for configuration renderer # Default to NetworkManager for configuration renderer
# https://bugzilla.redhat.com/show_bug.cgi?id=2014701 # https://bugzilla.redhat.com/show_bug.cgi?id=2014701
Patch2: cloud-init-22.1-nm-default.patch # From: https://github.com/canonical/cloud-init/commit/7703aa98b89c8daba207c28a0422268ead10019a
Patch1: cloud-init-22.3-nm-default.patch
# Adding default RHEL configuration file
Patch3: cloud-init-21.3-Adding-RHEL-default-cloud.cfg.patch
BuildArch: noarch BuildArch: noarch
@ -30,6 +23,7 @@ BuildRequires: systemd
# For tests # For tests
BuildRequires: python3-pytest BuildRequires: python3-pytest
BuildRequires: python3-pytest-mock
BuildRequires: iproute BuildRequires: iproute
BuildRequires: passwd BuildRequires: passwd
BuildRequires: python3-configobj BuildRequires: python3-configobj
@ -46,6 +40,7 @@ BuildRequires: python3-prettytable
BuildRequires: python3-pyserial BuildRequires: python3-pyserial
BuildRequires: python3-PyYAML BuildRequires: python3-PyYAML
BuildRequires: python3-requests BuildRequires: python3-requests
BuildRequires: python3-responses
BuildRequires: python3-six BuildRequires: python3-six
BuildRequires: python3-netifaces BuildRequires: python3-netifaces
# dnf is needed to make cc_ntp unit tests work # dnf is needed to make cc_ntp unit tests work
@ -109,11 +104,8 @@ find tests/ -type f | xargs sed -i s/assertItemsEqual/assertCountEqual/
%install %install
%py3_install -- --init-system=systemd %py3_install -- --init-system=systemd
%if 0%{?fedora} # Generate cloud-config file
python3 tools/render-cloudcfg --variant fedora > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg python3 tools/render-cloudcfg --variant %{?rhel:rhel}%{!?rhel:fedora} > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
%elif 0%{?rhel}
cp -p rhel/cloud.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
%endif
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
@ -188,6 +180,9 @@ python3 -m pytest tests/unittests
%changelog %changelog
* Thu May 19 2022 Neal Gompa <ngompa@fedoraproject.org> - 22.2-1
- Rebase to 22.2
* Thu Mar 10 2022 Dusty Mabe <dusty@dustymabe.com> - 22.1-3 * Thu Mar 10 2022 Dusty Mabe <dusty@dustymabe.com> - 22.1-3
- Drop requirement on NetworkManager-config-server - Drop requirement on NetworkManager-config-server

View File

@ -1 +1 @@
SHA512 (cloud-init-22.1.tar.gz) = 485e358777379a22dd2b0f6aa7afb1751eb44831c6e03ecbbd9c6823eaa20535e6e83fc245818ce1bb207425976839b356dadcfa3cfe62385b9d340b08ff21ab SHA512 (cloud-init-22.2.tar.gz) = 07fec2f1d6eab20a1161672bb339a0c6b2826540bcb03936f95458b179fcb1b3142773c9a4038fe02b30bb05a5ca48a4153b6b0f59015b43bd6c6602832f9d6f