#/usr/bin/env python3 from modules.pastafari2.libraries.task import Task #from modules.pastafari.models.tasks import TaskModel from paramecio2.libraries.db import coreforms from paramecio2.libraries.formsutils import show_form from collections import OrderedDict class ServerTask(Task): def __init__(self, server, conn, remote_user='root', remote_password='', private_key='./ssh/id_rsa', password_key='', remote_path='pastafari2', task_id=0, data={}): super().__init__(server, conn, remote_user, remote_password, private_key, password_key, remote_path, task_id, data) self.name_task='MariaDB installation' self.description_task='Installation of a standalone mysql server' self.codename_task='standalone_mysql' self.files=[['modules/pastafari2/scripts/servers/databases/mariadb/install_mariadb.py', 0o700]] # Format first array element is command with the interpreter, the task is agnostic, the files in os directory. The commands are setted with 750 permission. # First element is the file, next elements are the arguments #self.commands_to_execute=[['modules/pastafari/scripts/servers/databases/mysql/install_mariadb.py', '']]; #THe files to delete self.delete_files=[] self.delete_directories=['modules/pastafari2/scripts/servers/databases/mariadb'] #self.task=Task(conn) self.one_time=True self.version='1.0' self.arr_form=OrderedDict() self.arr_form['mysql_password']=coreforms.PasswordForm('mysql_password', '') self.arr_form['mysql_password'].required=True self.arr_form['mysql_password'].label='The MySQL password used by all servers' self.arr_form['repeat_mysql_password']=coreforms.PasswordForm('repeat_mysql_password', '') self.arr_form['repeat_mysql_password'].required=True self.arr_form['repeat_mysql_password'].label='Repeat MySQL password' #self.commands_to_execute=[['modules/pastafari/scripts/servers/databases/mariadb/install_mariadb.py', '--password=%s' % self.data['mysql_password']]] def pre_task(self): self.commands_to_execute=[['modules/pastafari2/scripts/servers/databases/mariadb/install_mariadb.py', '--password=%s' % self.data['mysql_password']]] return True def form(self, t, yes_error=False, pass_values=False, values={}): #Here load the form for it task return '