Commit d3a0ac22 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2737] Few more occurrences

Few more occurrences of the magic keywords scattered through the code
replaced by constants.
parent 2118111e
......@@ -42,6 +42,7 @@ import random
import time
import signal
from isc.config import ccsession
import isc.cc.proto_defs
import isc.util.process
import isc.net.parse
from optparse import OptionParser, OptionValueError
......@@ -459,7 +460,8 @@ class CommandControl():
else:
return rcode, {}
else:
errstr = str(answer['result'][1])
errstr = \
str(answer[isc.cc.proto_defs.CC_PAYLOAD_RESULT][1])
except ccsession.ModuleCCSessionError as mcse:
errstr = str("Error in ccsession answer:") + str(mcse)
......
......@@ -82,7 +82,7 @@ def parse_answer(msg):
containing an error message"""
if type(msg) != dict:
raise ModuleCCSessionError("Answer message is not a dict: " + str(msg))
if 'result' not in msg:
if CC_PAYLOAD_RESULT not in msg:
raise ModuleCCSessionError("answer message does not contain 'result' element")
elif type(msg[CC_PAYLOAD_RESULT]) != list:
raise ModuleCCSessionError("wrong result type in answer message")
......
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