return
else:
return html_auth2.format(error=data)
+ if request.path_info in ("/version", "/system"):
+ return "<pre>" + yaml.safe_dump(data, explicit_start=False, indent=4, default_flow_style=False) + "</pre>"
body = html_body.format(item=request.path_info)
if response.status and response.status > 202:
body += html_body_error.format(yaml.safe_dump(data, explicit_start=True, indent=4, default_flow_style=False))
return string of dictionary data according to requested json, yaml, xml. By default json
:param data: response to be sent. Can be a dict, text or file
:param token_info: Contains among other username and project
- :param _format: The format to be set as Content-Type ir data is a file
+ :param _format: The format to be set as Content-Type if data is a file
:return: None
"""
accept = cherrypy.request.headers.get("Accept")
elif args or kwargs:
raise NbiException("Invalid URL or query string for version", HTTPStatus.METHOD_NOT_ALLOWED)
# TODO include version of other modules, pick up from some kafka admin message
- return "<pre>NBI:\n version: {}\n date: {}\n".format(nbi_version, nbi_version_date)
+ osm_nbi_version = {"version": nbi_version, "date": nbi_version_date}
+ return self._format_out(osm_nbi_version)
except NbiException as e:
cherrypy.response.status = e.http_code.value
problem_details = {