From 94c52304138a94cac2e20d9e65d3eecd9cb88a13 Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Fri, 10 Mar 2017 16:16:14 +0200 Subject: [PATCH] Do not load credentials on import in tempest plugin clients.py Set the ADMIN_CREDS global variable inside the Manager class constructor instead of doing it on module import. Change-Id: I8c82fa077f316c747a37e31980f7c2d74986bad2 Closes-Bug: 1671813 --- ironic_tempest_plugin/clients.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ironic_tempest_plugin/clients.py b/ironic_tempest_plugin/clients.py index c491c7759d..2b81878002 100644 --- a/ironic_tempest_plugin/clients.py +++ b/ironic_tempest_plugin/clients.py @@ -22,17 +22,22 @@ from ironic_tempest_plugin.services.baremetal.v1.json.baremetal_client import \ CONF = config.CONF -ADMIN_CREDS = common_creds.get_configured_admin_credentials() +ADMIN_CREDS = None class Manager(clients.Manager): def __init__(self, - credentials=ADMIN_CREDS): + credentials=None): """Initialization of Manager class. Setup service client and make it available for test cases. :param credentials: type Credentials or TestResources """ + if credentials is None: + global ADMIN_CREDS + if ADMIN_CREDS is None: + ADMIN_CREDS = common_creds.get_configured_admin_credentials() + credentials = ADMIN_CREDS super(Manager, self).__init__(credentials) default_params_with_timeout_values = { 'build_interval': CONF.compute.build_interval,