diff --git a/novajoin_tempest_plugin/clients.py b/novajoin_tempest_plugin/clients.py index 9c009ba..4393c34 100644 --- a/novajoin_tempest_plugin/clients.py +++ b/novajoin_tempest_plugin/clients.py @@ -13,17 +13,14 @@ # the License. from tempest import clients -from tempest.common import credentials_factory as common_creds from tempest import config from tempest.lib.services import clients as cli CONF = config.CONF -ADMIN_CREDS = common_creds.get_configured_admin_credentials() - class Manager(clients.Manager): - def __init__(self, credentials=ADMIN_CREDS): + def __init__(self, credentials=None): super(Manager, self).__init__(credentials) diff --git a/novajoin_tempest_plugin/ipa/__init__.py b/novajoin_tempest_plugin/ipa/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/novajoin_tempest_plugin/services/ipa/ipa_client.py b/novajoin_tempest_plugin/ipa/ipa_client.py similarity index 96% rename from novajoin_tempest_plugin/services/ipa/ipa_client.py rename to novajoin_tempest_plugin/ipa/ipa_client.py index 0240d0b..062b91a 100644 --- a/novajoin_tempest_plugin/services/ipa/ipa_client.py +++ b/novajoin_tempest_plugin/ipa/ipa_client.py @@ -46,12 +46,18 @@ class IPABase(object): self.ntries = 1 if not ipalib_imported: return + + try: + self.keytab = CONF.keytab + except cfg.NoSuchOptError: + self.keytab = '/etc/novajoin/krb5.keytab' + self.ccache = "MEMORY:" + str(uuid.uuid4()) os.environ['KRB5CCNAME'] = self.ccache if self._ipa_client_configured() and not api.isdone('finalize'): (hostname, realm) = self.get_host_and_realm() kinit_keytab(str('nova/%s@%s' % (hostname, realm)), - CONF.keytab, self.ccache) + self.keytab, self.ccache) api.bootstrap(context='novajoin') api.finalize() self.batch_args = list() @@ -103,7 +109,7 @@ class IPABase(object): try: kinit_keytab(str('nova/%s@%s' % (api.env.host, api.env.realm)), - CONF.keytab, + self.keytab, self.ccache) except GSSError as e: LOG.debug("kinit failed: %s", e) diff --git a/novajoin_tempest_plugin/plugin.py b/novajoin_tempest_plugin/plugin.py index 3e8eff5..e5f4828 100644 --- a/novajoin_tempest_plugin/plugin.py +++ b/novajoin_tempest_plugin/plugin.py @@ -41,14 +41,3 @@ class NovajoinTempestPlugin(plugins.TempestPlugin): def get_opt_lists(self): return [('service_available', [project_config.service_option]), (project_config.ipa_group.name, project_config.IpaGroup)] - - def get_service_clients(self): - params = { - 'name': 'ipa_v4', - 'service_version': 'ipa.v4', - 'module_path': 'novajoin_tempest_plugin.services.ipa', - 'client_names': [ - 'IPAClient', - ], - } - return [params] diff --git a/novajoin_tempest_plugin/services/ipa/__init__.py b/novajoin_tempest_plugin/services/ipa/__init__.py deleted file mode 100644 index ca5c6bb..0000000 --- a/novajoin_tempest_plugin/services/ipa/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2016 Red Hat -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -from novajoin_tempest_plugin.services.ipa.ipa_client import IPAClient - -__all__ = [ - 'IPAClient' -] diff --git a/novajoin_tempest_plugin/tests/scenario/novajoin_manager.py b/novajoin_tempest_plugin/tests/scenario/novajoin_manager.py index fe738fa..9bfca46 100644 --- a/novajoin_tempest_plugin/tests/scenario/novajoin_manager.py +++ b/novajoin_tempest_plugin/tests/scenario/novajoin_manager.py @@ -12,22 +12,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import os - from oslo_log import log as logging from tempest import config +from tempest import test -from tempest import clients -from tempest.scenario import manager as mgr - +from novajoin_tempest_plugin.ipa import ipa_client CONF = config.CONF LOG = logging.getLogger(__name__) -class NovajoinScenarioTest(mgr.ScenarioTest): - credentials = ('primary', 'admin') - manager = clients.Manager(credentials) - +class NovajoinScenarioTest(test.BaseTestCase): def setUp(self): super(NovajoinScenarioTest, self).setUp() @@ -40,7 +34,7 @@ class NovajoinScenarioTest(mgr.ScenarioTest): @classmethod def setup_clients(cls): super(NovajoinScenarioTest, cls).setup_clients() - cls.ipa_client = os.ipa_v4.IPAClient + cls.ipa_client = ipa_client.IPAClient() def verify_host_registered_with_ipa(self, host): # check if specified host is registered with ipa