Skip to content

Commit 1fbcd78

Browse files
committed
Merged branch/iola/statesync up to @5118 to trunk.
- Legacy-Id: 5147
2 parents 5b8a56a + 819e80f commit 1fbcd78

78 files changed

Lines changed: 4400 additions & 1468 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ietf/bin/email-sync-discrepancies

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
3+
import sys, os
4+
import syslog
5+
6+
# boilerplate
7+
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
8+
sys.path = [ basedir ] + sys.path
9+
10+
from ietf import settings
11+
from django.core import management
12+
management.setup_environ(settings)
13+
14+
15+
from optparse import OptionParser
16+
17+
parser = OptionParser()
18+
parser.add_option("-t", "--to", dest="to",
19+
help="Email address to send report to", metavar="EMAIL")
20+
21+
options, args = parser.parse_args()
22+
23+
24+
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_LOCAL0)
25+
26+
from ietf.sync.mails import email_discrepancies
27+
28+
receivers = ["iesg-secretary@ietf.org"]
29+
30+
if options.to:
31+
receivers = [options.to]
32+
33+
email_discrepancies(receivers)
34+
35+
syslog.syslog("Emailed sync discrepancies to %s" % receivers)

ietf/bin/iana-changes-updates

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, re, json, datetime, optparse
4+
import syslog
5+
6+
# boilerplate
7+
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
8+
sys.path = [ basedir ] + sys.path
9+
10+
from ietf import settings
11+
from django.core import management
12+
management.setup_environ(settings)
13+
14+
15+
from optparse import OptionParser
16+
17+
parser = OptionParser()
18+
parser.add_option("-f", "--from", dest="start",
19+
help="Start time, defaults to a little less than 23 hours ago", metavar="YYYY-MM-DD HH:MM:SS")
20+
parser.add_option("-t", "--to", dest="end",
21+
help="End time, defaults to 23 hours later than from", metavar="YYYY-MM-DD HH:MM:SS")
22+
parser.add_option("", "--no-email", dest="send_email", default=True, action="store_false",
23+
help="Skip sending emails")
24+
25+
options, args = parser.parse_args()
26+
27+
# compensate to avoid we ask for something that happened now and then
28+
# don't get it back because our request interval is slightly off
29+
CLOCK_SKEW_COMPENSATION = 5 # seconds
30+
31+
# actually the interface accepts 24 hours, but then we get into
32+
# trouble with daylights savings - meh
33+
MAX_INTERVAL_ACCEPTED_BY_IANA = datetime.timedelta(hours=23)
34+
35+
36+
start = datetime.datetime.now() - datetime.timedelta(hours=23) + datetime.timedelta(seconds=CLOCK_SKEW_COMPENSATION)
37+
if options.start:
38+
start = datetime.datetime.strptime(options.start, "%Y-%m-%d %H:%M:%S")
39+
40+
end = start + datetime.timedelta(hours=23)
41+
if options.end:
42+
end = datetime.datetime.strptime(options.end, "%Y-%m-%d %H:%M:%S")
43+
44+
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_LOCAL0)
45+
46+
47+
from ietf.sync.iana import *
48+
49+
syslog.syslog("Updating history log with new changes from IANA from %s, period %s - %s" % (CHANGES_URL, start, end))
50+
51+
t = start
52+
while t < end:
53+
# the IANA server doesn't allow us to fetch more than a certain
54+
# period, so loop over the requested period and make multiple
55+
# requests if necessary
56+
57+
text = fetch_changes_json(CHANGES_URL, t, min(end, t + MAX_INTERVAL_ACCEPTED_BY_IANA))
58+
changes = parse_changes_json(text)
59+
added_events, warnings = update_history_with_changes(changes, send_email=options.send_email)
60+
61+
for e in added_events:
62+
syslog.syslog("Added event for %s %s: %s" % (e.doc_id, e.time, e.desc))
63+
64+
for w in warnings:
65+
syslog.syslog("WARNING: %s" % w)
66+
67+
t += MAX_INTERVAL_ACCEPTED_BY_IANA

ietf/bin/iana-protocols-updates

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, re, json, datetime
4+
import syslog
5+
6+
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_LOCAL0)
7+
8+
# boilerplate
9+
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
10+
sys.path = [ basedir ] + sys.path
11+
12+
from ietf import settings
13+
from django.core import management
14+
management.setup_environ(settings)
15+
16+
17+
from ietf.sync.iana import *
18+
19+
def chunks(l, n):
20+
"""Split list l up in chunks of max size n."""
21+
return (l[i:i+n] for i in xrange(0, len(l), n))
22+
23+
syslog.syslog("Updating history log with new RFC entries from IANA protocols page %s" % PROTOCOLS_URL)
24+
25+
# FIXME: this needs to be the date where this tool is first deployed
26+
rfc_must_published_later_than = datetime.datetime(2012, 11, 26, 0, 0, 0)
27+
28+
text = fetch_protocol_page(PROTOCOLS_URL)
29+
rfc_numbers = parse_protocol_page(text)
30+
for chunk in chunks(rfc_numbers, 100):
31+
updated = update_rfc_log_from_protocol_page(chunk, rfc_must_published_later_than)
32+
33+
for d in updated:
34+
syslog.syslog("Added history entry for %s" % d.display_name())

