mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipalib.config: Don't autoconvert values to float
When api.env is loaded, strings that "look like" floats got auto-converted to floats. This is wrong, as the conversion to float can lose precision. Case in point: the api_version (e.g. '2.88') should never be interpreted as float. Do not automatically convert to float. We have two numeric options: startup_timeout and wait_for_dns. wait_for_dns is already converted to int when used in the code. Convert startup_timeout to float explicitly when used, so configuration that specified it with a decimal point continues to work. Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
@@ -43,8 +43,7 @@ good_vars = (
|
||||
('trailing_whitespace', u' value ', u'value'),
|
||||
('an_int', 42, 42),
|
||||
('int_repr', ' 42 ', 42),
|
||||
('a_float', 3.14, 3.14),
|
||||
('float_repr', ' 3.14 ', 3.14),
|
||||
('not_a_float', '3.14', u'3.14'),
|
||||
('true', True, True),
|
||||
('true_repr', ' True ', True),
|
||||
('false', False, False),
|
||||
@@ -406,7 +405,7 @@ class test_Env(ClassChecker):
|
||||
assert o.yes is True
|
||||
assert o.no is False
|
||||
assert o.number == 42
|
||||
assert o.floating == 3.14
|
||||
assert o.floating == '3.14'
|
||||
|
||||
def new(self, in_tree=False):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user