In this peace of code where is checked if status variable is populated or not, in case it is it's not checked if all modes keys are present into the array, and in case a not set as "null".
~~~
...
if status is None:
status = {'v1': {}}
for m in modes: status['v1'][m] = nullstatus.copy() status['v1']['datasource'] = None
else:
for m in modes:
if m not in status['v1']: status['v1'][m] = nullstatus.copy()
...
~~~
I proposed the following fix (tested)
# diff /usr/lib/python2.7/site-packages/cloudinit/cmd/main.py.orig /usr/lib/python2.7/site-packages/cloudinit/cmd/main.py
643,644c643,646
< elif mode not in status['v1']:
< status['v1'][mode] = nullstatus.copy()
---
> else:
> for m in modes:
> if m not in status['v1']:
> status['v1'][m] = nullstatus.copy()
Probably I found the reason:
In this peace of code where is checked if status variable is populated or not, in case it is it's not checked if all modes keys are present into the array, and in case a not set as "null".
~~~
status[ 'v1'][m] = nullstatus.copy()
status[ 'v1'][' datasource' ] = None
status[ 'v1'][m] = nullstatus.copy()
...
if status is None:
status = {'v1': {}}
for m in modes:
else:
for m in modes:
if m not in status['v1']:
...
~~~
I proposed the following fix (tested)
# diff /usr/lib/ python2. 7/site- packages/ cloudinit/ cmd/main. py.orig /usr/lib/ python2. 7/site- packages/ cloudinit/ cmd/main. py
643,644c643,646
< elif mode not in status['v1']:
< status['v1'][mode] = nullstatus.copy()
---
> else:
> for m in modes:
> if m not in status['v1']:
> status['v1'][m] = nullstatus.copy()