ietf/bin/iana-review-email

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, re, json, datetime, optparse
4+
import syslog
5+
6+
# boilerplate
7+
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
8+
sys.path = [ basedir ] + sys.path
9+
10+
from ietf import settings
11+
from django.core import management
12+
management.setup_environ(settings)
13+
14+
15+
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_LOCAL0)
16+
17+
from ietf.sync.iana import *
18+
from ietf.doc.models import Document
19+
20+
msg = sys.stdin.read()
21+
22+
doc_name, review_time, by, comment = parse_review_email(msg)
23+
24+
syslog.syslog(u"Read IANA review email for %s at %s by %s" % (doc_name, review_time, by))
25+
26+
if by.name == "(System)":
27+
syslog.syslog("WARNING: person responsible for email does not have a IANA role")
28+
29+
try:
30+
add_review_comment(doc_name, review_time, by, comment)
31+
except Document.DoesNotExist:
32+
syslog.syslog("ERROR: unknown document %s" % doc_name)
33+

ietf/bin/rfc-editor-index-updates

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, re, json, datetime
4+
import syslog
5+
6+
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_LOCAL0)
7+
8+
# boilerplate
9+
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
10+
sys.path = [ basedir ] + sys.path
11+
12+
from ietf import settings
13+
from django.core import management
14+
management.setup_environ(settings)
15+
16+
17+
from optparse import OptionParser
18+
19+
parser = OptionParser()
20+
parser.add_option("-d", dest="skip_date",
21+
help="To speed up processing skip RFCs published before this date (default is one year ago)", metavar="YYYY-MM-DD")
22+
23+
options, args = parser.parse_args()
24+
25+
skip_date = datetime.date.today() - datetime.timedelta(days=365)
26+
if options.skip_date:
27+
skip_date = datetime.datetime.strptime(options.skip_date, "%Y-%m-%d").date()
28+
29+
from ietf.sync.rfceditor import *
30+
31+
syslog.syslog("Updating document metadata from RFC index from %s" % QUEUE_URL)
32+
33+
response = fetch_index_xml(INDEX_URL)
34+
data = parse_index(response)
35+
36+
if len(data) < MIN_INDEX_RESULTS:
37+
syslog.syslog("Not enough results, only %s" % len(data))
38+
sys.exit(1)
39+
40+
changed = update_docs_from_rfc_index(data, skip_older_than_date=skip_date)
41+
for c in changed:
42+
syslog.syslog(c)

ietf/bin/rfc-editor-queue-updates

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, re, json, datetime
4+
import syslog
5+
6+
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_LOCAL0)
7+
8+
# boilerplate
9+
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
10+
sys.path = [ basedir ] + sys.path
11+
12+
from ietf import settings
13+
from django.core import management
14+
management.setup_environ(settings)
15+
16+
17+
from ietf.sync.rfceditor import *
18+
19+
syslog.syslog("Updating RFC Editor queue states from %s" % QUEUE_URL)
20+
21+
response = fetch_queue_xml(QUEUE_URL)
22+
drafts, warnings = parse_queue(response)
23+
for w in warnings:
24+
syslog.syslog(u"WARNING: %s" % w)
25+
26+
if len(drafts) < MIN_QUEUE_RESULTS:
27+
syslog.syslog("Not enough results, only %s" % len(drafts))
28+
sys.exit(1)
29+
30+
changed, warnings = update_drafts_from_queue(drafts)
31+
for w in warnings:
32+
syslog.syslog(u"WARNING: %s" % w)
33+
34+
for c in changed:
35+
syslog.syslog(u"Updated %s" % c)

ietf/doc/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def rev(self, obj):
142142
admin.site.register(DocEvent, DocEventAdmin)
143143

144144
admin.site.register(NewRevisionDocEvent, DocEventAdmin)
145+
admin.site.register(StateDocEvent, DocEventAdmin)
146+
admin.site.register(ConsensusDocEvent, DocEventAdmin)
145147
admin.site.register(BallotDocEvent, DocEventAdmin)
146148
admin.site.register(WriteupDocEvent, DocEventAdmin)
147149
admin.site.register(LastCallDocEvent, DocEventAdmin)

0 commit comments

Comments
 (0)