summaryrefslogtreecommitdiff
path: root/tests/unittests/config/test_schema.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2023-05-12 11:29:15 -0600
committerGitHub <noreply@github.com>2023-05-12 11:29:15 -0600
commit73f34575da4f99a376998516a13c3a79cc640ae3 (patch)
tree06f396d4fcda64ad8cb4476538b50d524c59a2b9 /tests/unittests/config/test_schema.py
parent9f8450368c2ae713de0a2308f5d3cb73de5b39f2 (diff)
downloadcloud-init-git-73f34575da4f99a376998516a13c3a79cc640ae3.tar.gz
schema: read_cfg_paths call init.fetch to lookup /v/l/c/instance
Fix cloud-init schema --system being unable to find merged userdata stored at /var/lib/cloud/instance/cloud_config.txt. Init.paths.get_ipath only has visibility to merged cloud config in /var/lib/cloud/<instance_id>/cloud-config.txt after fetching the existing cached datasource which provides instance-id from metadata in order to determine the unique instance-id which represents the path to the cloud-config.txt. To support reuse of read_cfg_paths helper function, add an optional parameter fetch_existing_datasource which indicates whether reading the existing datasource is necessary for this helper function. cloud-init schema --system calls read_cfg_paths providing fetch_existing_datasource="trust" prior to calls to paths.get_ipath().
Diffstat (limited to 'tests/unittests/config/test_schema.py')
-rw-r--r--tests/unittests/config/test_schema.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/unittests/config/test_schema.py b/tests/unittests/config/test_schema.py
index ceb689a4..b5314b69 100644
--- a/tests/unittests/config/test_schema.py
+++ b/tests/unittests/config/test_schema.py
@@ -2060,3 +2060,6 @@ apt_reboot_if_required: Default: ``false``. Deprecated in version 22.2.\
expected_err.format(cfg_file=user_data_fn, id_path=id_path) == err
)
assert "deprec" not in caplog.text
+ assert read_cfg_paths.call_args_list == [
+ mock.call(fetch_existing_datasource="trust")
+ ]