summaryrefslogtreecommitdiff
path: root/cloudinit/stages.py
diff options
context:
space:
mode:
authorJames Falcon <therealfalcon@gmail.com>2021-07-15 17:52:21 -0500
committerGitHub <noreply@github.com>2021-07-15 16:52:21 -0600
commiteacb0353803263934aa2ac827c37e461c87cb107 (patch)
tree2fade7310e7da0cbda78402d7838ae129866cbbf /cloudinit/stages.py
parent881be6e780b258e98d1ecba4777ba3e171d5760d (diff)
downloadcloud-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.py2
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