fix basic

This commit is contained in:
2024-11-29 00:32:39 +01:00
parent 274e1e2e59
commit 8479c378ee
3 changed files with 26 additions and 19 deletions
+15 -12
View File
@@ -72,7 +72,7 @@ tasks_db = os.path.join(tisbackup_root_dir,"tasks.sqlite")
def read_all_configs(base_dir):
raw_configs = []
list_config = []
config_base_dir = base_dir
#config_base_dir = base_dir
for file in os.listdir(base_dir):
if isfile(join(base_dir,file)):
@@ -112,11 +112,12 @@ def read_all_configs(base_dir):
backup_sections = all_sections
else:
for b in backup_sections:
if not b in all_sections:
if b not in all_sections:
raise Exception('Section %s is not defined in config file' % b)
if not backup_sections:
sections = [backup_item.backup_name for backup_item in backup.backup_list]
# never used..
# if not backup_sections:
# sections = [backup_item.backup_name for backup_item in backup.backup_list]
for backup_item in backup.backup_list:
if backup_item.backup_name in backup_sections:
@@ -190,12 +191,14 @@ def read_config():
backup_sections = all_sections
else:
for b in backup_sections:
if not b in all_sections:
if b not in all_sections:
raise Exception('Section %s is not defined in config file' % b)
result = []
if not backup_sections:
sections = [backup_item.backup_name for backup_item in backup.backup_list]
# not used ...
# if not backup_sections:
# sections = [backup_item.backup_name for backup_item in backup.backup_list]
for backup_item in backup.backup_list:
if backup_item.backup_name in backup_sections:
@@ -261,7 +264,7 @@ def backup_all():
@app.route('/config_number/')
@app.route('/config_number/<int:id>')
def set_config_number(id=None):
if id != None and len(CONFIG) > id:
if id is not None and len(CONFIG) > id:
global config_number
config_number=id
read_config()
@@ -350,7 +353,7 @@ def run_command(cmd, info=""):
result =""
try:
result = check_output(cmd, stderr=subprocess.STDOUT,shell=True)
except CalledProcessError as e:
except CalledProcessError:
raise_error(result,info)
return result
@@ -376,7 +379,7 @@ def export_backup_status():
exports = dbstat.query('select * from stats where TYPE="EXPORT" and backup_start>="%s"' % mindate)
error = ""
finish=not runnings_backups()
if get_task() != None and finish:
if get_task() is not None and finish:
status = get_task().get()
if status != "ok":
error = "Export failing with error: "+status
@@ -386,8 +389,8 @@ def export_backup_status():
def runnings_backups():
task = get_task()
is_runnig = (task != None)
finish = ( is_runnig and task.get() != None)
is_runnig = (task is not None)
finish = ( is_runnig and task.get() is not None)
return is_runnig and not finish