Skip to content

Commit

Permalink
OT: Normalize lsblk data for stability in output
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier FAURAX <[email protected]>
  • Loading branch information
ofaurax committed Nov 4, 2024
1 parent 80a9169 commit 7ab4a49
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packethardware/component/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@ def __init__(self, lsblk):
"rota": (
self.lsblk["rota"]
if isinstance(self.lsblk["rota"], str)
else "1" if self.lsblk["rota"] else "0"
else "1"
if self.lsblk["rota"]
else "0"
),
"tool": self.lsblk["tool"],
}
self.lsblk["rota"] = self.data["rota"]
self.lsblk["size"] = self.data["size"]
if "children" in self.lsblk:
for c in self.lsblk["children"]:
c["rota"] = (
c["rota"]
if isinstance(c["rota"], str)
else "1"
if c["rota"]
else "0"
)
c["size"] = str(c["size"])

if self.__is_nvme():
self.data["smart"] = utils.get_nvme_attributes(self.lsblk["name"])
Expand Down

0 comments on commit 7ab4a49

Please sign in to comment.