From a9f7794b15aeebe04ae4c257836d2cdcf68a62a4 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Fri, 11 Oct 2024 12:02:35 +0200 Subject: [PATCH] tempest: Refactor _add_application_ips. Perform repetitive task in loop on input data rather than repeating the same call three times in the code. Signed-off-by: Frode Nordahl --- zaza/openstack/charm_tests/tempest/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zaza/openstack/charm_tests/tempest/utils.py b/zaza/openstack/charm_tests/tempest/utils.py index b30f187..eaf2b65 100644 --- a/zaza/openstack/charm_tests/tempest/utils.py +++ b/zaza/openstack/charm_tests/tempest/utils.py @@ -217,9 +217,10 @@ def _add_application_ips(ctxt): :returns: None :rtype: None """ - ctxt['keystone'] = juju_utils.get_application_ip('keystone') - ctxt['dashboard'] = juju_utils.get_application_ip('openstack-dashboard') - ctxt['ncc'] = juju_utils.get_application_ip('nova-cloud-controller') + for ctxt_key, application_name in (('keystone', 'keystone'), + ('dashboard', 'openstack-dashboard'), + ('ncc', 'nova-cloud-controller')): + ctxt[ctxt_key] = zaza_juju_utils.get_application_ip(application_name) def _add_nova_config(ctxt, keystone_session, missing_fatal=True):