55
66import datetime
77import io
8- import json
98import os
109import requests
1110import socket
1211import sys
1312import syslog
14- import traceback
1513
1614# boilerplate
1715basedir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../.." ))
@@ -26,11 +24,8 @@ django.setup()
2624
2725from django .conf import settings
2826from optparse import OptionParser
29- from django .core .mail import mail_admins
3027
31- from ietf .doc .utils import rebuild_reference_relations
3228from ietf .utils .log import log
33- from ietf .utils .pipe import pipe
3429
3530import ietf .sync .rfceditor
3631
@@ -72,23 +67,41 @@ for changes, doc, rfc_published in ietf.sync.rfceditor.update_docs_from_rfc_inde
7267
7368sys .exit (0 )
7469
75- # This can be called while processing a notifying POST from the RFC Editor
76- # Spawn a child to sync the rfcs and calculate new reference relationships
77- # so that the POST
78-
79- newpid = os .fork ()
80-
81- if newpid == 0 :
82- try :
83- pipe ("%s -a %s %s" % (settings .RSYNC_BINARY ,settings .RFC_TEXT_RSYNC_SOURCE ,settings .RFC_PATH ))
84- for rfc in new_rfcs :
85- rebuild_reference_relations (rfc )
86- log ("Updated references for %s" % rfc .canonical_name ())
87- except :
88- subject = "Exception in updating references for new rfcs: %s : %s" % (sys .exc_info ()[0 ],sys .exc_info ()[1 ])
89- msg = "%s\n %s\n ----\n %s" % (sys .exc_info ()[0 ],sys .exc_info ()[1 ],traceback .format_tb (sys .exc_info ()[2 ]))
90- mail_admins (subject ,msg ,fail_silently = True )
91- log (subject )
92- os ._exit (0 )
93- else :
94- sys .exit (0 )
70+ # The code below has been unreachable for 5 years as of this comment (2021; the sys.exit(0) above
71+ # has been in place since 2016). I am commenting it out rather than removing it until someone has
72+ # a chance to review what's going on and, specifically, whether reference relations are actually
73+ # being updated properly.
74+ #
75+ # See trac ticket #3491 for info (and update that if you make progress on this)
76+ #
77+ # The call here to rebuild_reference_relations(rfc) relied on that method to deduce the correct
78+ # filename for rfc. I am taking out that capability because it is not used elsewhere. The code it
79+ # used to deduce the filename was:
80+ #
81+ # if not filename:
82+ # if doc.get_state_slug() == 'rfc':
83+ # filename=os.path.join(settings.RFC_PATH,doc.canonical_name()+".txt")
84+ # else:
85+ # filename=os.path.join(settings.INTERNET_DRAFT_PATH,doc.filename_with_rev())
86+ #
87+
88+ # # This can be called while processing a notifying POST from the RFC Editor
89+ # # Spawn a child to sync the rfcs and calculate new reference relationships
90+ # # so that the POST
91+ #
92+ # newpid = os.fork()
93+ #
94+ # if newpid == 0:
95+ # try:
96+ # pipe("%s -a %s %s" % (settings.RSYNC_BINARY,settings.RFC_TEXT_RSYNC_SOURCE,settings.RFC_PATH))
97+ # for rfc in new_rfcs:
98+ # rebuild_reference_relations(rfc)
99+ # log("Updated references for %s"%rfc.canonical_name())
100+ # except:
101+ # subject = "Exception in updating references for new rfcs: %s : %s" % (sys.exc_info()[0],sys.exc_info()[1])
102+ # msg = "%s\n%s\n----\n%s"%(sys.exc_info()[0],sys.exc_info()[1],traceback.format_tb(sys.exc_info()[2]))
103+ # mail_admins(subject,msg,fail_silently=True)
104+ # log(subject)
105+ # os._exit(0)
106+ # else:
107+ # sys.exit(0)
0 commit comments