fix: add some debbug

This commit is contained in:
dettlaff 2024-11-22 23:10:29 +04:00
parent 833edab852
commit fa17f18e0e

View file

@ -65,7 +65,6 @@ class KanidmAdminToken:
"json", "json",
], ],
text=True, text=True,
stderr=subprocess.DEVNULL,
) )
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(e) print(e)
@ -86,14 +85,23 @@ class KanidmAdminToken:
"json", "json",
], ],
text=True, text=True,
stderr=subprocess.DEVNULL,
) )
os.system(f"echo '{output}' >> /root/output.txt)")
output = output.decode("utf-8")
os.system(f"echo '{output}' >> /root/outputde.txt)")
match = re.search(r'"password":"([^"]+)"', output) match = re.search(r'"password":"([^"]+)"', output)
new_kanidm_admin_password = match.group( new_kanidm_admin_password = match.group(
1 1
) # we have many not json strings in output ) # we have many not json strings in output
os.system(
f"echo '{new_kanidm_admin_password}' >> /root/new_kanidm_admin_password.txt)"
)
redis.set("kanidm:password", new_kanidm_admin_password) redis.set("kanidm:password", new_kanidm_admin_password)
return new_kanidm_admin_password return new_kanidm_admin_password