From 9109fcbf60a8c9cc975c9e21306c619d81a2b43c Mon Sep 17 00:00:00 2001 From: frdel <38891707+frdel@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:28:53 +0100 Subject: [PATCH] root password change fix --- prepare.py | 2 +- python/helpers/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/prepare.py b/prepare.py index e0c71f5d1..0c81890c2 100644 --- a/prepare.py +++ b/prepare.py @@ -11,4 +11,4 @@ if not root_pass: root_pass = ''.join(random.choices(string.ascii_letters + string.digits, k=32)) dotenv.save_dotenv_value(dotenv.KEY_ROOT_PASSWORD, root_pass) print("Changing root password...") -subprocess.run(f"echo 'root:{root_pass}' | chpasswd", shell=True, check=True) +settings.set_root_password(root_pass) \ No newline at end of file diff --git a/python/helpers/settings.py b/python/helpers/settings.py index b81bb9ed2..4501ed656 100644 --- a/python/helpers/settings.py +++ b/python/helpers/settings.py @@ -776,7 +776,7 @@ def _dict_to_env(data_dict): def set_root_password(password: str): if not runtime.is_dockerized(): raise Exception("root password can only be set in dockerized environments") - subprocess.run(["echo", "root:" + password, "|", "chpasswd"], shell=True) + subprocess.run(f"echo 'root:{password}' | chpasswd", shell=True, check=True) def get_runtime_config(set: Settings):