← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1839538] [NEW] Values expected to be bools fetched from DataSource.ds_cfg should use the util methods to support common string inputs

 

Public bug reported:

At the moment, there are some places where we do something along the
lines of `bool_thing = self.ds_cfg.get("cfg_option", False)`.  This is
incorrect, because specifying anything other than the empty string in
configuration (such as "no" or "false") will result in a True-ish value.

A rough audit suggests the following places have this problem:

cloudinit/sources/DataSourceDigitalOcean.py:43:        self.use_ip4LL = self.ds_cfg.get('use_ip4LL', MD_USE_IPV4LL)
cloudinit/sources/DataSourceAzure.py:503:                self.ds_cfg.get('apply_network_config')):
cloudinit/sources/DataSourceAzure.py:682:                                 preserve_ntfs=self.ds_cfg.get(
cloudinit/sources/DataSourceAzure.py:702:            if self.ds_cfg.get('apply_network_config'):

(This audit was just done with grep, so will have missed any places
where ds_cfg is referred to as anything but self.ds_cfg.)

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1839538

Title:
  Values expected to be bools fetched from DataSource.ds_cfg should use
  the util methods to support common string inputs

Status in cloud-init:
  New

Bug description:
  At the moment, there are some places where we do something along the
  lines of `bool_thing = self.ds_cfg.get("cfg_option", False)`.  This is
  incorrect, because specifying anything other than the empty string in
  configuration (such as "no" or "false") will result in a True-ish
  value.

  A rough audit suggests the following places have this problem:

  cloudinit/sources/DataSourceDigitalOcean.py:43:        self.use_ip4LL = self.ds_cfg.get('use_ip4LL', MD_USE_IPV4LL)
  cloudinit/sources/DataSourceAzure.py:503:                self.ds_cfg.get('apply_network_config')):
  cloudinit/sources/DataSourceAzure.py:682:                                 preserve_ntfs=self.ds_cfg.get(
  cloudinit/sources/DataSourceAzure.py:702:            if self.ds_cfg.get('apply_network_config'):

  (This audit was just done with grep, so will have missed any places
  where ds_cfg is referred to as anything but self.ds_cfg.)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1839538/+subscriptions