BIND 10 trac588, updated. cf2b8ace9b9c295e46fdd5373bd70a13e7e3fbee Merge branch 'trac588' of ssh://bind10.isc.org/var/bind10/git/bind10 into trac588
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Mar 9 13:22:54 UTC 2011
The branch, trac588 has been updated
via cf2b8ace9b9c295e46fdd5373bd70a13e7e3fbee (commit)
via cbc69359f3d9841a217ee55f0e30937a86cb0097 (commit)
from 45b76ba773367f8a490bbf19f0d74c02293c387b (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 cf2b8ace9b9c295e46fdd5373bd70a13e7e3fbee
Merge: cbc69359f3d9841a217ee55f0e30937a86cb0097 45b76ba773367f8a490bbf19f0d74c02293c387b
Author: chenzhengzhang <jerry.zzpku at gmail.com>
Date: Wed Mar 9 21:22:51 2011 +0800
Merge branch 'trac588' of ssh://bind10.isc.org/var/bind10/git/bind10 into trac588
commit cbc69359f3d9841a217ee55f0e30937a86cb0097
Author: chenzhengzhang <jerry.zzpku at gmail.com>
Date: Wed Mar 9 21:20:27 2011 +0800
[trac588] update exception handling logic
-----------------------------------------------------------------------
Summary of changes:
src/bin/bindctl/bindcmd.py | 9 ++++++---
src/bin/bindctl/tests/bindctl_test.py | 22 ++++++++++++++++++----
2 files changed, 24 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index 826a15e..d882120 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -123,10 +123,13 @@ class BindCmdInterpreter(Cmd):
except FailToLogin as err:
# error already printed when this was raised, ignoring
pass
- except (KeyboardInterrupt, socket.error):
+ except KeyboardInterrupt:
print('\nExit from bindctl')
- except http.client.CannotSendRequest:
- print('Failed to send request, the connection is busy')
+ except socket.error as err:
+ if sys.stdin.isatty():
+ print("Socket error while sending request:", err)
+ else:
+ print('Exit from bindctl')
def _get_saved_user_info(self, dir, file_name):
''' Read all the available username and password pairs saved in
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index 490dd7a..62de98d 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -17,6 +17,8 @@
import unittest
import isc.cc.data
import os
+import sys
+import socket
from isc.config.config_data import ConfigData, MultiConfigData
from isc.config.module_spec import ModuleSpec
from bindctl import cmdparse
@@ -271,7 +273,7 @@ class FakeCCSession(MultiConfigData):
]
}
self.set_specification(ModuleSpec(spec))
-
+
class TestConfigCommands(unittest.TestCase):
def setUp(self):
@@ -279,7 +281,21 @@ class TestConfigCommands(unittest.TestCase):
mod_info = ModuleInfo(name = "foo")
self.tool.add_module_info(mod_info)
self.tool.config_data = FakeCCSession()
-
+
+ def test_run(self):
+ stdout_backup = sys.stdout
+ sys.stdout = open(os.devnull, 'w')
+ def login_to_cmdctl():
+ return True
+ def loop():
+ self.tool._send_message("/module_spec", None)
+ self.tool.login_to_cmdctl = login_to_cmdctl
+ self.tool.cmdloop = loop
+
+ self.tool.conn.close()
+ self.assertRaises(None, self.tool.run())
+ sys.stdout = stdout_backup
+
def test_apply_cfg_command_int(self):
self.tool.location = '/'
@@ -333,8 +349,6 @@ class TestConfigCommands(unittest.TestCase):
self.assertRaises(isc.cc.data.DataTypeError, self.tool.apply_config_cmd, cmd)
-
-
class FakeBindCmdInterpreter(bindcmd.BindCmdInterpreter):
def __init__(self):
pass
More information about the bind10-changes
mailing list