remove schedule import from servers

This commit is contained in:
Andrew 2022-01-14 12:57:23 -05:00
parent ef4a31d1e8
commit 210b831a47
2 changed files with 5 additions and 4 deletions

View File

@ -31,7 +31,6 @@ logger = logging.getLogger(__name__)
try: try:
import psutil import psutil
#import pexpect #import pexpect
import schedule
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
logger.critical("Import Error: Unable to load {} module".format(e.name), exc_info=True) logger.critical("Import Error: Unable to load {} module".format(e.name), exc_info=True)

View File

@ -11,6 +11,7 @@ import os
import shutil import shutil
import tempfile import tempfile
import threading import threading
from cron_validator import CronValidator
from tornado import locale from tornado import locale
from tornado import iostream from tornado import iostream
@ -991,9 +992,10 @@ class PanelHandler(BaseHandler):
else: else:
interval_type = '' interval_type = ''
cron_string = bleach.clean(self.get_argument('cron', '')) cron_string = bleach.clean(self.get_argument('cron', ''))
cron_split = cron_string.split(' ') try:
if len(cron_split) != 5: CronValidator.parse(cron_string)
self.redirect("/panel/error?error=INVALID FORMAT: Invalid Cron Format. Cron must have a space between each character and only have a max of 5 characters * * * * *") except Exception as e:
self.redirect("/panel/error?error=INVALID FORMAT: Invalid Cron Format. {}".format(e))
return return
action = bleach.clean(self.get_argument('action', None)) action = bleach.clean(self.get_argument('action', None))
if action == "command": if action == "command":