From 8e693ae7b6e268688e9a56cba2397cf3895a0393 Mon Sep 17 00:00:00 2001 From: absurdo Date: Mon, 27 Nov 2023 01:38:54 +0100 Subject: [PATCH] Fixes in tasks and updates --- models/tasks.py | 3 ++- scripts/system/updates.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/models/tasks.py b/models/tasks.py index ed1ed99..0259241 100644 --- a/models/tasks.py +++ b/models/tasks.py @@ -336,8 +336,9 @@ def task(task_id): remote_password=arr_task['password'] private_key=arr_task['ssh_key_priv'] password_key=arr_task.get('ssh_key_password', '') + port=arr_task.get('ssh_port', 22) - final_task=ssh_task.ServerTask(server, conn, remote_user=remote_user, remote_password=remote_password, private_key=private_key, password_key=password_key, remote_path='pastafari2', task_id=task_id, data=json.loads(arr_task['data'])) + final_task=ssh_task.ServerTask(server, conn, remote_user=remote_user, remote_password=remote_password, private_key=private_key, password_key=password_key, remote_path='pastafari2', task_id=task_id, data=json.loads(arr_task['data']), port=port) final_task.exec() diff --git a/scripts/system/updates.py b/scripts/system/updates.py index 4f4c68c..0eecbfa 100644 --- a/scripts/system/updates.py +++ b/scripts/system/updates.py @@ -5,6 +5,7 @@ from subprocess import call from time import sleep import distro +import os linux_distro=distro.id() @@ -54,6 +55,14 @@ if call("sudo /usr/local/bin/composer self-update", shell=True) > 0: print('Upgrading Pastafari utils...') -if call("cd ./leviathanutils && git pull && composer update", shell=True) > 0: - print('Error, cannot upgrade Leviathanutils...') - exit(1) +if not os.path.isdir('./leviathanutils'): + + if call("git clone https://git.cuchulu.com/phangoapp/leviathanutils.git && composer install --working-dir=./leviathanutils", shell=True) > 0: + print('Error, cannot install leviathanutils...') + exit(1) + +else: + + if call("cd ./leviathanutils && git pull && composer update", shell=True) > 0: + print('Error, cannot upgrade Leviathanutils...') + exit(1)