Fix storage config parsing for keys without values
Set keys without values (like 'sparse') to True when parsing storage configuration.
This commit is contained in:
parent
066753ebc7
commit
8207792bf7
@ -65,9 +65,15 @@ def parse_storage_cfg(file_path='/etc/pve/storage.cfg'):
|
|||||||
else:
|
else:
|
||||||
# Parse key-value pairs within the current storage
|
# Parse key-value pairs within the current storage
|
||||||
if current_storage:
|
if current_storage:
|
||||||
key, value = line.split(None, 1)
|
parts = line.split(None, 1)
|
||||||
sanitized_key = sanitize_key(key.strip())
|
key = parts[0].strip()
|
||||||
current_storage[sanitized_key] = value.strip()
|
sanitized_key = sanitize_key(key)
|
||||||
|
if len(parts) > 1:
|
||||||
|
# Regular key-value pair
|
||||||
|
current_storage[sanitized_key] = parts[1].strip()
|
||||||
|
else:
|
||||||
|
# Key with no value, set it to True
|
||||||
|
current_storage[sanitized_key] = True
|
||||||
|
|
||||||
# Append the last storage section to the list if any
|
# Append the last storage section to the list if any
|
||||||
if current_storage:
|
if current_storage:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user