BIND 10 trac2676, updated. ab159f505de08729862904b1412d9dede8138013 [2676] Use constant for success code
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Feb 19 08:16:23 UTC 2013
The branch, trac2676 has been updated
via ab159f505de08729862904b1412d9dede8138013 (commit)
from de4ecfcd4827e8e0002c426e11e5ad36e7e14da3 (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 ab159f505de08729862904b1412d9dede8138013
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Feb 19 09:13:40 2013 +0100
[2676] Use constant for success code
Use CC_REPLY_SUCCESS instead of hardcoding 0.
-----------------------------------------------------------------------
Summary of changes:
src/lib/cc/proto_defs.cc | 1 +
src/lib/python/isc/config/ccsession.py | 9 +++++----
2 files changed, 6 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cc/proto_defs.cc b/src/lib/cc/proto_defs.cc
index 24d9650..5eb8575 100644
--- a/src/lib/cc/proto_defs.cc
+++ b/src/lib/cc/proto_defs.cc
@@ -38,6 +38,7 @@ const char* const CC_COMMAND_SEND = "send";
const char* const CC_TO_WILDCARD = "*";
const char* const CC_INSTANCE_WILDCARD = "*";
// Reply codes
+const int CC_REPLY_SUCCESS = 0;
const int CC_REPLY_NO_RECPT = -1;
}
diff --git a/src/lib/python/isc/config/ccsession.py b/src/lib/python/isc/config/ccsession.py
index 3196d32..57a9bd2 100644
--- a/src/lib/python/isc/config/ccsession.py
+++ b/src/lib/python/isc/config/ccsession.py
@@ -92,7 +92,8 @@ def parse_answer(msg):
raise ModuleCCSessionError("wrong rcode type in answer message")
else:
if len(msg['result']) > 1:
- if (msg['result'][0] != 0 and type(msg['result'][1]) != str):
+ if (msg['result'][0] != CC_REPLY_SUCCESS and \
+ type(msg['result'][1]) != str):
raise ModuleCCSessionError("rcode in answer message is non-zero, value is not a string")
return msg['result'][0], msg['result'][1]
else:
@@ -105,7 +106,7 @@ def create_answer(rcode, arg = None):
a string containing an error message"""
if type(rcode) != int:
raise ModuleCCSessionError("rcode in create_answer() must be an integer")
- if rcode != 0 and type(arg) != str:
+ if rcode != CC_REPLY_SUCCESS and type(arg) != str:
raise ModuleCCSessionError("arg in create_answer for rcode != 0 must be a string describing the error")
if arg != None:
return { 'result': [ rcode, arg ] }
@@ -325,7 +326,7 @@ class ModuleCCSession(ConfigData):
isc.cc.data.remove_identical(new_config, self.get_local_config())
answer = self._config_handler(new_config)
rcode, val = parse_answer(answer)
- if rcode == 0:
+ if rcode == CC_REPLY_SUCCESS:
newc = self.get_local_config()
isc.cc.data.merge(newc, new_config)
self.set_local_config(newc)
@@ -533,7 +534,7 @@ class ModuleCCSession(ConfigData):
code, value = parse_answer(reply)
if code == CC_REPLY_NO_RECPT:
raise RPCRecipientMissing(value)
- elif code != 0:
+ elif code != CC_REPLY_SUCCESS:
raise RPCError(code, value)
return value
More information about the bind10-changes
mailing list