Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix that a scheduler time definition of 1 (int) gets wrongly interpreted as a bool. #117

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changelogs/1.0.6/115_fix_daemon_scheduler_bool_time_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixed:
- Fix that a scheduler time definition of 1 (int) gets wrongly interpreted as a bool (by @gyptazy). [#115]
13 changes: 8 additions & 5 deletions proxlb
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,21 @@ def initialize_config_options(config_path):

def __update_config_parser_bools(proxlb_config):
""" Update bools in config from configparser to real bools """
info_prefix = 'Info: [config-bool-converter]:'
info_prefix = 'Info: [config-bool-converter]:'
ignore_sections = ['schedule']

# Normalize and update config parser values to bools.
for section, option_value in proxlb_config.items():

if option_value in [1, '1', 'yes', 'Yes', 'true', 'True', 'enable']:
logging.info(f'{info_prefix} Converting {section} to bool: True.')
proxlb_config[section] = True
if section not in ignore_sections:
logging.info(f'{info_prefix} Converting {section} to bool: True.')
proxlb_config[section] = True

if option_value in [0, '0', 'no', 'No', 'false', 'False', 'disable']:
logging.info(f'{info_prefix} Converting {section} to bool: False.')
proxlb_config[section] = False
if section not in ignore_sections:
logging.info(f'{info_prefix} Converting {section} to bool: False.')
proxlb_config[section] = False

return proxlb_config

Expand Down
Loading