Browse Source

Support boolean values in get_default

We already support getting int values via get_default. Supporting
boolean values can be useful too.

Change-Id: I5079217e11afa8be516a79ad99860e514c40c727
changes/58/637158/1
Tobias Henkel 2 years ago
parent
commit
05bde42af3
No known key found for this signature in database GPG Key ID: 3750DEC158E5FA2
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      zuul/lib/config.py

+ 3
- 1
zuul/lib/config.py View File

@ -17,7 +17,9 @@ def get_default(config, section, option, default=None, expand_user=False):
if config.has_option(section, option):
# Need to be ensured that we get suitable
# type from config file by default value
if isinstance(default, int):
if isinstance(default, bool):
value = config.getboolean(section, option)
elif isinstance(default, int):
value = config.getint(section, option)
else:
value = config.get(section, option)


Loading…
Cancel
Save