Added 2 new file existence checks to the check framework, since we're now reading email aliases for groups and documents from files. Added a call out to run_checks() in the test-crawler, so we don't see failures due to missing files.
- Legacy-Id: 10204
This commit is contained in:
parent
bce91b4680
commit
f41553f3d1
|
@ -42,6 +42,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", args.settings or "ietf.settings_
|
|||
|
||||
import django
|
||||
import django.test
|
||||
import django.core.checks
|
||||
|
||||
django.setup()
|
||||
|
||||
|
@ -269,6 +270,14 @@ if __name__ == "__main__":
|
|||
(args.user, response.status_code))
|
||||
sys.exit(1)
|
||||
|
||||
# Run django system checks and checks from ietf.checks:
|
||||
error_list = django.core.checks.run_checks()
|
||||
if error_list:
|
||||
print("")
|
||||
for entry in error_list:
|
||||
print(entry)
|
||||
sys.exit(1)
|
||||
|
||||
while urls:
|
||||
if args.random:
|
||||
# popitem() is documented to be random, but really isn't
|
||||
|
|
|
@ -20,3 +20,50 @@ def check_cdn_directory_exists(app_configs, **kwargs):
|
|||
id='datatracker.E001',
|
||||
))
|
||||
return errors
|
||||
|
||||
@checks.register('files')
|
||||
def check_group_email_aliases_exists(app_configs, **kwargs):
|
||||
from ietf.group.info import get_group_email_aliases
|
||||
errors = []
|
||||
try:
|
||||
aliases = get_group_email_aliases(None, None)
|
||||
if not aliases:
|
||||
errors.append(checks.Error(
|
||||
"Found no aliases in the group email aliases file",
|
||||
hint="Please run ietf/bin/generate-wg-aliases to generate them.",
|
||||
obj=None,
|
||||
id="datatracker.E0002",
|
||||
))
|
||||
except IOError as e:
|
||||
errors.append(checks.Error(
|
||||
"Could not read group email aliases:\n %s" % e,
|
||||
hint="Please run ietf/bin/generate-wg-aliases to generate them.",
|
||||
obj=None,
|
||||
id="datatracker.E0003",
|
||||
))
|
||||
|
||||
return errors
|
||||
|
||||
@checks.register('files')
|
||||
def check_doc_email_aliases_exists(app_configs, **kwargs):
|
||||
from ietf.doc.views_doc import get_doc_email_aliases
|
||||
errors = []
|
||||
try:
|
||||
aliases = get_doc_email_aliases(None)
|
||||
if not aliases:
|
||||
errors.append(checks.Critical(
|
||||
"Found no aliases in the document email aliases file.",
|
||||
hint="Please run ietf/bin/generate-draft-aliases to generate them.",
|
||||
obj=None,
|
||||
id="datatracker.E0004",
|
||||
))
|
||||
except IOError as e:
|
||||
errors.append(checks.Critical(
|
||||
"Could not read document email aliases:\n %s" % e,
|
||||
hint="Please run ietf/bin/generate-draft-aliases to generate them.",
|
||||
obj=None,
|
||||
id="datatracker.E0005",
|
||||
))
|
||||
|
||||
return errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue