diff options
author | James Falcon <therealfalcon@gmail.com> | 2021-07-15 17:52:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 16:52:21 -0600 |
commit | eacb0353803263934aa2ac827c37e461c87cb107 (patch) | |
tree | 2fade7310e7da0cbda78402d7838ae129866cbbf /cloudinit/stages.py | |
parent | 881be6e780b258e98d1ecba4777ba3e171d5760d (diff) | |
download | cloud-init-git-eacb0353803263934aa2ac827c37e461c87cb107.tar.gz |
Fix MIME policy failure on python version upgrade (#934)
Python 3.6 added a new `policy` attribute to `MIMEMultipart`.
MIMEMultipart may be part of the cached object pickle of a datasource.
Upgrading from an old version of python to 3.6+ will cause the
datasource to be invalid after pickle load.
This commit uses the upgrade framework to attempt to access the mime
message and fail early (thus discarding the cache) if we cannot.
Commit 78e89b03 should fix this issue more generally.
Diffstat (limited to 'cloudinit/stages.py')
-rw-r--r-- | cloudinit/stages.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py index 3688be2e..06e0d9b1 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -1070,6 +1070,8 @@ def _pkl_load(fname): return None try: return pickle.loads(pickle_contents) + except sources.DatasourceUnpickleUserDataError: + return None except Exception: util.logexc(LOG, "Failed loading pickled blob from %s", fname) return None |