From 4914a1f0e79890c0371a7c1f722574dc75f3bff3 Mon Sep 17 00:00:00 2001
From: absurdo
Date: Wed, 26 Oct 2022 12:57:06 +0200
Subject: [PATCH] Fixes in scripts for fedora
---
admin/dashboard.py | 6 ++---
app.py | 23 +++++++++++++++++++
libraries/scandir.py | 8 ++++++-
scripts/system/install_git.py | 4 ++++
scripts/system/install_python.sh | 10 ++++++++
scripts/system/updates.py | 6 +++++
tasks/servers/databases/info.cfg | 3 ++-
templates/admin/dash_pastafari.phtml | 34 ++++++++++++++++++----------
8 files changed, 77 insertions(+), 17 deletions(-)
diff --git a/admin/dashboard.py b/admin/dashboard.py
index d66c05d..d9bae9d 100644
--- a/admin/dashboard.py
+++ b/admin/dashboard.py
@@ -514,10 +514,10 @@ def pastafari2_make_task():
task_execute=import_module(task_file)
- task_first=task_execute.ServerTask('', db, remote_user='root', remote_password='', private_key='./ssh/id_rsa', password_key='', remote_path='pastafari2', task_id=0, data={'mysql_password': ''})
-
if config.reloader:
- reload(task_execute)
+ reload(task_execute)
+
+ task_first=task_execute.ServerTask('', db, remote_user='root', remote_password='', private_key='./ssh/id_rsa', password_key='', remote_path='pastafari2', task_id=0, data={})
send_task=request.args.get('send_task', '')
diff --git a/app.py b/app.py
index e69de29..37fd804 100644
--- a/app.py
+++ b/app.py
@@ -0,0 +1,23 @@
+from modules.pastafari2 import pastafari_app
+from modules.pastafari2.models.pastafari2 import ServerDbTask
+from paramecio2.libraries.db.webmodel import WebModel
+try:
+ import ujson as json
+except:
+ import json
+
+server=ServerDbTask()
+
+@pastafari_app.route('/test')
+def test():
+
+ conn=WebModel.connection()
+
+ cursor=conn.query('select * from serverdbtask')
+
+ arr_row=[]
+
+ for row in cursor:
+ arr_row.append(row)
+
+ return json.dumps(arr_row)
diff --git a/libraries/scandir.py b/libraries/scandir.py
index b69059e..e6a8d1b 100644
--- a/libraries/scandir.py
+++ b/libraries/scandir.py
@@ -28,7 +28,13 @@ def scandir(mydir, config_parser, arr_dir=OrderedDict(), father=''):
if 'modules' in config_parser:
for k, v in config_parser['modules'].items():
#arr_dir[father][os.path.basename(mydir)].append([config_parser['modules'][k], s.dumps({'file': mydir+'/'+k+'.py'}), 1])
- arr_dir[father][os.path.basename(mydir)].append([config_parser['modules'][k], mydir+'/'+k+'.py', 1])
+ form=0
+
+ if 'form' in config_parser:
+ if k in config_parser['form']:
+ form=config_parser['form'][k]
+
+ arr_dir[father][os.path.basename(mydir)].append([config_parser['modules'][k], mydir+'/'+k+'.py', 1, form])
elif os.path.isdir(mydir+'/'+one_path):
diff --git a/scripts/system/install_git.py b/scripts/system/install_git.py
index eecbaa8..ece80d9 100644
--- a/scripts/system/install_git.py
+++ b/scripts/system/install_git.py
@@ -22,3 +22,7 @@ elif linux_distro=='debian':
if call('sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y git', shell=True) > 0:
print('Error, cannot install git...')
exit(1)
+elif linux_distro=='rocky' or linux_distro=='fedora':
+ if call("sudo dnf install -y git", shell=True) > 0:
+ print('Error, cannot install git...')
+ exit(1)
diff --git a/scripts/system/install_python.sh b/scripts/system/install_python.sh
index cccd2f1..160579c 100644
--- a/scripts/system/install_python.sh
+++ b/scripts/system/install_python.sh
@@ -19,6 +19,16 @@ elif [[ $DISTRO =~ ^NAME=\"Arch ]]; then
sudo pacman -Syu --noconfirm python python-pip
+elif [[ $DISTRO =~ ^NAME=\"Rocky ]]; then
+
+ sudo dnf install -y python python-pip
+ #Install EPEL
+ dnf config-manager --set-enabled crb
+ sudo dnf install -y \
+ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
+
+ sudo dnf upgrade -y
+
else
echo "Sorry, Linux distro not supported"
diff --git a/scripts/system/updates.py b/scripts/system/updates.py
index 24e4537..6ce905f 100644
--- a/scripts/system/updates.py
+++ b/scripts/system/updates.py
@@ -30,3 +30,9 @@ elif linux_distro=='debian':
if call(update_command, shell=True) > 0:
print('Error, cannot upgrade server...')
exit(1)
+elif linux_distro=='rocky' or linux_distro=='fedora':
+
+ if call("sudo dnf upgrade -y", shell=True) > 0:
+ print('Error, cannot upgrade server...')
+ exit(1)
+
diff --git a/tasks/servers/databases/info.cfg b/tasks/servers/databases/info.cfg
index 7342ecb..1997dc4 100644
--- a/tasks/servers/databases/info.cfg
+++ b/tasks/servers/databases/info.cfg
@@ -5,4 +5,5 @@ description=Install databases daemon in server standalone, for example mysql or
[modules]
mysql/standalone_mysql=Standalone mysql server, MySQL is the most famous database sql server in the web
-
+[form]
+mysql/standalone_mysql=1
diff --git a/templates/admin/dash_pastafari.phtml b/templates/admin/dash_pastafari.phtml
index c74c968..1d8deea 100644
--- a/templates/admin/dash_pastafari.phtml
+++ b/templates/admin/dash_pastafari.phtml
@@ -8,6 +8,11 @@
<%def name="show_tasks(task_folder, separator)">
+<%
+
+form_set=""
+
+%>
% if task_folder in select_task:
@@ -19,6 +24,7 @@
%if script[1][2]==1:
% endif
% endfor
@@ -51,6 +57,7 @@
% endif
+${form_set|n}
%def>