mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Appease the linter
This commit is contained in:
@ -106,11 +106,11 @@ class Users_Controller:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def user_id_exists(user_id):
|
def user_id_exists(user_id):
|
||||||
return users_helper.user_id_exists(user_id)
|
return users_helper.user_id_exists(user_id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_prepare(user_id):
|
def set_prepare(user_id):
|
||||||
return users_helper.set_prepare(user_id)
|
return users_helper.set_prepare(user_id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def stop_prepare(user_id):
|
def stop_prepare(user_id):
|
||||||
return users_helper.stop_prepare(user_id)
|
return users_helper.stop_prepare(user_id)
|
||||||
|
@ -197,17 +197,18 @@ class helper_users:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def set_support_path(user_id, support_path):
|
def set_support_path(user_id, support_path):
|
||||||
Users.update(support_logs = support_path).where(Users.user_id == user_id).execute()
|
Users.update(support_logs = support_path).where(Users.user_id == user_id).execute()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_prepare(user_id):
|
def set_prepare(user_id):
|
||||||
Users.update(preparing = True).where(Users.user_id == user_id).execute()
|
Users.update(preparing = True).where(Users.user_id == user_id).execute()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def stop_prepare(user_id):
|
def stop_prepare(user_id):
|
||||||
Users.update(preparing = False).where(Users.user_id == user_id).execute()
|
Users.update(preparing = False).where(Users.user_id == user_id).execute()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clear_support_status():
|
def clear_support_status():
|
||||||
|
#pylint: disable=singleton-comparison
|
||||||
Users.update(preparing = False).where(Users.preparing == True).execute()
|
Users.update(preparing = False).where(Users.preparing == True).execute()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -423,7 +423,7 @@ class Helpers:
|
|||||||
def get_time_as_string():
|
def get_time_as_string():
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
return now.strftime("%m/%d/%Y, %H:%M:%S")
|
return now.strftime("%m/%d/%Y, %H:%M:%S")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def calc_percent(source_path, dest_path):
|
def calc_percent(source_path, dest_path):
|
||||||
#calculates percentable of zip from drive. Not with compression. For backups and support logs
|
#calculates percentable of zip from drive. Not with compression. For backups and support logs
|
||||||
|
@ -6,7 +6,6 @@ import time
|
|||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from urllib import request
|
|
||||||
|
|
||||||
from app.classes.controllers.crafty_perms_controller import Crafty_Perms_Controller
|
from app.classes.controllers.crafty_perms_controller import Crafty_Perms_Controller
|
||||||
from app.classes.controllers.management_controller import Management_Controller
|
from app.classes.controllers.management_controller import Management_Controller
|
||||||
@ -174,7 +173,7 @@ class Controller:
|
|||||||
self.support_scheduler.add_job(self.log_status, 'interval', seconds=1, id="logs_"+str(exec_user['user_id']), args = [full_temp,
|
self.support_scheduler.add_job(self.log_status, 'interval', seconds=1, id="logs_"+str(exec_user['user_id']), args = [full_temp,
|
||||||
tempZipStorage +'.zip', exec_user])
|
tempZipStorage +'.zip', exec_user])
|
||||||
file_helper.make_archive(tempZipStorage, tempDir)
|
file_helper.make_archive(tempZipStorage, tempDir)
|
||||||
|
|
||||||
if len(websocket_helper.clients) > 0:
|
if len(websocket_helper.clients) > 0:
|
||||||
websocket_helper.broadcast_user(exec_user['user_id'], 'support_status_update', helper.calc_percent(full_temp, tempZipStorage +'.zip'))
|
websocket_helper.broadcast_user(exec_user['user_id'], 'support_status_update', helper.calc_percent(full_temp, tempZipStorage +'.zip'))
|
||||||
|
|
||||||
@ -183,7 +182,7 @@ class Controller:
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.users.set_support_path(exec_user['user_id'], tempZipStorage)
|
self.users.set_support_path(exec_user['user_id'], tempZipStorage)
|
||||||
|
|
||||||
self.users.stop_prepare(exec_user['user_id'])
|
self.users.stop_prepare(exec_user['user_id'])
|
||||||
self.support_scheduler.remove_job('logs_'+str(exec_user["user_id"]))
|
self.support_scheduler.remove_job('logs_'+str(exec_user["user_id"]))
|
||||||
|
|
||||||
@ -207,14 +206,14 @@ class Controller:
|
|||||||
svr.start_crash_detection()
|
svr.start_crash_detection()
|
||||||
else:
|
else:
|
||||||
svr.stop_crash_detection()
|
svr.stop_crash_detection()
|
||||||
|
|
||||||
def log_status(self, source_path, dest_path, exec_user):
|
def log_status(self, source_path, dest_path, exec_user):
|
||||||
results = helper.calc_percent(source_path, dest_path)
|
results = helper.calc_percent(source_path, dest_path)
|
||||||
self.log_stats = results
|
self.log_stats = results
|
||||||
|
|
||||||
if len(websocket_helper.clients) > 0:
|
if len(websocket_helper.clients) > 0:
|
||||||
websocket_helper.broadcast_user(exec_user['user_id'], 'support_status_update', results)
|
websocket_helper.broadcast_user(exec_user['user_id'], 'support_status_update', results)
|
||||||
|
|
||||||
def send_log_status(self):
|
def send_log_status(self):
|
||||||
try:
|
try:
|
||||||
return self.log_stats
|
return self.log_stats
|
||||||
@ -637,7 +636,7 @@ class Controller:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def clear_unexecuted_commands():
|
def clear_unexecuted_commands():
|
||||||
helpers_management.clear_unexecuted_commands()
|
helpers_management.clear_unexecuted_commands()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clear_support_status():
|
def clear_support_status():
|
||||||
helper_users.clear_support_status()
|
helper_users.clear_support_status()
|
||||||
|
@ -605,7 +605,7 @@ class Server:
|
|||||||
|
|
||||||
def a_backup_server(self):
|
def a_backup_server(self):
|
||||||
if len(websocket_helper.clients) > 0:
|
if len(websocket_helper.clients) > 0:
|
||||||
websocket_helper.broadcast_page_params(
|
websocket_helper.broadcast_page_params(
|
||||||
'/panel/server_detail',
|
'/panel/server_detail',
|
||||||
{
|
{
|
||||||
'id': str(self.server_id)
|
'id': str(self.server_id)
|
||||||
@ -705,7 +705,7 @@ class Server:
|
|||||||
)
|
)
|
||||||
self.is_backingup = False
|
self.is_backingup = False
|
||||||
return
|
return
|
||||||
|
|
||||||
def backup_status(self, source_path, dest_path):
|
def backup_status(self, source_path, dest_path):
|
||||||
results = helper.calc_percent(source_path, dest_path)
|
results = helper.calc_percent(source_path, dest_path)
|
||||||
self.backup_stats = results
|
self.backup_stats = results
|
||||||
@ -718,7 +718,7 @@ class Server:
|
|||||||
'backup_status',
|
'backup_status',
|
||||||
results
|
results
|
||||||
)
|
)
|
||||||
|
|
||||||
def send_backup_status(self):
|
def send_backup_status(self):
|
||||||
try:
|
try:
|
||||||
return self.backup_stats
|
return self.backup_stats
|
||||||
|
@ -308,7 +308,7 @@ class AjaxHandler(BaseHandler):
|
|||||||
elif page == "send_order":
|
elif page == "send_order":
|
||||||
self.controller.users.update_server_order(exec_user['user_id'], bleach.clean(self.get_argument('order')))
|
self.controller.users.update_server_order(exec_user['user_id'], bleach.clean(self.get_argument('order')))
|
||||||
return
|
return
|
||||||
|
|
||||||
elif page == "backup_now":
|
elif page == "backup_now":
|
||||||
server_id = self.get_argument('id', None)
|
server_id = self.get_argument('id', None)
|
||||||
if server_id is None:
|
if server_id is None:
|
||||||
|
Reference in New Issue
Block a user