feat(raspberry-pi-os): Disable fallback netcfg + remove apt mirror config - #6482
Conversation
…nfig Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
255a3c9 to
a937825
Compare
|
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.) |
|
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.) |
|
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.) |
There was a problem hiding this comment.
Hello @paulober and @tdewey-rpi. I would like to merge this PR and have a couple of minor requests.
-
Can we update the suggested commit message in this PR description to document the reason why Raspberry Pi OS no longer wants to point APT to
http://archive.raspberrypi.com/debian/It still appears there are some packages hosted there. In the absence of such APT configuration what is the expected alternatives for RPI OS to obtain such packages. -
This PR or branch doesn't allow me to resolve and push my minor review suggestions to it. Can one of the RPI folks push the following changes to this branch (which captures my inline review comments)
diff --git a/cloudinit/distros/raspberry_pi_os.py b/cloudinit/distros/raspberry_pi_os.py
index a35c81cea..f5a5a20fa 100644
--- a/cloudinit/distros/raspberry_pi_os.py
+++ b/cloudinit/distros/raspberry_pi_os.py
@@ -86,7 +86,7 @@ class Distro(debian.Distro):
LOG.debug("%s value is: %s", key, disable_fallback_netcfg)
if not disable_fallback_netcfg:
- return net.generate_fallback_config(self)
+ return net.generate_fallback_config()
LOG.info(
"Skipping generation of fallback network config as per "
diff --git a/tests/unittests/distros/test_raspberry_pi_os.py b/tests/unittests/distros/test_raspberry_pi_os.py
index 0d87395d5..0d7888436 100644
--- a/tests/unittests/distros/test_raspberry_pi_os.py
+++ b/tests/unittests/distros/test_raspberry_pi_os.py
@@ -94,9 +94,12 @@ class TestRaspberryPiOS:
assert distro.add_user("pi") is False
assert "Failed to setup user" in caplog.text
- @mock.patch("cloudinit.net.generate_fallback_config")
+ @mock.patch(
+ "cloudinit.net.generate_fallback_config",
+ return_value={"version": 1, "config": "fake"},
+ )
def test_fallback_netcfg(self, m_fallback_cfg, caplog):
- # This test is based on Photon OS test_fallback_netcfg
+ """Avoid fallback network unless disable_fallback_netcfg is False."""
cls = fetch("raspberry_pi_os")
distro = cls("raspberry-pi-os", {}, None)
key = "disable_fallback_netcfg"
@@ -106,7 +109,7 @@ class TestRaspberryPiOS:
"Rely on Raspberry Pi OS's default network configuration."
)
- # Don't use fallback if no setting given
+ # The default skips fallback network config when no setting is given.
caplog.clear()
assert distro.generate_fallback_config() is None
assert expected_log_line in caplog.text
@@ -118,5 +121,8 @@ class TestRaspberryPiOS:
caplog.clear()
distro._cfg[key] = False
- assert distro.generate_fallback_config() is not None
+ assert distro.generate_fallback_config() == {
+ "version": 1,
+ "config": "fake",
+ }
assert expected_log_line not in caplog.textOnce we have confirmation on the suggested drop of APT mirrors and the updated PR description we will merge this PR.
Many thanks!
Updated. RPi OS only ships as installed images where we want apt config stuff to work as it did before so there is no scenario where I expect / want users to rely on cloud-init to provide the apt config. |
Apply patch provided by @blackboxsw to correct the call to generate_fallback_config() and update the corresponding unit tests. Authored-by: Chad Smith <chad.smith@canonical.com>
Authored-by: Chad Smith <chad.smith@canonical.com>
blackboxsw
left a comment
There was a problem hiding this comment.
Thank you @paulober for these additional updates and providing background in the commit message.
canonical#6482) Disable the fallback netcfg in the cloud.cfg template for Raspberry Pi OS and remove the apt mirror config because RPi OS ships as already installed images and there is no scenario where users are expected to rely on cloud-init for providing the apt config. Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
#6482) Disable the fallback netcfg in the cloud.cfg template for Raspberry Pi OS and remove the apt mirror config because RPi OS ships as already installed images and there is no scenario where users are expected to rely on cloud-init for providing the apt config. Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
Proposed Commit Message
Additional Context
Merge type
@tdewey-rpi