Skip to content

Agent Zero AI framework

root password change fix

frdel9109fcbf60a8
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):