Values expected to be bools fetched from DataSource.ds_cfg should use the util methods to support common string inputs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
At the moment, there are some places where we do something along the lines of `bool_thing = self.ds_
A rough audit suggests the following places have this problem:
cloudinit/
cloudinit/
cloudinit/
cloudinit/
(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.)
Dan,
I know I've talked to Chad and Ryan before about this, but I kind of
see the plethora of values that are accepted as bad design (my bad
design).
Ultimately, I'd rather deprecate and remove that functionality than
extend it to new places. Its just not really helpful and makes
checking more difficult.
I realize we're in a bad place and you're trying to make it better. I
think the long path to making it better is to take yaml bool for
boolean values and complain on non-boolean values.
On Thu, Aug 8, 2019 at 3:55 PM Dan Watkins <email address hidden> wrote: cfg.get( "cfg_option" , False)`. This is sources/ DataSourceDigit alOcean. py:43: self.use_ip4LL = self.ds_ cfg.get( 'use_ip4LL' , MD_USE_IPV4LL) sources/ DataSourceAzure .py:503: self.ds_ cfg.get( 'apply_ network_ config' )): sources/ DataSourceAzure .py:682: preserve_ ntfs=self. ds_cfg. get( sources/ DataSourceAzure .py:702: if self.ds_ cfg.get( 'apply_ network_ config' ): /bugs.launchpad .net/bugs/ 1839538 /bugs.launchpad .net/cloud- init/+bug/ 1839538/ +subscriptions
>
> Public bug reported:
>
> At the moment, there are some places where we do something along the
> lines of `bool_thing = self.ds_
> 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/
> cloudinit/
> cloudinit/
> cloudinit/
>
> (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 subscribed to cloud-
> init.
> https:/
>
> Title:
> Values expected to be bools fetched from DataSource.ds_cfg should use
> the util methods to support common string inputs
>
> To manage notifications about this bug go to:
> https:/