[svn] commit: r168 - in /branches/f2f200910/src/lib: bind-cfgd/python/bind-cfgd.py cc/python/ISC/CC/session.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Oct 29 20:52:48 UTC 2009
Author: jelte
Date: Thu Oct 29 20:52:47 2009
New Revision: 168
Log:
last fix for python3 conversion
Modified:
branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py
branches/f2f200910/src/lib/cc/python/ISC/CC/session.py
Modified: branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py
==============================================================================
--- branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py (original)
+++ branches/f2f200910/src/lib/bind-cfgd/python/bind-cfgd.py Thu Oct 29 20:52:47 2009
@@ -30,10 +30,17 @@
self.cc.group_sendmsg({"zone_deleted": zone_name }, "ParkingLot")
def read_config(self, filename):
- pass
+ print("Reading config")
+ try:
+ file = open(filename, 'r');
+ self.config = pickle.load(file)
+ except IOError as ioe:
+ print("No config file found, starting with empty config")
def write_config(self, filename):
- pass
+ print("Writing config")
+ file = open(filename, 'w');
+ pickle.dump(self.config, file)
def handle_msg(self, msg):
"""return answer message"""
@@ -48,7 +55,7 @@
self.remove_zone(cmd[2])
answer["result"] = [ 0 ]
elif cmd[0] == "zone" and cmd[1] == "list":
- answer["result"] = self.config.zones.keys()
+ answer["result"] = list(self.config.zones.keys())
else:
print("unknown command: " + str(cmd))
answer["result"] = [ 1, "Unknown command: " + str(cmd) ]
@@ -76,9 +83,15 @@
print("Hello, BIND10 world!")
try:
cm = ConfigManager()
+ cm.read_config("/tmp/a")
# do loading here if necessary
cm.notify_boss()
cm.run()
except ISC.CC.SessionError as se:
print("Error creating config manager, "
"is the command channel daemon running?")
+ except KeyboardInterrupt as kie:
+ print("Got ctrl-c, save config and exit")
+ cm.write_config("/tmp/a")
+
+
Modified: branches/f2f200910/src/lib/cc/python/ISC/CC/session.py
==============================================================================
--- branches/f2f200910/src/lib/cc/python/ISC/CC/session.py (original)
+++ branches/f2f200910/src/lib/cc/python/ISC/CC/session.py Thu Oct 29 20:52:47 2009
@@ -138,7 +138,7 @@
env = self.recvmsg(nonblock)
if env == None:
return None
- msg = Message.from_wire(env["msg"])
+ msg = Message.from_wire(env["msg"].encode('ascii'))
return (msg, env)
def group_reply(self, routing, msg):
More information about the bind10-changes
mailing list