40 lines
974 B
Python
Executable file
40 lines
974 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import io
|
|
import os
|
|
import requests
|
|
import socket
|
|
import sys
|
|
|
|
# boilerplate
|
|
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
|
sys.path = [ basedir ] + sys.path
|
|
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
|
|
|
import django
|
|
django.setup()
|
|
|
|
from django.conf import settings
|
|
|
|
from ietf.sync.rfceditor import parse_queue, MIN_QUEUE_RESULTS, update_drafts_from_queue
|
|
from ietf.utils.log import log
|
|
|
|
log("Updating RFC Editor queue states from %s" % settings.RFC_EDITOR_QUEUE_URL)
|
|
|
|
socket.setdefaulttimeout(30)
|
|
response = requests.get(settings.RFC_EDITOR_QUEUE_URL).text
|
|
drafts, warnings = parse_queue(io.StringIO(response))
|
|
for w in warnings:
|
|
log(u"Warning: %s" % w)
|
|
|
|
if len(drafts) < MIN_QUEUE_RESULTS:
|
|
log("Not enough results, only %s" % len(drafts))
|
|
sys.exit(1)
|
|
|
|
changed, warnings = update_drafts_from_queue(drafts)
|
|
for w in warnings:
|
|
log(u"Warning: %s" % w)
|
|
|
|
for c in changed:
|
|
log(u"Updated %s" % c)
|