Fix error KeyError: 'addresses' for two tests

When we use create_test_server, waiters.wait_for_server_status
returns servers with more details (including server IP address in case
we don't use fip). It is needed successfully execute
wait_for_ssh_or_ping and finally get_server_ip. The last function
(get_server_ip) extract IP adress just from server dict and fails
if there is no adresses dict in it.

Closes-Bug: 1996468
Change-Id: Ib1157f4bb6fe42b3fbcdd3eafac0b5063d1a9e56
This commit is contained in:
Ilya Popov 2022-11-13 23:30:57 +03:00
parent edd5a4cba3
commit 2c6da1db39

View File

@ -352,6 +352,8 @@ def create_test_server(clients, validatable=False, validation_resources=None,
except Exception:
LOG.exception('Server %s failed to delete in time',
server['id'])
if servers and not multiple_create_request:
body = rest_client.ResponseBody(body.response, servers[0])
return body, servers
return body, created_servers