Commit da4e68a2 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

session initialization raises SessionError instead of socket.error

catch that error in bind-cfgd.py


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@134 e5f2f494-b856-4b98-b285-d166d9295462
parent f44c0e00
......@@ -19,6 +19,6 @@ if __name__ == "__main__":
try:
cm = ConfigManager()
cm.run()
except socket.error:
except ISC.CC.SessionError, se:
print "Error creating config manager, "\
"is the command channel daemon running?"
......@@ -20,6 +20,7 @@ import struct
import Message
class ProtocolError(Exception): pass
class SessionError(Exception): pass
class Session:
def __init__(self):
......@@ -30,14 +31,17 @@ class Session:
self._sendbuffer = ""
self._sequence = 1
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.connect(tuple(['127.0.0.1', 9912]))
self.sendmsg({ "type": "getlname" })
msg = self.recvmsg(False)
self._lname = msg["lname"]
if not self._lname:
raise ProtocolError("Could not get local name")
try:
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.connect(tuple(['127.0.0.1', 9912]))
self.sendmsg({ "type": "getlname" })
msg = self.recvmsg(False)
self._lname = msg["lname"]
if not self._lname:
raise ProtocolError("Could not get local name")
except socket.error, se:
raise SessionError(se)
@property
def lname(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment