BIND 10 trac2641_3, updated. 99fbbc37fe2c3e465af2e1e5990b89602b02e8d4 [2641] Rename and fix CMDCTL_SRC_PATH usage

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Mar 6 04:10:40 UTC 2013


The branch, trac2641_3 has been updated
       via  99fbbc37fe2c3e465af2e1e5990b89602b02e8d4 (commit)
       via  ee109e14bb0c0409c689ca73fb9ddd5f2435e29b (commit)
      from  e2e93cd2354580d7707c07f8f73e07e0e27f18c0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 99fbbc37fe2c3e465af2e1e5990b89602b02e8d4
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Mar 6 09:39:52 2013 +0530

    [2641] Rename and fix CMDCTL_SRC_PATH usage

commit ee109e14bb0c0409c689ca73fb9ddd5f2435e29b
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Mar 6 09:34:14 2013 +0530

    [2641] Unify exception handling code
    
    Also don't catch specific exception errnos. Just handle them all
    equally.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/bindctl/bindcmd.py               |   18 ++++------------
 src/bin/bindctl/tests/bindctl_test.py    |   33 +++++++++++++++++++-----------
 src/bin/cmdctl/tests/Makefile.am         |    2 +-
 src/bin/cmdctl/tests/b10-certgen_test.py |    5 +----
 src/bin/cmdctl/tests/cmdctl_test.py      |    4 ++--
 5 files changed, 29 insertions(+), 33 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index ae6e3a0..3bc25cc 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -215,10 +215,6 @@ WARNING: Python readline module isn't available, so the command line editor
 
         return True
 
