Fallback to creds provider for fixed IP network if no network_for_ssh
When using fixed IPs for ssh and dynamic credentials and network tenant isolation, if network_for_ssh is not set attempt to just lookup the proper address to use from the server using the network resource that's stashed in the credentials provider. Change-Id: I045bdf6a8e3b22293a3c804538aed7c75cb36180 Closes-Bug: #1611100
This commit is contained in:
parent
e07579c603
commit
a7782552ba
|
@ -665,9 +665,20 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
|||
# method is creating the floating IP there.
|
||||
return self.create_floating_ip(server)['ip']
|
||||
elif CONF.validation.connect_method == 'fixed':
|
||||
addresses = server['addresses'][CONF.validation.network_for_ssh]
|
||||
# Determine the network name to look for based on config or creds
|
||||
# provider network resources.
|
||||
if CONF.validation.network_for_ssh:
|
||||
addresses = server['addresses'][
|
||||
CONF.validation.network_for_ssh]
|
||||
else:
|
||||
creds_provider = self._get_credentials_provider()
|
||||
net_creds = creds_provider.get_primary_creds()
|
||||
network = getattr(net_creds, 'network', None)
|
||||
addresses = (server['addresses'][network['name']]
|
||||
if network else [])
|
||||
for address in addresses:
|
||||
if address['version'] == CONF.validation.ip_version_for_ssh:
|
||||
if (address['version'] == CONF.validation.ip_version_for_ssh
|
||||
and address['OS-EXT-IPS:type'] == 'fixed'):
|
||||
return address['addr']
|
||||
raise exceptions.ServerUnreachable(server_id=server['id'])
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue