From c933187af44a5de1d6eafde5dcd48e8ac369cf34 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Thu, 18 Apr 2024 20:21:14 -0500 Subject: [PATCH 2/3] docs: Add deprecated system_info to schema (#5168) RH-Author: Ani Sinha RH-MergeRequest: 95: Deprecate the users ssh-authorized-keys property (#5162) RH-Jira: RHEL-45262 RH-Acked-by: Emanuele Giuseppe Esposito RH-Acked-by: Miroslav Rezanina RH-Commit: [2/3] c4ea6f45ee0997e2f749c290fb8f2ceb8c05c691 (anisinha/cloud-init) In some cases, `system_info` can be passed via user data or vendor data to override the system_info in /etc/cloud/cloud.cfg . While this technically can work, this is a use case we no longer support and should indicate that it is deprecated. Also remove/update examples. (cherry picked from commit 7c67f7732f04b41600934818f7d5bcb4d085ed7c) Conflicts: cloudinit/config/schemas/schema-cloud-config-v1.json - due to change fdefe08ad19cea5eb ("fix: Fix typos (#4850)") not present in downstream. doc/examples/cloud-config-user-groups.txt - due to change 0aa17cd10bdd6 ("docs: set the home directory using homedir, not home (#5101)") not present downstream. tests/unittests/sources/test_vultr.py - due to change 144782a838 ("test: Remove side effects from tests (#5074)") not present downstream. --- .../schemas/schema-cloud-config-v1.json | 7 ++++++ doc/examples/cloud-config-apt.txt | 23 ------------------- doc/examples/cloud-config-user-groups.txt | 12 ++-------- tests/data/user_data.1.txt | 10 -------- tests/unittests/runs/test_merge_run.py | 16 ++++++++++++- 5 files changed, 24 insertions(+), 44 deletions(-) diff --git a/cloudinit/config/schemas/schema-cloud-config-v1.json b/cloudinit/config/schemas/schema-cloud-config-v1.json index 670ef4c2..97cf2b74 100644 --- a/cloudinit/config/schemas/schema-cloud-config-v1.json +++ b/cloudinit/config/schemas/schema-cloud-config-v1.json @@ -513,6 +513,12 @@ }, "merge_type": { "$ref": "#/$defs/merge_defintion" + }, + "system_info": { + "type": "object", + "description": "System and/or distro specific settings. This is not intended to be overridden by user data or vendor data.", + "deprecated": true, + "deprecated_version": "24.2" } } }, @@ -3905,6 +3911,7 @@ "ssh_pwauth": {}, "ssh_quiet_keygen": {}, "swap": {}, + "system_info": {}, "timezone": {}, "ubuntu_advantage": {}, "updates": {}, diff --git a/doc/examples/cloud-config-apt.txt b/doc/examples/cloud-config-apt.txt index dd6a0f6a..04968035 100644 --- a/doc/examples/cloud-config-apt.txt +++ b/doc/examples/cloud-config-apt.txt @@ -8,29 +8,6 @@ # Number: Set pipelining to some number (not recommended) apt_pipelining: False -## apt config via system_info: -# under the 'system_info', you can customize cloud-init's interaction -# with apt. -# system_info: -# apt_get_command: [command, argument, argument] -# apt_get_upgrade_subcommand: dist-upgrade -# -# apt_get_command: -# To specify a different 'apt-get' command, set 'apt_get_command'. -# This must be a list, and the subcommand (update, upgrade) is appended to it. -# default is: -# ['apt-get', '--option=Dpkg::Options::=--force-confold', -# '--option=Dpkg::options::=--force-unsafe-io', '--assume-yes', '--quiet'] -# -# apt_get_upgrade_subcommand: "dist-upgrade" -# Specify a different subcommand for 'upgrade. The default is 'dist-upgrade'. -# This is the subcommand that is invoked for package_upgrade. -# -# apt_get_wrapper: -# command: eatmydata -# enabled: [True, False, "auto"] -# - # Install additional packages on first boot # # Default: none diff --git a/doc/examples/cloud-config-user-groups.txt b/doc/examples/cloud-config-user-groups.txt index 56eb674f..2cafef88 100644 --- a/doc/examples/cloud-config-user-groups.txt +++ b/doc/examples/cloud-config-user-groups.txt @@ -143,13 +143,5 @@ users: # # users[0] (the first user in users) overrides the user directive. # -# The 'default' user above references the distro's config: -# system_info: -# default_user: -# name: Ubuntu -# plain_text_passwd: 'ubuntu' -# home: /home/ubuntu -# shell: /bin/bash -# lock_passwd: True -# gecos: Ubuntu -# groups: [adm, cdrom, dip, lxd, sudo] +# The 'default' user above references the distro's config set in +# /etc/cloud/cloud.cfg. diff --git a/tests/data/user_data.1.txt b/tests/data/user_data.1.txt index 4c4543de..a1b5aa60 100644 --- a/tests/data/user_data.1.txt +++ b/tests/data/user_data.1.txt @@ -3,13 +3,3 @@ write_files: - content: blah path: /etc/blah.ini permissions: 493 - -system_info: - package_mirrors: - - arches: [i386, amd64, blah] - failsafe: - primary: http://my.archive.mydomain.com/ubuntu - security: http://my.security.mydomain.com/ubuntu - search: - primary: [] - security: [] diff --git a/tests/unittests/runs/test_merge_run.py b/tests/unittests/runs/test_merge_run.py index afc256ec..251c5ae5 100644 --- a/tests/unittests/runs/test_merge_run.py +++ b/tests/unittests/runs/test_merge_run.py @@ -22,7 +22,21 @@ class TestMergeRun(helpers.FilesystemMockingTestCase): cfg = { "datasource_list": ["None"], "cloud_init_modules": ["write_files"], - "system_info": {"paths": {"run_dir": new_root}}, + "system_info": { + "paths": {"run_dir": new_root}, + "package_mirrors": [ + { + "arches": ["i386", "amd64", "blah"], + "failsafe": { + "primary": "http://my.archive.mydomain.com/ubuntu", + "security": ( + "http://my.security.mydomain.com/ubuntu" + ), + }, + "search": {"primary": [], "security": []}, + }, + ], + }, } ud = helpers.readResource("user_data.1.txt") cloud_cfg = safeyaml.dumps(cfg) -- 2.39.3