Fix server topology and diagnostics

Server topology assumed that the response from a topology request
included a top-level topology attribute, which actually does not exist.
Server diagnostics expected that server_id was a body field, but it is
actually a URI field.

Change-Id: I18baf1a8c39c5f150b64ce9c0d8944214c9e8024
This commit is contained in:
Daniel Wilson
2022-11-12 13:38:36 -05:00
parent 374f647a05
commit 1ea95cb04e
3 changed files with 3 additions and 7 deletions

View File

@@ -596,9 +596,7 @@ class Server(resource.Resource, metadata.MetadataMixin, tag.TagMixin):
exceptions.raise_from_response(response)
try:
data = response.json()
if 'topology' in data:
return data['topology']
return response.json()
except ValueError:
pass

View File

@@ -51,4 +51,4 @@ class ServerDiagnostics(resource.Resource):
#: The list of dictionaries with detailed information about VM NICs.
nic_details = resource.Body('nic_details')
#: The ID for the server.
server_id = resource.Body('server_id')
server_id = resource.URI('server_id')

View File

@@ -1097,9 +1097,7 @@ class TestServer(base.TestCase):
}
response.status_code = 200
response.json.return_value = {
'topology': topology
}
response.json.return_value = topology
self.sess.get.return_value = response