def _put(self, path, **kwargs):
"""
Issues a PUT request to the MAAS REST API.
"""
try:
response = self.client.put(path, **kwargs)
payload = response.read()
log.debug("Request %s results: [%s] %s", path, response.getcode(),
payload)
if response.getcode() == OK:
return Response(True, payload)
else:
return Response(False, payload)
except HTTPError as e:
log.error("Error encountered: %s with details: %s for %s with "
"params %s", e, e.read(), path, str(kwargs))
return Response(False, None)
except Exception as e:
log.error("Put request raised exception: %s", e)
return Response(False, None)
###########################################################################
# DNS API - http://maas.ubuntu.com/docs2.0/api.html#dnsresource
###########################################################################
评论列表
文章目录