feat: hand HPE MSA exports from the disk CSV import to the MSA wizard

An MSA disk export pasted or uploaded in Disks > Import failed with
"Unknown header: Location". The import now recognises the MSA columns and
opens the shelf assignment step of the MSA import instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-21 14:13:10 +02:00
1 parent 7754e823cb
commit 2a6abc396d
4 files changed
+32 -3

No files matched your search

+8 -2
View File
@@ -54,7 +54,7 @@ def _natural(value):
return (0, int(value), "") if str(value).isdigit() else (1, 0, str(value))
def _decode(data):
def decode(data):
if isinstance(data, bytes):
for encoding in ("utf-8-sig", "cp1252"):
try:
@@ -71,6 +71,12 @@ def _int(value):
return None
def looks_like_export(text):
"""True if the first line carries the MSA columns "Location" and "Serial Number"."""
first_line = (text or "").lstrip("\ufeff").split("\n", 1)[0].casefold()
return COLUMN_LOCATION in first_line and "serial number" in first_line
def map_type(value, rpm=""):
"""Translate the MSA "Type" column, e.g. "SSD SAS", "SAS", "SAS MDL" or "SATA", into (type, interface)."""
text = (value or "").upper()
@@ -94,7 +100,7 @@ def map_status(usage, health):
def parse_export(data):
"""Parse the CSV export into an MSAExport; rows that cannot be read end up in errors."""
text = _decode(data).strip()
text = decode(data).strip()
export = MSAExport()
if not text:
export.errors.append("Die Datei ist leer.")