From 6f4c1b56ad7b05e7cb586aec47423bc91a093fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Mon, 10 Mar 2025 12:10:30 +0100 Subject: [PATCH] poprawka w deploy_user --- app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 2c766b5..2e5b3b0 100644 --- a/app.py +++ b/app.py @@ -1242,7 +1242,7 @@ def deploy_user(user_id): # Nowa logika: jeśli `disable_local_default` jest włączone, pomijamy lokalne ustawienia final_content = ("" if h.disable_regex_deploy else regex_lines) + \ - ("" if h.disable_local_default else ensure_local_defaults(chosen_file.content)) + ("" if h.disable_local_default else ensure_local_defaults(chosen_file.content, user_id)) try: if h.type == 'mikrotik': @@ -1252,7 +1252,7 @@ def deploy_user(user_id): db.session.add(DeployLog(details=log_details, user_id=user_id)) elif h.use_daemon and h.type == 'linux': import requests - adjusted_content = ensure_local_defaults(final_content) if not h.disable_local_default else final_content + adjusted_content = ensure_local_defaults(final_content, user_id) if not h.disable_local_default else final_content wrapped_content = wrap_content_with_comments(adjusted_content) url = h.daemon_url.rstrip('/') + '/hosts' headers = {"Authorization": h.daemon_token} @@ -1263,7 +1263,7 @@ def deploy_user(user_id): db.session.add(DeployLog(details=log_details, user_id=user_id)) else: ssh = open_ssh_connection(h) - adjusted_content = ensure_local_defaults(final_content) if not h.disable_local_default else final_content + adjusted_content = ensure_local_defaults(final_content, user_id) if not h.disable_local_default else final_content wrapped_content = wrap_content_with_comments(adjusted_content) with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmpf: tmpf.write(wrapped_content) @@ -1280,6 +1280,7 @@ def deploy_user(user_id): db.session.add(DeployLog(details=f'Failed to update {format_host(h)}: {str(e)} for user {user_id}', user_id=user_id)) db.session.commit() + def deploy_mikrotik(host, hosts_content): ssh = open_ssh_connection(host) stdin, stdout, stderr = ssh.exec_command("/ip dns static export")