Merge pull request #24947 from votdev/bug_36708

mgr/dashboard: tasks.mgr.dashboard.test_osd.OsdTest failures

Reviewed-by: Laura Paduano <lpaduano@suse.com>
Reviewed-by: Patrick Nawracay <pnawracay@suse.com>
Reviewed-by: Sebastian Wagner <swagner@suse.com>
This commit is contained in:
Lenz Grimmer 2018-11-08 14:41:38 +01:00 committed by GitHub
commit 9a0a06592a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -162,10 +162,8 @@ class DashboardTestCase(MgrTestCase):
@classmethod
def _request(cls, url, method, data=None, params=None):
url = "{}{}".format(cls._base_uri, url)
log.info("request %s to %s", method, url)
headers = {
'Content-Type': 'application/json'
}
log.info("Request %s to %s", method, url)
headers = {}
if cls._token:
headers['Authorization'] = "Bearer {}".format(cls._token)
@ -184,6 +182,9 @@ class DashboardTestCase(MgrTestCase):
else:
assert False
try:
if not cls._resp.ok:
# Output response for easier debugging.
log.error("Request response: %s", cls._resp.text)
content_type = cls._resp.headers['content-type']
if content_type == 'application/json' and cls._resp.text and cls._resp.text != "":
return cls._resp.json()

View File

@ -133,10 +133,10 @@ class Osd(RESTController):
:return:
"""
result = CephService.send_command(
'mon', 'osd create', id=svc_id, uuid=uuid)
'mon', 'osd create', id=int(svc_id), uuid=uuid)
return {
'result': result,
'svc_id': svc_id,
'svc_id': int(svc_id),
'uuid': uuid,
}

View File

@ -47,8 +47,7 @@ class RequestLoggingTool(cherrypy.Tool):
msg = '[DASHBOARD] from=\'{}\' path=\'{}\' method=\'{}\' ' \
'user=\'{}\''.format(url, req.path_info, req.method, user)
if Settings.AUDIT_API_LOG_PAYLOAD:
params = req.params if req.params else {}
params.update(get_request_body_params(req))
params = dict(req.params or {}, **get_request_body_params(req))
# Hide sensitive data like passwords, secret keys, ...
# Extend the list of patterns to search for if necessary.
# Currently parameters like this are processed: