fix: storage.cfg parser was stripping indentation before checking line.startswith(' ') — property lines never parsed
This commit is contained in:
parent
dc023c8572
commit
9bab8e95a1
1 changed files with 6 additions and 6 deletions
|
|
@ -104,19 +104,19 @@ def storage_pools():
|
||||||
lines = cfg.read_text()
|
lines = cfg.read_text()
|
||||||
current = {}
|
current = {}
|
||||||
for line in lines.split("\n"):
|
for line in lines.split("\n"):
|
||||||
line = line.strip()
|
stripped = line.strip()
|
||||||
if not line or line.startswith("#"):
|
if not stripped or stripped.startswith("#"):
|
||||||
continue
|
continue
|
||||||
if ":" in line and not line.startswith(" "):
|
if ":" in stripped and not line.startswith(" "):
|
||||||
if current and current.get("name"):
|
if current and current.get("name"):
|
||||||
pools.append(current)
|
pools.append(current)
|
||||||
parts = line.split(":", 1)
|
parts = stripped.split(":", 1)
|
||||||
stype = parts[0].strip()
|
stype = parts[0].strip()
|
||||||
sname = parts[1].strip() if len(parts) > 1 else ""
|
sname = parts[1].strip() if len(parts) > 1 else ""
|
||||||
current = {"name": sname, "type": stype}
|
current = {"name": sname, "type": stype}
|
||||||
elif line.startswith(" ") and current:
|
elif line.startswith(" ") and current:
|
||||||
if " " in line:
|
if " " in stripped:
|
||||||
key, val = line.strip().split(" ", 1)
|
key, val = stripped.split(" ", 1)
|
||||||
current[key] = val
|
current[key] = val
|
||||||
if current and current.get("name"):
|
if current and current.get("name"):
|
||||||
pools.append(current)
|
pools.append(current)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue