root password change fix

frdel committed Dec 3, 2024 at 14:28 UTC 9109fcbf60a8c9cc975c9e21306c619d81a2b43c
2 files changed +2 -2
prepare.py
+1 -1
@@ -11,4 +11,4 @@ if not root_pass:
11 root_pass = ''.join(random.choices(string.ascii_letters + string.digits, k=32))
12 dotenv.save_dotenv_value(dotenv.KEY_ROOT_PASSWORD, root_pass)
13 print("Changing root password...")
14 -subprocess.run(f"echo 'root:{root_pass}' | chpasswd", shell=True, check=True)
14 +settings.set_root_password(root_pass)
\ No newline at end of file
python/helpers/settings.py
+1 -1
@@ -776,7 +776,7 @@ def _dict_to_env(data_dict):
776 def set_root_password(password: str):
777 if not runtime.is_dockerized():
778 raise Exception("root password can only be set in dockerized environments")
779 - subprocess.run(["echo", "root:" + password, "|", "chpasswd"], shell=True)
779 + subprocess.run(f"echo 'root:{password}' | chpasswd", shell=True, check=True)
780
781
782 def get_runtime_config(set: Settings):