Commit cc549350 authored by Scott Moser's avatar Scott Moser

DataSourceNoCloud: fix check_instance_id when upgraded

A system that had booted, upgraded, and then rebooted would show
a cloud-init stack trace as it attempted to run new code
with the old pickled object.  The old object would not have the
seed_dirs attribute.  So we check and fallback correctly if that
is not present.

LP: #1568150
parent 763be4ec
......@@ -216,8 +216,11 @@ class DataSourceNoCloud(sources.DataSource):
if not current:
return None
# LP: #1568150 need getattr in the case that an old class object
# has been loaded from a pickled file and now executing new source.
dirs = getattr(self, 'seed_dirs', [self.seed_dir])
quick_id = _quick_read_instance_id(cmdline_id=self.cmdline_id,
if not quick_id:
return None
return quick_id == current
......@@ -238,6 +241,8 @@ def _quick_read_instance_id(cmdline_id, dirs=None):
return fill[iid_key]
for d in dirs:
if d is None:
data = util.pathprefix2dict(d, required=['meta-data'])
md = util.load_yaml(data['meta-data'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment