Fixes i ndashboard

This commit is contained in:
Antonio de la Rosa 2025-10-18 01:13:52 +02:00
parent a26aa723b3
commit 3d222a6a29
2 changed files with 19 additions and 18 deletions

View file

@ -49,10 +49,10 @@ t.env.directories=admin_t.env.directories
t.env.directories.insert(1, os.path.dirname(__file__).replace('/admin', '')+'/templates/admin')
system_path='./ssh/'
#system_path=config_task.ssh_directory+'/'
if hasattr(config, 'pastafari_system_path'):
system_path=config.pastafari_system_path
#if hasattr(config, 'pastafari_system_path'):
# system_path=config.pastafari_system_path
base_path='modules/pastafari2/tasks'
@ -103,7 +103,7 @@ def pastafari2_dashboard():
if config.reloader:
reload(ptask)
task_first=ptask.ServerTask('', db, remote_user='root', remote_password='', private_key=system_path+'id_rsa', password_key='', remote_path='pastafari2', task_id=0, data=dict(request.args))
task_first=ptask.ServerTask('', db, remote_user='root', remote_password='', private_key=config_task.ssh_private_key, password_key='', remote_path='pastafari2', task_id=0, data=dict(request.args))
links=task_first.links
@ -131,10 +131,10 @@ def pastafari2_settings():
txt_generate_key_button='Regenerate SSH keys'
regenerate=True
if not os.path.isdir(system_path):
if not os.path.isdir(config_task.ssh_directory):
try:
Path(system_path).mkdir(mode=511)
Path(config_task.ssh_directory).mkdir(mode=511)
except:
@ -142,7 +142,7 @@ def pastafari2_settings():
#Get ssh key
if not os.path.isfile(system_path+'id_rsa'):
if not os.path.isfile(config_task.ssh_private_key):
txt_generate_key='<p>You need generate a global private ssh key, because doesn\'t exists</p>'
txt_generate_key_button='Generate SSH keys'
@ -158,7 +158,7 @@ def pastafari2_edit_global_ssh_keys():
error=1
if not os.path.isfile(system_path+'id_rsa'):
if not os.path.isfile(config_task.ssh_private_key):
# -C "your_email@example.com" -f $HOME/.ssh/id_rsa
@ -168,9 +168,9 @@ def pastafari2_edit_global_ssh_keys():
if ssh_key_type in arr_type:
file_ssh_path='-f {}id_rsa -q -N ""'.format(system_path)
file_ssh_path='-f {}id_rsa -q -N ""'.format(config_task.ssh_directory)
if not os.path.isfile(system_path+'id_rsa'):
if not os.path.isfile(config_task.ssh_private_key):
if call(arr_type[ssh_key_type]+' '+file_ssh_path, shell=True) > 0:
@ -214,8 +214,8 @@ def pastafari2_add_server_task():
server_password=request.form.get('server_password', '')
repeat_server_password=request.form.get('repeat_server_password', '')
group_id=request.form.get('group_id', '')
private_key=system_path+'id_rsa'
public_key=system_path+'id_rsa.pub'
private_key=config_task.ssh_private_key
public_key=config_task.ssh_public_key
remote_path='pastafari2'
task_id=0
ip=''
@ -478,7 +478,7 @@ def pastafari2_update_task():
user=config_task.remote_user
ssh_key_priv=system_path+'id_rsa'
ssh_key_priv=config_task.ssh_private_key
if not task.run_task(server_host, path_task, 'Update server', 'update_server', 'Task for update servers', user=user, password='', where_sql_server=where_sql, ssh_key_priv=ssh_key_priv, url='', data=data, send_task=True):
@ -511,7 +511,7 @@ def pastafari2_make_task():
if config.reloader:
reload(task_execute)
task_first=task_execute.ServerTask('', db, remote_user='root', remote_password='', private_key=system_path+'id_rsa', password_key='', remote_path='pastafari2', task_id=0, data=dict(request.args))
task_first=task_execute.ServerTask('', db, remote_user='root', remote_password='', private_key=config_task.ssh_private_key, password_key='', remote_path='pastafari2', task_id=0, data=dict(request.args))
send_task=request.args.get('send_task', '')
@ -582,7 +582,7 @@ def pastafari2_make_task():
user=config_task.remote_user
ssh_key_priv=system_path+'id_rsa'
ssh_key_priv=config_task.ssh_private_key
if not task.run_task(server_host, path_task, task_first.name_task, task_first.codename_task, task_first.description_task, user=user, password='', where_sql_server=where_sql, ssh_key_priv=ssh_key_priv, url=task_first.url_return, data=data, send_task=True):
@ -742,8 +742,8 @@ def pre_update_server(admin):
ssh_user=config_task.remote_user
ssh_port=request.form.get('ssh_port', 22)
server_host=request.form.get('ip', '')
private_key=system_path+'id_rsa'
public_key=system_path+'id_rsa.pub'
private_key=config_task.ssh_private_key
public_key=config_task.ssh_public_key
remote_path='pastafari2'
data={}
task_id=0