added code to check paths exist on startup
This commit is contained in:
@@ -1103,8 +1103,39 @@ def RemoveDups(job):
|
||||
AddLogForJob(job, "adding <a href='/job/{}'>job id={} {}</a> to confirm there are no more duplicates".format( next_job.id, next_job.id, next_job.name ) )
|
||||
return
|
||||
|
||||
def ValidateSettingsPaths():
|
||||
settings = session.query(Settings).first()
|
||||
rbp_exists=0
|
||||
paths = settings.recycle_bin_path.split("#")
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
rbp_exists=1
|
||||
break
|
||||
if not rbp_exists:
|
||||
print("ERROR: The bin path in settings does not exist - Please fix now");
|
||||
sp_exists=0
|
||||
paths = settings.storage_path.split("#")
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
sp_exists=1
|
||||
break
|
||||
if not sp_exists:
|
||||
print("ERROR: None of the storge paths in the settings does not exist - Please fix now");
|
||||
ip_exists=0
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
ip_exists=1
|
||||
break
|
||||
if not ip_exists:
|
||||
print("ERROR: None of the import paths in the settings exist - Please fix now");
|
||||
paths = settings.import_path.split("#")
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("INFO: PA job manager starting - listening on {}:{}".format( PA_JOB_MANAGER_HOST, PA_JOB_MANAGER_PORT) )
|
||||
|
||||
ValidateSettingsPaths()
|
||||
|
||||
# now=datetime.now(pytz.utc)
|
||||
# job=Job(start_time=now, last_update=now, name="scannow", state="New", wait_for=None, pa_job_state="New", current_file_num=0, num_files=0 )
|
||||
|
||||
Reference in New Issue
Block a user