diff options
author | Antonio Romito <antonio.romito@manicom.io> | 2019-04-09 14:54:23 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-04-09 14:54:23 +0000 |
commit | bdd9c0ac9bcd68ec1ac3b2038dad0ba3dbd83341 (patch) | |
tree | 1fe29efe7c706bf2b90d17edda5bc44c9e873523 /cloudinit/cmd/main.py | |
parent | f247dd20ea73f8e153936bee50c57dae9440ecf7 (diff) | |
download | vyos-cloud-init-bdd9c0ac9bcd68ec1ac3b2038dad0ba3dbd83341.tar.gz vyos-cloud-init-bdd9c0ac9bcd68ec1ac3b2038dad0ba3dbd83341.zip |
cmd:main.py: Fix missing 'modules-init' key in modes dict
Cloud-init's main.py will fail when presented with a new
stage name 'modules-init' if upgrading an older cloud-init.
Fix this by initializing unknown stage names before accessing.
LP: #1815109
Diffstat (limited to 'cloudinit/cmd/main.py')
-rw-r--r-- | cloudinit/cmd/main.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cloudinit/cmd/main.py b/cloudinit/cmd/main.py index 933c019a..a5446da7 100644 --- a/cloudinit/cmd/main.py +++ b/cloudinit/cmd/main.py @@ -632,13 +632,14 @@ def status_wrapper(name, args, data_d=None, link_d=None): 'start': None, 'finished': None, } + if status is None: status = {'v1': {}} - for m in modes: - status['v1'][m] = nullstatus.copy() status['v1']['datasource'] = None - elif mode not in status['v1']: - status['v1'][mode] = nullstatus.copy() + + for m in modes: + if m not in status['v1']: + status['v1'][m] = nullstatus.copy() v1 = status['v1'] v1['stage'] = mode |