cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #06295
Re: [Merge] ~pzakha/cloud-init:userdata into cloud-init:master
Hi Pavel, thanks for the contribution to cloud-init! I'm flitting between meetings, so I'm not able to assess whether these changes are broadly appropriate. That said, I do have an inline comment on how the changes could be expressed a little more concisely. I'll revisit this later today for a more full review.
Diff comments:
> diff --git a/cloudinit/stages.py b/cloudinit/stages.py
> index da7d349..94b3f0f 100644
> --- a/cloudinit/stages.py
> +++ b/cloudinit/stages.py
> @@ -548,7 +548,17 @@ class Init(object):
> with events.ReportEventStack("consume-user-data",
> "reading and applying user-data",
> parent=self.reporter):
> - self._consume_userdata(frequency)
> + cfg = self.cfg
>From a Python code review POV, this could be much simpler:
if self.cfg.get('allow_userdata', True):
LOG.debug('allow_userdata = True: consuming user-data')
self._consume_userdata(frequency)
else:
LOG.debug('allow_userdata = False: discarding user-data')
I believe an analogous change could also be made to cc_ssh above.
> + if 'allow_userdata' in cfg:
> + allow_userdata = cfg['allow_userdata']
> + else:
> + allow_userdata = True
> +
> + if allow_userdata:
> + LOG.debug('allow_userdata = True: consuming user-data')
> + self._consume_userdata(frequency)
> + else:
> + LOG.debug('allow_userdata = False: discarding user-data')
> with events.ReportEventStack("consume-vendor-data",
> "reading and applying vendor-data",
> parent=self.reporter):
--
https://code.launchpad.net/~pzakha/cloud-init/+git/cloud-init/+merge/367721
Your team cloud-init commiters is requested to review the proposed merge of ~pzakha/cloud-init:userdata into cloud-init:master.
References