mirror of
https://github.com/nchevsky/systemrescue-zfs.git
synced 2026-02-06 07:45:26 +01:00
caste the config with the same type as the defaultval
This commit is contained in:
parent
ae8a15c2b2
commit
ca084e664f
|
|
@ -124,9 +124,13 @@ def search_autoruns(dirname, suffixes, copyfilefct):
|
|||
found+=1
|
||||
return found
|
||||
|
||||
def read_cfg_value(name, defaultval=None):
|
||||
def read_cfg_value(name, defaultval):
|
||||
if name in config:
|
||||
val = config[name]
|
||||
try:
|
||||
val = type(defaultval)(config[name])
|
||||
except (TypeError, ValueError) as e:
|
||||
writemsg(f"{name} with {config[name]} is not the same type as defaultval: {e}")
|
||||
val = defaultval
|
||||
else:
|
||||
val = defaultval
|
||||
print(f"config['{name}']={val}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue