parted: Cast boundary to string when checking unit type

It could be that just a number (integer) is passed to as either
start or end to the module which is then already a int.

The endswith() method will then fail because that is a String function.

By casting it to a String while checking we make sure that the function
works.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
This commit is contained in:
Wido den Hollander 2017-10-17 17:03:47 +02:00
parent b651ff0534
commit 4c02f6ccd8
No known key found for this signature in database
GPG Key ID: 019B582DDB3ECA42

View File

@ -93,7 +93,7 @@ def _validate_partition_boundary(boundary):
'''
try:
for unit in VALID_UNITS:
if boundary.endswith(unit):
if str(boundary).endswith(unit):
return
int(boundary)
except Exception: