Fix IPA client and creds problem

This commit is contained in:
Ade Lee 2017-08-08 13:36:58 +00:00
parent 4df347c612
commit ff9395ce6e
6 changed files with 13 additions and 46 deletions

View File

@ -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)

View File

View File

@ -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)

View File

@ -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]

View File

@ -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'
]

View File

@ -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