mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-04 15:29:10 -07:00
parent
d5ad3093d6
commit
51b595992b
11 changed files with 75 additions and 78 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue