datatracker/ietf/submit/migrations/0010_data_set_submission_check_symbol.py
Henrik Levkowetz d98054c103 Added a new yang checker, 'yanglint', to the existing Yang checker class, in
addition to the existing 'pyang' checker.

Added modal overlay displays showing the yang check results every place the
yin/yang symbol is shown (red or green) to indicate the presencee and result
of yang checks.  Added a Yang Validation: line in the document
meta-information section on the document's page in the datatracker.

Added the result of the xym extaction to the yang check results, to make
extration failures visible.

Added the version of the used xym, pyang, and yanglint commands to the check
results.

Added an action to move successfully extracted and validated modules to the
module library directories immediately on submission.

Added the xym and pyang repositories as svn:external components, rather than
listing them in requirements.txt, as there has been delays of many months
between essential features in the repositories, and an actual release.  We may
get occasional buildbot failures if broken code is pulled in from the
repository, but better that than the functionality failure of severely
outdated componets.

Added a new management command to re-run yang validation for active drafts for
which yang modules were found at submission time, in order to pick up imported
models which may have arrived in the model libraries after the draft's
submission.  Run daily from bin/daily.

Added a table to hold version information for external commands.  The yang
checker output should include the version information of the used checkers,
but seems unnecessary to run each command with its --version switch every
time we check a module...

Added a new management command to collect version information for external
commands on demand.  To be run daily from bin/daily.

Added tests to verify that xym, pyang and yanglint information is available
on the submission confirmation page, and updated the yang module contained in
the test document to validate under both pyang and yanglint.

Updated admin.py and resource.py files as needed.
 - Legacy-Id: 13630
2017-06-15 16:09:28 +00:00

37 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from tqdm import tqdm
from django.db import migrations
from ietf.submit.checkers import DraftIdnitsChecker, DraftYangChecker
def set_submission_check_symbol(apps, schema_editor):
SubmissionCheck = apps.get_model('submit','SubmissionCheck')
checks = SubmissionCheck.objects.all()
print("")
print(" Adding submission check symbol info to existing checks")
for s in tqdm(checks):
if not s.symbol:
if s.checker == "idnits check":
s.symbol = DraftIdnitsChecker.symbol
if s.checker == 'yang validation':
s.symbol = DraftYangChecker.symbol
s.save()
def backward(apps, schema_editor):
SubmissionCheck = apps.get_model('submit','SubmissionCheck')
for s in SubmissionCheck.objects.all():
if s.symbol != "":
s.symbol = ""
s.save()
class Migration(migrations.Migration):
dependencies = [
('submit', '0009_submissioncheck_symbol'),
]
operations = [
migrations.RunPython(set_submission_check_symbol, backward)
]