Taskflow doesn't treat boolean configuration properly

Bug #1999174 reported by Dmitriy Rabotyagov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
taskflow
Fix Released
Undecided
Unassigned

Bug Description

At the moment taskflow just tries to load the configuration with getting attribute from passed config and assuming it's boolean:
https://opendev.org/openstack/taskflow/src/commit/5bcac4c7d4503be8161bcf159981199e3ea89d4d/taskflow/jobs/backends/impl_zookeeper.py#L832

In fact, at least octavia does pass variables as str and not as bool.

So in case in octavia.conf you will define following:

[task_flow]
jobboard_zookeeper_ssl_options = use_ssl:True,verify_certs:False,check_compatible:False

taskflow will end up with wrong behaviour. Since type(self._conf['check_compatible']) is str, condition `if self._conf.get('check_compatible', True)` will be treated as true no matter value you place, as non-empty string will always be evaluated as True.

While with use_ssl it's not _that_ critical as default value is False, so to disable you can simply skip defining the variable, for verify_certs and check_compatible things are way worse.

affects: taskflow → octavia
affects: octavia → taskflow
no longer affects: octavia (Ubuntu)
Revision history for this message
Gregory Thiemonge (gthiemonge) wrote :

Yes, the config values have to be sanitized (the redis backend already converts the values to booleans), I can work on it.

Changed in taskflow:
status: New → In Progress
Revision history for this message
Gregory Thiemonge (gthiemonge) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to taskflow (master)

Reviewed: https://review.opendev.org/c/openstack/taskflow/+/867083
Committed: https://opendev.org/openstack/taskflow/commit/086b3e4335194cbe2bbfcd8c422fa21952124b44
Submitter: "Zuul (22348)"
Branch: master

commit 086b3e4335194cbe2bbfcd8c422fa21952124b44
Author: Gregory Thiemonge <email address hidden>
Date: Fri Dec 9 02:14:36 2022 -0500

    Fix parsing of zookeeper jobboard backend options

    Fix the zookeeper backend options when values are passed as strings,
    a "False" string is now treated as the False boolean.

    Closes-Bug: #1999174
    Change-Id: I048faf06d89ebf980efe0598e647f2ec89f65ada

Changed in taskflow:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to taskflow (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/taskflow/+/880605

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/taskflow 5.2.0

This issue was fixed in the openstack/taskflow 5.2.0 release.

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.