Created
March 29, 2018 16:19
-
-
Save tasleson/15d88114fd613125b5905d0790a5508c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_empty(device_path): | |
device_info = udev_db.get_device_info(device_path) | |
# This is probably too simplistic ... | |
# Check to see if a partition table exists | |
if 'ID_PART_TABLE_TYPE' in device_info: | |
return False | |
# Check if a usage is given, domain includes | |
# 'filesystem', 'raid', 'other' | |
if 'ID_FS_USAGE' in device_info: | |
return False | |
return True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First conditional should be:
if 'ID_PART_TABLE_TYPE' in device_info and 'ID_PART_ENTRY_DISK' not in device_info:
The rest looks good.