Fixes in more quit monit dependencies

This commit is contained in:
absurdo 2023-09-03 00:47:06 +02:00
parent 65111f67ae
commit e4905c9769
4 changed files with 157 additions and 146 deletions

View file

@ -224,7 +224,7 @@ def pastafari2_add_server_task():
except:
pass
ssh_port='22'
#make ping to server
@ -233,6 +233,10 @@ def pastafari2_add_server_task():
error=1
error_form['#server_host_error']=I18n.lang('pastafari2', 'error_hostname', 'Error: you need enter a valid hostname')
if server_username=='':
error=1
error_form['#server_username_error']=I18n.lang('pastafari2', 'error_username', 'Error: you need enter a valid username for the server')
txt_error=''
try:
@ -252,7 +256,9 @@ def pastafari2_add_server_task():
arr_group=server_group.set_conditions('WHERE id=%s', [group_id]).select_a_row_where()
group_name=arr_group['code_group']
data={'ssh_user': ssh_user, 'pub_key': public_key, 'url_stats': config.domain_url+url_for('monit_app.monit_get_data', api_key=config.monit_api_key), 'hostname': server_host, 'ip': ip, 'group_id': group_id, 'group_name': group_name}
# 'url_stats': config.domain_url+url_for('monit_app.monit_get_data', api_key=config.monit_api_key)
data={'ssh_user': ssh_user, 'pub_key': public_key, 'hostname': server_host, 'ip': ip, 'group_id': group_id, 'group_name': group_name}
with SSHTask(server_host, db, remote_user=server_username, remote_password=server_password, private_key=private_key, remote_path=remote_path, task_id=task_id, data=data, port=ssh_port) as ssh_task:
if not ssh_task.prepare_connection():

View file

@ -16,7 +16,7 @@ import distro
parser = argparse.ArgumentParser(description='A script for install leviathan user')
#parser.add_argument('--url', help='The url where notify updates', required=True)
parser.add_argument('--url_stats', help='The url where pastafaristats notify the stats', required=True)
#parser.add_argument('--url_stats', help='The url where pastafaristats notify the stats', required=True)
parser.add_argument('--user', help='The user for pastafari', required=True)
parser.add_argument('--pub_key', help='The pub key used in pastafari user', required=True)
parser.add_argument('--group', help='Server group', required=False)
@ -38,7 +38,7 @@ print('{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Ins
#check_url.match(args.url) and
if check_url.match(args.url_stats):
#if check_url.match(args.url_stats):
try:
u=pwd.getpwnam(args.user)
@ -172,8 +172,10 @@ if check_url.match(args.url_stats):
print('Error, cannot add utilities for archlinux')
exit(1)
"""
else:
print('Error installing the module, not valid url')
exit(1)
"""

View file

@ -27,7 +27,10 @@ class ServerTask(Task):
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_php.py', ''])
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_unixutils.sh', ''])
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_psutil.sh', ''])
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_pzoo_stats.py', '--user='+self.data['ssh_user']+' --pub_key='+self.data['pub_key']+' --url_stats='+self.data['url_stats']+' --group="'+self.data['group_name']+'" --path='+remote_path])
#' --url_stats='+self.data['url_stats']+
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_pzoo_stats.py', '--user='+self.data['ssh_user']+' --pub_key='+self.data['pub_key']+' --group="'+self.data['group_name']+'" --path='+remote_path])
def post_task(self):

View file

@ -7,8 +7,8 @@
<form method="post" name="add_server" id="add_server_form">
<p>Please fill the form for add the new server to the system.</p>
<p><label>${lang('pastafari2', 'server_host', 'Server host')}* <span class="pastafari2_error error" id="server_host_error"></span></label> <input type="text" name="server_host" value=""></p>
<p><label>${lang('pastafari2', 'server_group', 'Server group')} <span class="pastafari2_error error" id="group_id_error"></span></label> ${group_form.form()|n}</p>
<p><label>${lang('pastafari2', 'server_username', 'Server username')} <span class="pastafari2_error error" id="server_username_error"></span></label> <input type="text" name="server_username" value=""></p>
<p><label>${lang('pastafari2', 'server_group', 'Server group')}* <span class="pastafari2_error error" id="group_id_error"></span></label> ${group_form.form()|n}</p>
<p><label>${lang('pastafari2', 'server_username', 'Server username')}* <span class="pastafari2_error error" id="server_username_error"></span></label> <input type="text" name="server_username" value=""></p>
<p><label>${lang('pastafari2', 'server_password', 'Server password.')} <span class="pastafari2_error error" id="server_password_error"></span></label> <input type="password" name="server_password" value=""></p>
<p><label>${lang('pastafari2', 'repeat_server_password', 'Repeat server password')} <span class="pastafari2_error error" id="repeat_server_password_error"></span></label> <input type="password" name="repeat_server_password" value=""></p>
<p><label>${lang('pastafari2', 'ssh_port', 'SSH port')}* <span class="pastafari2_error error" id="ssh_port_error"></span></label> <input type="number" name="ssh_port" value="22"></p>