diff options
author | Chad Smith <chad.smith@canonical.com> | 2022-08-17 22:30:57 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 22:30:57 -0600 |
commit | 923e140d4443a3732fab1cc0229a13caed5d929a (patch) | |
tree | 82053b07a542b9423292d2c043827004ecd5a647 /cloudinit/cmd | |
parent | 66d4095c8260a73209a98a2cc9b52623b69f1fb7 (diff) | |
download | cloud-init-git-923e140d4443a3732fab1cc0229a13caed5d929a.tar.gz |
sources: obj.pkl cache should be written anyime get_data is run (#1669)
When metadata update events trigger a new datasource.get_data run
ensure we are syncing the cached obj.pkl to disk so subsequent
boot stages can leverage the updated metadata.
Add write_cache param to persist_instance_data to avoid
persisting instance data when init.ds_restored from cache.
This avoids a race on clouds where network config is updated
per boot in init-local timeframe but init-network uses stale network
metadata from cache because updated metadata was not
persisted.
Migate _pkl_load and _pkl_store out of stages module and into
sources as it really is only applicable to datasource serialization.
Diffstat (limited to 'cloudinit/cmd')
-rwxr-xr-x | cloudinit/cmd/main.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cloudinit/cmd/main.py b/cloudinit/cmd/main.py index 2860126a..6134d7c4 100755 --- a/cloudinit/cmd/main.py +++ b/cloudinit/cmd/main.py @@ -809,7 +809,7 @@ def _maybe_persist_instance_data(init): init.paths.run_dir, sources.INSTANCE_JSON_FILE ) if not os.path.exists(instance_data_file): - init.datasource.persist_instance_data() + init.datasource.persist_instance_data(write_cache=False) def _maybe_set_hostname(init, stage, retry_stage): |