[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Dont fail when MM_TESTING_DHPARAMS is set to an inacces...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria:/tmp/cvs-serv19328/lib/mixminion

Modified Files:
	test.py 
Log Message:
Dont fail when MM_TESTING_DHPARAMS is set to an inaccessible file.

Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -d -r1.218 -r1.219
--- test.py	9 Aug 2005 15:51:32 -0000	1.218
+++ test.py	9 Aug 2005 16:22:26 -0000	1.219
@@ -3908,15 +3908,24 @@
             pkfile = f+"_pk"
             certfile = f+"_cert"
             dh_fname = os.environ.get("MM_TEST_DHPARAMS")
+            got = 0
             if dh_fname and not USE_SLOW_MODE:
                 dhfile = dh_fname
-                if not os.path.exists(dh_fname):
-                    print "[Generating DH parameters...",
-                    sys.stdout.flush()
-                    _ml.generate_dh_parameters(dhfile, 0)
-                    print "done.]",
-                    sys.stdout.flush()
-            else:
+                try:
+                    if not os.path.exists(dh_fname):
+                        print "[Generating DH parameters...",
+                        sys.stdout.flush()
+                        _ml.generate_dh_parameters(dhfile, 0)
+                        print "done.]",
+                        sys.stdout.flush()
+                        got = 1
+                    else:
+                        readFile(dh_fname)
+                        got = 1
+                except (OSError,TLSError):
+                    print ("[Couldn't read/write %s]"%dh_fname),
+
+            if not got:
                 print "[Generating DH parameters (not caching)...",
                 sys.stdout.flush()
                 _ml.generate_dh_parameters(dhfile, 0)