Fixed Disk() description and SMART data

This commit is contained in:
2Shirt 2019-10-23 16:28:55 -07:00
parent 52d61226a0
commit 07120b7dc4
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -153,6 +153,12 @@ class Disk():
if not isinstance(self.lsblk[attr], int):
self.lsblk[attr] = int(self.lsblk[attr])
# Set description
self.description = '{size_str} ({tran}) {model} {serial}'.format(
size_str = bytes_to_string(self.lsblk['size'], use_binary=False),
**self.lsblk,
)
def get_labels(self):
"""Build list of labels for this disk, returns list."""
labels = []
@ -179,7 +185,7 @@ class Disk():
'--json',
self.path,
]
self.smartctl = get_json_from_command(cmd)
self.smartctl = get_json_from_command(cmd, check=False)
# Check for attributes
if KEY_NVME in self.smartctl: