mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
committed by
John R Barker
parent
d5ad3093d6
commit
51b595992b
@@ -28,8 +28,7 @@ def pct_to_int(value, num_items, min_value=1):
|
||||
otherwise converts the given value to an integer.
|
||||
'''
|
||||
if isinstance(value, string_types) and value.endswith('%'):
|
||||
value_pct = int(value.replace("%",""))
|
||||
return int((value_pct/100.0) * num_items) or min_value
|
||||
value_pct = int(value.replace("%", ""))
|
||||
return int((value_pct / 100.0) * num_items) or min_value
|
||||
else:
|
||||
return int(value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user