poprawka w deploy_user
This commit is contained in:
parent
9cffcb0ca6
commit
6f4c1b56ad
7
app.py
7
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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user