Fixed the JSON_Encoder. The issue was that dictionaries are mutable, and dumping dictionaries and replacing keys also replaces the original value.
This commit is contained in:
parent
ffbb952eb3
commit
c5694393c6
|
|
@ -37,6 +37,7 @@ class JSON_Encoder:
|
|||
## We'll need to iterate not just the value that default() usually gets passed
|
||||
## But also iterate manually over each key: value pair in order to trap the keys.
|
||||
|
||||
copy = {}
|
||||
for key, val in list(obj.items()):
|
||||
if isinstance(val, dict):
|
||||
val = json.loads(json.dumps(val, cls=JSON)) # This, is a EXTREMELY ugly hack..
|
||||
|
|
@ -44,12 +45,12 @@ class JSON_Encoder:
|
|||
# trigger a encoding of sub-dictionaries.
|
||||
else:
|
||||
val = JSON_Encoder._encode(val)
|
||||
del(obj[key])
|
||||
|
||||
if type(key) == str and key[0] == '!':
|
||||
obj[JSON_Encoder._encode(key)] = '******'
|
||||
copy[JSON_Encoder._encode(key)] = '******'
|
||||
else:
|
||||
obj[JSON_Encoder._encode(key)] = val
|
||||
return obj
|
||||
copy[JSON_Encoder._encode(key)] = val
|
||||
return copy
|
||||
elif hasattr(obj, 'json'):
|
||||
return obj.json()
|
||||
elif hasattr(obj, '__dump__'):
|
||||
|
|
|
|||
|
|
@ -228,15 +228,12 @@ except archinstall.RequirementError as e:
|
|||
if not archinstall.arguments.get('nic', None):
|
||||
archinstall.arguments['nic'] = archinstall.ask_to_configure_network()
|
||||
|
||||
print(type(archinstall.arguments['harddrive']), archinstall.arguments['harddrive'])
|
||||
|
||||
print()
|
||||
print('This is your chosen configuration:')
|
||||
archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug)
|
||||
archinstall.log(json.dumps(archinstall.arguments, indent=4, sort_keys=True, cls=archinstall.JSON), level=archinstall.LOG_LEVELS.Info)
|
||||
print()
|
||||
|
||||
print(type(archinstall.arguments['harddrive']), archinstall.arguments['harddrive'])
|
||||
input('Press Enter to continue.')
|
||||
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue