From 7587e1beaf75a54daa2c06d8fb22c710b490b06b Mon Sep 17 00:00:00 2001 From: gyptazy Date: Wed, 6 Nov 2024 08:43:00 +0100 Subject: [PATCH] fix: Fix that a scheduler time definition of 1 (int) gets wrongly interpreted as a bool. Fixes: #115 --- .../115_fix_daemon_scheduler_bool_time_fix.yml | 2 ++ proxlb | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changelogs/1.0.6/115_fix_daemon_scheduler_bool_time_fix.yml diff --git a/.changelogs/1.0.6/115_fix_daemon_scheduler_bool_time_fix.yml b/.changelogs/1.0.6/115_fix_daemon_scheduler_bool_time_fix.yml new file mode 100644 index 0000000..d1abed7 --- /dev/null +++ b/.changelogs/1.0.6/115_fix_daemon_scheduler_bool_time_fix.yml @@ -0,0 +1,2 @@ +fixed: + - Fix that a scheduler time definition of 1 (int) gets wrongly interpreted as a bool (by @gyptazy). [#115] diff --git a/proxlb b/proxlb index 79fa6d6..609046b 100755 --- a/proxlb +++ b/proxlb @@ -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