def handleUpdate(cmd):
logging.info("handleUpdate: Start to handle update box. cmd=%s", str(cmd))
update_version = cmd["version"]
send_data = {
'version' : update_version,
}
headers, body = createFormData(send_data)
url = client.protocol + client.updateHostPort + "/netupdate_ajax"
update_request = HTTPRequest(url=url, method="POST", headers=headers, body=body)
logging.debug("handleUpdate: Send to update box. version=%s", update_version)
response = yield client.http_client.fetch(update_request)
if response.error:
logging.error("handleUpdate: Failed to send to update. error=%s", response.error)
return
else:
logging.debug("handleUpdate: result. response.body=%r", response.body)
updateRes = json_decode(response.body)
if updateRes == 0:
logging.info("handleUpdate: Succeed to send.")
else:
logging.error("handleUpdate: Failed to send. ret_value=%d", updateRes)
return
评论列表
文章目录