Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-03-08 15:10:58 +0100
committerAnton Hvornum <anton.feeds@gmail.com>2021-03-08 15:10:58 +0100
commitc5694393c6a9d53cbc7a2886e733b354d5055772 (patch)
tree5e94d5e6386458b10020a6317355771e76e43a2c /archinstall/lib
parentffbb952eb35b25c7538dca3426854292b67e2cc3 (diff)
Fixed the JSON_Encoder. The issue was that dictionaries are mutable, and dumping dictionaries and replacing keys also replaces the original value.
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/general.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 97ad1565..e87e4102 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -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__'):