-    def __print_check_ssl_msg(self):
-        self._print("Please check the logs of b10-cmdctl, there may "
-                    "have been a problem accepting SSL connections.")
-
     def _try_login(self, username, password):
         '''
         Attempts to log into cmdctl by sending a POST with the given
@@ -236,16 +232,10 @@ WARNING: Python readline module isn't available, so the command line editor
             data = response.read().decode()
             # return here (will raise error after try block)
             return (response, data)
-        except ssl.SSLError as err:
-            self._print("SSL error while sending login information: ", err)
-            if err.errno == ssl.SSL_ERROR_EOF:
-                self.__print_check_ssl_msg()
-        except socket.error as err:
-            self._print("Socket error while sending login information: ", err)
-            # An SSL setup error can also bubble up as a plain CONNRESET...
-            # (on some systems it usually does)
-            if err.errno == errno.ECONNRESET:
-                self.__print_check_ssl_msg()
+        except (ssl.SSLError, socket.error) as err:
+            self._print("Error while sending login information: ", err)
+            self._print("Please check the logs of b10-cmdctl, there may "
+                        "have been a problem accepting SSL connections.")
             pass
         raise FailToLogin()
 
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index c6512be..921a9f5 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -387,7 +387,11 @@ class TestConfigCommands(unittest.TestCase):
             self.tool.send_POST = send_POST_raiseImmediately
             self.assertRaises(FailToLogin, self.tool._try_login, "foo", "bar")
             expected_printed_messages.append(
-                'Socket error while sending login information:  test error')
+                'Error while sending login information:  test error')
+            expected_printed_messages.append(
+                'Please check the logs of b10-cmdctl, there may have been a '
+                'problem accepting SSL connections.'
+            )
             self.__check_printed_messages(expected_printed_messages)
 
             def create_send_POST_raiseOnRead(exception):
@@ -406,7 +410,11 @@ class TestConfigCommands(unittest.TestCase):
                 create_send_POST_raiseOnRead(socket.error("read error"))
             self.assertRaises(FailToLogin, self.tool._try_login, "foo", "bar")
             expected_printed_messages.append(
-                'Socket error while sending login information:  read error')
+                'Error while sending login information:  read error')
+            expected_printed_messages.append(
+                'Please check the logs of b10-cmdctl, there may have been a '
+                'problem accepting SSL connections.'
+            )
             self.__check_printed_messages(expected_printed_messages)
 
             # connection reset
@@ -416,12 +424,10 @@ class TestConfigCommands(unittest.TestCase):
                 create_send_POST_raiseOnRead(exc)
             self.assertRaises(FailToLogin, self.tool._try_login, "foo", "bar")
             expected_printed_messages.append(
-                'Socket error while sending login information:  '
-                'connection reset')
+                'Error while sending login information:  connection reset')
             expected_printed_messages.append(
-                'Please check the logs of b10-cmdctl, there may be a '
-                'problem accepting SSL connections, such as a permission '
-                'problem on the server certificate file.'
+                'Please check the logs of b10-cmdctl, there may have been a '
+                'problem accepting SSL connections.'
             )
             self.__check_printed_messages(expected_printed_messages)
 
@@ -431,7 +437,11 @@ class TestConfigCommands(unittest.TestCase):
                 create_send_POST_raiseOnRead(exc)
             self.assertRaises(FailToLogin, self.tool._try_login, "foo", "bar")
             expected_printed_messages.append(
-                'SSL error while sending login information:  .*')
+                'Error while sending login information:  .*')
+            expected_printed_messages.append(
+                'Please check the logs of b10-cmdctl, there may have been a '
+                'problem accepting SSL connections.'
+            )
             self.__check_printed_messages(expected_printed_messages)
 
             # 'EOF' SSL error
@@ -441,11 +451,10 @@ class TestConfigCommands(unittest.TestCase):
                 create_send_POST_raiseOnRead(exc)
             self.assertRaises(FailToLogin, self.tool._try_login, "foo", "bar")
             expected_printed_messages.append(
-                'SSL error while sending login information: .*')
+                'Error while sending login information: .*')
             expected_printed_messages.append(
-                'Please check the logs of b10-cmdctl, there may be a '
-                'problem accepting SSL connections, such as a permission '
-                'problem on the server certificate file.'
+                'Please check the logs of b10-cmdctl, there may have been a '
+                'problem accepting SSL connections.'
             )
             self.__check_printed_messages(expected_printed_messages)
 
diff --git a/src/bin/cmdctl/tests/Makefile.am b/src/bin/cmdctl/tests/Makefile.am
index e2e0361..f24cf73 100644
--- a/src/bin/cmdctl/tests/Makefile.am
+++ b/src/bin/cmdctl/tests/Makefile.am
@@ -25,8 +25,8 @@ endif
 	echo Running test: $$pytest ; \
 	$(LIBRARY_PATH_PLACEHOLDER) \
 	PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/cmdctl \
+	CMDCTL_SRC_PATH=$(abs_top_srcdir)/src/bin/cmdctl \
 	CMDCTL_BUILD_PATH=$(abs_top_builddir)/src/bin/cmdctl \
-	CMDCTL_TESTDATA_PATH=$(abs_top_srcdir)/src/bin/cmdctl \
 	B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir) \
 	$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
 	done
diff --git a/src/bin/cmdctl/tests/b10-certgen_test.py b/src/bin/cmdctl/tests/b10-certgen_test.py
index 3cc61e5..56630bc 100644
--- a/src/bin/cmdctl/tests/b10-certgen_test.py
+++ b/src/bin/cmdctl/tests/b10-certgen_test.py
@@ -172,10 +172,7 @@ class TestCertGenTool(unittest.TestCase):
         """
         Tests a few pre-created certificates with the -c option
         """
-        if ('CMDCTL_TESTDATA_PATH' in os.environ):
-            path = os.environ['CMDCTL_TESTDATA_PATH'] + "/tests/testdata/"
-        else:
-            path = "testdata/"
+        path = os.environ['CMDCTL_SRC_PATH'] + '/tests/testdata/'
         self.validate_certificate(10, path + 'expired-certfile.pem')
         self.validate_certificate(100, path + 'mangled-certfile.pem')
         self.validate_certificate(17, path + 'noca-certfile.pem')
diff --git a/src/bin/cmdctl/tests/cmdctl_test.py b/src/bin/cmdctl/tests/cmdctl_test.py
index 522ff03..82042fe 100644
--- a/src/bin/cmdctl/tests/cmdctl_test.py
+++ b/src/bin/cmdctl/tests/cmdctl_test.py
@@ -22,9 +22,9 @@ import sys
 from cmdctl import *
 import isc.log
 
-assert 'CMDCTL_TESTDATA_PATH' in os.environ,\
+assert 'CMDCTL_SRC_PATH' in os.environ,\
        "Please run this test with 'make check'"
-SRC_FILE_PATH = os.environ['CMDCTL_TESTDATA_PATH'] + os.sep
+SRC_FILE_PATH = os.environ['CMDCTL_SRC_PATH'] + os.sep
 
 assert 'CMDCTL_BUILD_PATH' in os.environ,\
        "Please run this test with 'make check'"



More information about the bind10-changes mailing list