mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-12 11:51:10 +00:00
validate memory parameter for ovirt_vm (#46698)
This commit is contained in:
committed by
John R Barker
parent
2a0c356da9
commit
57349c0611
@@ -181,7 +181,7 @@ def convert_to_bytes(param):
|
||||
param = ''.join(param.split())
|
||||
|
||||
# Convert to bytes:
|
||||
if param[-3].lower() in ['k', 'm', 'g', 't', 'p']:
|
||||
if len(param) > 3 and param[-3].lower() in ['k', 'm', 'g', 't', 'p']:
|
||||
return int(param[:-3]) * BYTES_MAP.get(param[-3:].lower(), 1)
|
||||
elif param.isdigit():
|
||||
return int(param) * 2**10
|
||||
|
||||
Reference in New Issue
Block a user