Skip IANA - Review Needed and Version Changed - Review Needed changes
from IANA as it turns out that the Datatracker is the authoritative source on these states. Also improve logging so that the raw JSON from IANA is dumped, the parsed JSON on imported changes is dumped and we write to syslog before starting a sync script in the notification view. - Legacy-Id: 5800
This commit is contained in:
parent
57b0ca9cab
commit
0f69f87a56
|
@ -55,11 +55,13 @@ while t < end:
|
|||
# requests if necessary
|
||||
|
||||
text = fetch_changes_json(settings.IANA_SYNC_CHANGES_URL, t, min(end, t + MAX_INTERVAL_ACCEPTED_BY_IANA))
|
||||
syslog.syslog("Retrieved the JSON: %s" % text)
|
||||
|
||||
changes = parse_changes_json(text)
|
||||
added_events, warnings = update_history_with_changes(changes, send_email=options.send_email)
|
||||
|
||||
for e in added_events:
|
||||
syslog.syslog("Added event for %s %s: %s" % (e.doc_id, e.time, e.desc))
|
||||
syslog.syslog("Added event for %s %s: %s (parsed json: %s)" % (e.doc_id, e.time, e.desc, e.json))
|
||||
|
||||
for w in warnings:
|
||||
syslog.syslog("WARNING: %s" % w)
|
||||
|
|
|
@ -169,6 +169,11 @@ def update_history_with_changes(changes, send_email=True):
|
|||
state = states[kind][c["state"]]
|
||||
state_type = "draft-iana-%s" % kind
|
||||
|
||||
if state.slug in ("need-rev", "changed"):
|
||||
# the Datatracker is the ultimate source of these
|
||||
# states, so skip them
|
||||
continue
|
||||
|
||||
e = StateDocEvent.objects.filter(type="changed_state", time=timestamp,
|
||||
state_type=state_type, state=state)
|
||||
if not e:
|
||||
|
@ -185,6 +190,8 @@ def update_history_with_changes(changes, send_email=True):
|
|||
e = add_state_change_event(doc, system, prev_state, state, timestamp)
|
||||
|
||||
if e:
|
||||
# for logging purposes
|
||||
e.json = c
|
||||
added_events.append(e)
|
||||
|
||||
if not StateDocEvent.objects.filter(doc=doc, time__gt=timestamp, state_type=state_type):
|
||||
|
|
|
@ -45,6 +45,12 @@ class IANASyncTestCase(django.test.TestCase):
|
|||
"state": "IANA Not OK",
|
||||
"type": "iana_review",
|
||||
},
|
||||
{
|
||||
"time": "2011-10-09 12:00:02",
|
||||
"doc": draft.name,
|
||||
"state": "IANA - Review Needed", # this should be skipped
|
||||
"type": "iana_review",
|
||||
},
|
||||
{
|
||||
"time": "2011-10-09 12:00:00",
|
||||
"doc": draft.name,
|
||||
|
|
|
@ -78,6 +78,9 @@ def notify(request, org, notification):
|
|||
out, _ = p.communicate()
|
||||
return (p.returncode, out)
|
||||
|
||||
import syslog
|
||||
syslog.syslog("Running sync script from notify view POST")
|
||||
|
||||
if notification == "protocols":
|
||||
failed, out = runscript("iana-protocols-updates")
|
||||
|
||||
|
|
Loading…
Reference in a new issue