BoolOpt defaults to None

Bug #1764782 reported by Ben Nemec
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.config
Won't Fix
Medium
Unassigned

Bug Description

If no default is passed to a BoolOpt, it appears to default to None. This is an invalid Boolean value, per the type definition: https://github.com/openstack/oslo.config/blob/84655714b656c8296bfd70aeb5daf5996e1f5add/oslo_config/types.py#L232

We should fix BoolOpt so it defaults to a valid Boolean value, probably False.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

Do we have any projects using that None value to indicate that the boolean value hasn't been set by the user? We have another way to do that now, so we could get them to update, but that's the only thing that comes to mind that would make me hesitate to change the behavior.

Revision history for this message
Matt Riedemann (mriedem) wrote :

I have a case for adding a new BoolOpt which defaults to None (see https://review.opendev.org/#/c/675025/ ) because I want to add a new config option to nova (allow_cold_migrate_to_same_host) which defaults to whatever is set for another existing option (allow_resize_to_same_host, which defaults to False in config). So I want to default the new option to the value for the existing option (so I don't introduce a backward incompatible behavior change on upgrade) but still allow operators to opt into the behavior change with the new option.

Revision history for this message
Ben Nemec (bnemec) wrote :

I'm just going to close this. While I still think it's incorrect behavior, it's been around for a long time and it's unlikely to be worth the hassle of fixing all the places people may have relied on it.

Changed in oslo.config:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.