[Digicool-CVS] CVS: CVSROOT - postcommit_actions:1.83

Digicool CVS cvs@digicool.com
Wed, 7 Mar 2001 12:53:18 -0500


Update of /cvs-repository/CVSROOT
In directory serenade:/projects/users/klm/Operations/CVSROOT

Modified Files:
	postcommit_actions 
Log Message:
Protecting against that tempfile.template being None, even after
.mktemp() has been invoked.  This should avoid the problem andreas is
seeing only on his machine.



--- Updated File postcommit_actions in package CVSROOT --
--- postcommit_actions	2001/03/06 20:58:09	1.82
+++ postcommit_actions	2001/03/07 17:53:17	1.83
@@ -65,6 +65,7 @@
 import string
 import getopt
 import smtplib
+import socket,whrandom
 
 SMTP_SERVER = 'smtp.digicool.com'
 SENDER_ADDR = '"Digicool CVS" <cvs@digicool.com>'
@@ -264,7 +265,9 @@
     doctored_args.append("--wait")
     tempfile.mktemp()           # Throw one away, to get initial template.
     tempfile.tempdir = "/tmp"
-    tempfile.template = "cvs-log" + tempfile.template
+    template = (tempfile.template or
+                "@%s.%d" % (os.getpid(), whrandom.randint(1000000, 9999999)))
+    tempfile.template = "cvs-log" + template
     msgfile = open(tempfile.mktemp(), 'w')
     msgfile.write(sys.stdin.read())
     msgfile.close()
@@ -594,7 +597,9 @@
     if os.environ.has_key('HOSTNAME'):
         host = os.environ['HOSTNAME']
     else:
-        host = "<unidentified host>"
+        host = socket.gethostbyaddr(socket.gethostname())[0]
+        if not host:
+            host = "nohost.digicool.com"
 
     if os.environ.has_key('LOGNAME'):
         user = os.environ['LOGNAME']