def details(self, request, system_id):
"""Obtain various system details.
For example, LLDP and ``lshw`` XML dumps.
Returns a ``{detail_type: xml, ...}`` map, where
``detail_type`` is something like "lldp" or "lshw".
Note that this is returned as BSON and not JSON. This is for
efficiency, but mainly because JSON can't do binary content
without applying additional encoding like base-64.
Returns 404 if the node is not found.
"""
node = get_object_or_404(self.model, system_id=system_id)
probe_details = get_single_probed_details(node)
probe_details_report = {
name: None if data is None else bson.Binary(data)
for name, data in probe_details.items()
}
return HttpResponse(
bson.BSON.encode(probe_details_report),
# Not sure what media type to use here.
content_type='application/bson')
评论列表
文章目录