diff --git a/ietf/checks.py b/ietf/checks.py index 4036d3720..70ae3daf8 100644 --- a/ietf/checks.py +++ b/ietf/checks.py @@ -67,3 +67,32 @@ def check_doc_email_aliases_exists(app_configs, **kwargs): return errors +@checks.register('directories') +def check_id_submission_directories(app_configs, **kwargs): + errors = [] + for s in ("IDSUBMIT_STAGING_PATH", "IDSUBMIT_REPOSITORY_PATH", "INTERNET_DRAFT_ARCHIVE_DIR"): + p = getattr(settings, s) + if not os.path.exists(p): + errors.append(checks.Critical( + "A directory used by the ID submission tool does not exist at the path given\n" + "in the settings file. The setting is:\n" + " %s = %s" % (s, p), + hint = ("Please either update the local settings to point at the correct directory," + "or if the setting is correct, create the directory."), + id = "datatracker.E0006", + )) + +@checks.register('files') +def check_id_submission_directories(app_configs, **kwargs): + errors = [] + for s in ("IDSUBMIT_IDNITS_BINARY", ): + p = getattr(settings, s) + if not os.path.exists(p): + errors.append(checks.Critical( + "A file used by the ID submission tool does not exist at the path given\n" + "in the settings file. The setting is:\n" + " %s = %s" % (s, p), + hint = ("Please either update the local settings to point at the correct file," + "or if the setting is correct, make sure the file is in place and has the right permissions."), + id = "datatracker.E0007", + )) diff --git a/ietf/submit/forms.py b/ietf/submit/forms.py index abf0716fe..efe05e25d 100644 --- a/ietf/submit/forms.py +++ b/ietf/submit/forms.py @@ -118,12 +118,6 @@ class SubmissionUploadForm(forms.Form): if self.shutdown and not has_role(self.request.user, "Secretariat"): raise forms.ValidationError('The submission tool is currently shut down') - # sanity check that paths exist (for development servers) - for s in ("IDSUBMIT_STAGING_PATH", "IDSUBMIT_IDNITS_BINARY", - "IDSUBMIT_REPOSITORY_PATH", "INTERNET_DRAFT_ARCHIVE_DIR"): - if not os.path.exists(getattr(settings, s)): - raise forms.ValidationError('%s defined in settings.py does not exist' % s) - for ext in ['txt', 'pdf', 'xml', 'ps']: f = self.cleaned_data.get(ext, None) if not f: