mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Add float and percent types for FieldAttributes
Also sets the max_fail_percentage value to the percent type.
This commit is contained in:
parent
9f95720ef7
commit
af41ba929c
2 changed files with 9 additions and 1 deletions
|
@ -289,8 +289,16 @@ class Base:
|
|||
value = unicode(value)
|
||||
elif attribute.isa == 'int':
|
||||
value = int(value)
|
||||
elif attribute.isa == 'float':
|
||||
value = float(value)
|
||||
elif attribute.isa == 'bool':
|
||||
value = boolean(value)
|
||||
elif attribute.isa == 'percent':
|
||||
# special value, which may be an integer or float
|
||||
# with an optional '%' at the end
|
||||
if isinstance(value, string_types) and '%' in value:
|
||||
value = value.replace('%', '')
|
||||
value = float(value)
|
||||
elif attribute.isa == 'list':
|
||||
if value is None:
|
||||
value = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue