From d64a8c310bd73c00ad88898be507d48ef653bfe4 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: 94: Deprecate the users ssh-authorized-keys property (#5162) RH-Jira: RHEL-45263 RH-Acked-by: Emanuele Giuseppe Esposito RH-Acked-by: Miroslav Rezanina RH-Commit: [2/3] c3454815e569896df0368ddbda0c648216363ed0 (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) --- .../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 ++++++++++++- tests/unittests/sources/test_vultr.py | 3 --- 6 files changed, 24 insertions(+), 47 deletions(-) diff --git a/cloudinit/config/schemas/schema-cloud-config-v1.json b/cloudinit/config/schemas/schema-cloud-config-v1.json index 24b6c4bd..23573583 100644 --- a/cloudinit/config/schemas/schema-cloud-config-v1.json +++ b/cloudinit/config/schemas/schema-cloud-config-v1.json @@ -602,6 +602,12 @@ }, "merge_type": { "$ref": "#/$defs/merge_definition" + }, + "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" } } }, @@ -3894,6 +3900,7 @@ "ssh_pwauth": {}, "ssh_quiet_keygen": {}, "swap": {}, + "system_info": {}, "timezone": {}, "ubuntu_advantage": {}, "ubuntu_pro": {}, 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 7b1559b9..e7f32d03 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) diff --git a/tests/unittests/sources/test_vultr.py b/tests/unittests/sources/test_vultr.py index 117fdab0..e5f1c39e 100644 --- a/tests/unittests/sources/test_vultr.py +++ b/tests/unittests/sources/test_vultr.py @@ -22,9 +22,6 @@ chpasswd: expire: false list: - root:$6$SxXx...k2mJNIzZB5vMCDBlYT1 -system_info: - default_user: - name: root """ # Vultr metadata test data -- 2.39.3