Fixed filtering if largest disk selection

This commit is contained in:
Anton Hvornum 2021-09-04 16:39:15 +02:00
parent 81e52bc3ff
commit 1814a19d6a
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 1 additions and 1 deletions

View File

@ -87,7 +87,7 @@ def select_largest_device(devices, gigabytes, filter_out=None):
if not len(copy_devices):
return None
return max(copy_devices, key=(lambda device : abs(device.size - gigabytes)))
return max(copy_devices, key=(lambda device : device.size if device.size > gigabytes else 0))
def select_disk_larger_than_or_close_to(devices, gigabytes, filter_out=None):
if not filter_out: