Fixed Disk() description and SMART data
This commit is contained in:
parent
52d61226a0
commit
07120b7dc4
1 changed files with 7 additions and 1 deletions
|
|
@ -153,6 +153,12 @@ class Disk():
|
||||||
if not isinstance(self.lsblk[attr], int):
|
if not isinstance(self.lsblk[attr], int):
|
||||||
self.lsblk[attr] = int(self.lsblk[attr])
|
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):
|
def get_labels(self):
|
||||||
"""Build list of labels for this disk, returns list."""
|
"""Build list of labels for this disk, returns list."""
|
||||||
labels = []
|
labels = []
|
||||||
|
|
@ -179,7 +185,7 @@ class Disk():
|
||||||
'--json',
|
'--json',
|
||||||
self.path,
|
self.path,
|
||||||
]
|
]
|
||||||
self.smartctl = get_json_from_command(cmd)
|
self.smartctl = get_json_from_command(cmd, check=False)
|
||||||
|
|
||||||
# Check for attributes
|
# Check for attributes
|
||||||
if KEY_NVME in self.smartctl:
|
if KEY_NVME in self.smartctl:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue