Skip to content

Commit 942efac

Browse files
committed
Added a guard to prevent duplicate RFC-Editor notifications for approved documents, and added logging to the notification routine.
- Legacy-Id: 5852
1 parent 3cb184e commit 942efac

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

ietf/idrfc/views_ballot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,8 @@ def approve_ballotREDESIGN(request, name):
10161016
else:
10171017
new_state = State.objects.get(used=True, type="draft-iesg", slug="ann")
10181018

1019-
if new_state.slug == "ann" and not request.REQUEST.get("skiprfceditorpost"):
1019+
prev_state = doc.get_state("draft-iesg")
1020+
if new_state.slug == "ann" and new_state.slug != prev_state.slug and not request.REQUEST.get("skiprfceditorpost"):
10201021
# start by notifying the RFC Editor
10211022
import ietf.sync.rfceditor
10221023
response, error = ietf.sync.rfceditor.post_approved_draft(settings.RFC_EDITOR_SYNC_NOTIFICATION_URL, doc.name)
@@ -1032,7 +1033,6 @@ def approve_ballotREDESIGN(request, name):
10321033

10331034
save_document_in_history(doc)
10341035

1035-
prev = doc.get_state("draft-iesg")
10361036
doc.set_state(new_state)
10371037

10381038
prev_tag = doc.tags.filter(slug__in=IESG_SUBSTATE_TAGS)
@@ -1052,7 +1052,7 @@ def approve_ballotREDESIGN(request, name):
10521052

10531053
change_description = e.desc + " and state has been changed to %s" % doc.get_state("draft-iesg").name
10541054

1055-
e = idrfcutil_log_state_changed(request, doc, login, prev, prev_tag)
1055+
e = idrfcutil_log_state_changed(request, doc, login, prev_state, prev_tag)
10561056

10571057
doc.time = e.time
10581058
doc.save()

ietf/sync/rfceditor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.utils.http import urlquote
55

66
from ietf.utils.mail import send_mail_text
7+
from ietf.utils import log
78

89
from ietf.doc.models import *
910
from ietf.person.models import *
@@ -477,12 +478,14 @@ def post_approved_draft(url, name):
477478
if settings.SERVER_MODE != "production":
478479
return ("OK", "")
479480

481+
log("Posting RFC-Editor notifcation of approved draft '%s' to '%s'" % (name, url))
480482
text = error = ""
481483
try:
482484
f = urllib2.urlopen(request, data=urllib.urlencode({ 'draft': name }), timeout=20)
483485
text = f.read()
484486
status_code = f.getcode()
485487
f.close()
488+
log("RFC-Editor notification result for draft '%s': %s:'%s'" % (name, status_code, text))
486489

487490
if status_code != 200:
488491
raise Exception("Status code is not 200 OK (it's %s)." % status_code)
@@ -493,6 +496,7 @@ def post_approved_draft(url, name):
493496
except Exception as e:
494497
# catch everything so we don't leak exceptions, convert them
495498
# into string instead
499+
log("Exception on RFC-Editor notification for draft '%s': '%s'" % (name, e))
496500
error = unicode(e)
497501

498502
return text, error

0 commit comments

Comments
 (0)