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

Merge branch 'trac431'

parents c98ce872 345b8170
......@@ -217,16 +217,24 @@ class BindCmdInterpreter(Cmd):
for module_name in self.config_data.get_config_item_list():
self._prepare_module_commands(self.config_data.get_module_spec(module_name))
def _send_message(self, url, body):
headers = {"cookie" : self.session_id}
self.conn.request('GET', url, body, headers)
res = self.conn.getresponse()
return res.status, res.read()
def send_GET(self, url, body = None):
'''Send GET request to cmdctl, session id is send with the name
'cookie' in header.
'''
headers = {"cookie" : self.session_id}
self.conn.request('GET', url, body, headers)
res = self.conn.getresponse()
reply_msg = res.read()
status, reply_msg = self._send_message(url, body)
if status == http.client.UNAUTHORIZED:
if self.login_to_cmdctl():
# successful, so try send again
status, reply_msg = self._send_message(url, body)
if reply_msg:
return json.loads(reply_msg.decode())
return json.loads(reply_msg.decode())
else:
return {}
......
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