Fix SMART attribute tracking
Since we've moved to delayed SMART attribute updates we need to set initial_attributes after we first check the SMART data instead of at object creation time.
This commit is contained in:
parent
a78a077bdf
commit
8f14fd2442
2 changed files with 5 additions and 3 deletions
|
|
@ -1,7 +1,6 @@
|
|||
"""WizardKit: Disk object and functions"""
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import pathlib
|
||||
import platform
|
||||
|
|
@ -39,7 +38,7 @@ class Disk:
|
|||
children: list[dict] = field(init=False, default_factory=list)
|
||||
description: str = field(init=False)
|
||||
filesystem: str = field(init=False)
|
||||
initial_attributes: dict[Any, dict] = field(init=False)
|
||||
initial_attributes: dict[Any, dict] = field(init=False, default_factory=dict)
|
||||
known_attributes: dict[Any, dict] = field(init=False, default_factory=dict)
|
||||
log_sec: int = field(init=False)
|
||||
model: str = field(init=False)
|
||||
|
|
@ -62,7 +61,6 @@ class Disk:
|
|||
self.update_details()
|
||||
self.set_description()
|
||||
self.known_attributes = get_known_disk_attributes(self.model)
|
||||
self.initial_attributes = copy.deepcopy(self.attributes)
|
||||
if not self.is_4k_aligned():
|
||||
self.add_note('One or more partitions are not 4K aligned', 'YELLOW')
|
||||
|
||||
|
|
|
|||
|
|
@ -506,6 +506,10 @@ def update_smart_details(dev) -> None:
|
|||
if not updated_attributes:
|
||||
dev.add_note('No NVMe or SMART data available', 'YELLOW')
|
||||
|
||||
# Update iniital_attributes if needed
|
||||
if not dev.initial_attributes:
|
||||
dev.initial_attributes = copy.deepcopy(updated_attributes)
|
||||
|
||||
# Done
|
||||
dev.attributes.update(updated_attributes)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue