Fixes in mariadb module

This commit is contained in:
Antonio de la Rosa 2024-02-15 22:31:08 +01:00
parent ff81d2aa8d
commit 1a20fdd944
3 changed files with 8 additions and 5 deletions

View file

@ -1,4 +1,4 @@
#!/opt/pythonenv/bin/python3 -u #!/usr/bin/python3 -u
# A script for install pzoo user # A script for install pzoo user
@ -13,7 +13,7 @@ from pathlib import Path
from time import sleep from time import sleep
import distro import distro
parser = argparse.ArgumentParser(description='A script for install leviathan user') parser = argparse.ArgumentParser(description='A script for install pastafaristats stats')
#parser.add_argument('--url', help='The url where notify updates', required=True) #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)
@ -40,7 +40,7 @@ if check_url.match(args.url_stats):
# Create scripts pzoo # Create scripts pzoo
if call("sudo /opt/pythonenv/bin/pip3 install --upgrade git+https://bitbucket.org/paramecio/pastafaristats", shell=True)>0: if call("sudo /home/{}/pythonenv/bin/pip3 install --upgrade git+https://bitbucket.org/paramecio/pastafaristats".format(args.user), shell=True)>0:
print('Error, cannot install pastafari stats') print('Error, cannot install pastafari stats')
exit(1) exit(1)
else: else:
@ -71,7 +71,7 @@ if check_url.match(args.url_stats):
f.write('Type=simple\n') f.write('Type=simple\n')
f.write('User=pzoo\n'.replace('pzoo', args.user)) f.write('User=pzoo\n'.replace('pzoo', args.user))
f.write('Group=pzoo\n'.replace('pzoo', args.user)) f.write('Group=pzoo\n'.replace('pzoo', args.user))
f.write('ExecStart=/opt/pythonenv/bin/pastafaristats\n') f.write('ExecStart=/home/{}/pythonenv/bin/pastafaristats\n'.format(args.user))
f.write('Restart=always\n') f.write('Restart=always\n')
f.write('Environment=PYTHONUNBUFFERED=1\n\n') f.write('Environment=PYTHONUNBUFFERED=1\n\n')

View file

@ -6,6 +6,7 @@ from paramecio2.libraries.db import coreforms
from paramecio2.libraries.db.extrafields.ipfield import IpField from paramecio2.libraries.db.extrafields.ipfield import IpField
from paramecio2.libraries.formsutils import show_form from paramecio2.libraries.formsutils import show_form
from collections import OrderedDict from collections import OrderedDict
from paramecio2.libraries.urls import make_media_url, make_url
from modules.pastafari2.models.pastafari2 import ServerDbTask from modules.pastafari2.models.pastafari2 import ServerDbTask
try: try:
from modules.mariadb.models.mariadb import DbServerMariaDb from modules.mariadb.models.mariadb import DbServerMariaDb
@ -45,6 +46,8 @@ class ServerTask(Task):
self.version='1.0' self.version='1.0'
self.links='<p><a href="{}">{}</a></p>'.format(make_url('mariadbservers/servers'), _('MariaDB servers list'))
self.arr_form=OrderedDict() self.arr_form=OrderedDict()
self.arr_form['mysql_password']=coreforms.PasswordForm('mysql_password', '') self.arr_form['mysql_password']=coreforms.PasswordForm('mysql_password', '')

View file

@ -41,7 +41,7 @@ class ServerTask(Task):
arr_group=server_group.set_conditions('WHERE id=%s', [self.data['group_id']]).select_a_row_where() arr_group=server_group.set_conditions('WHERE id=%s', [self.data['group_id']]).select_a_row_where()
self.data['group_name']=arr_group['code_group'] self.data['group_name']=arr_group['code_group']
self.commands_to_execute.append(['modules/pastafari2/scripts/system/install_monit_stats.py', '--user='+ssh_user+' --url_stats='+url_stats+' --group="'+self.data['group_name']+'"', 'sudo']) self.commands_to_execute.append(['/home/'+ssh_user+'/pythonenv/bin/python3 modules/pastafari2/scripts/system/install_monit_stats.py', '--user='+ssh_user+' --url_stats='+url_stats+' --group="'+self.data['group_name']+'"', 'sudo'])
return True return True