From d26117be230188d295d815bc7efe4f8abdd0a4f8 Mon Sep 17 00:00:00 2001 From: Grzegorz Grasza Date: Fri, 12 Apr 2019 10:55:21 +0200 Subject: [PATCH] Default to user home directory to read krb5.keytab This caused issues with zuul jobs, because the user home directories differ. This also removes hardcoded path from ipa_client.py and throws a nicer exception if the file is not there. Change-Id: I6188fe40af1bc5c6549767f45a0acc9f554e5b1e --- novajoin_tempest_plugin/config.py | 4 +++- novajoin_tempest_plugin/ipa/ipa_client.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/novajoin_tempest_plugin/config.py b/novajoin_tempest_plugin/config.py index bbab9d2..1918a2b 100644 --- a/novajoin_tempest_plugin/config.py +++ b/novajoin_tempest_plugin/config.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +import os + from oslo_config import cfg service_option = cfg.BoolOpt("novajoin", @@ -29,7 +31,7 @@ NovajoinGroup = [ default='vm', help='Flavor tag to use in novajoin enrollment tests'), cfg.StrOpt('keytab', - default='/home/stack/novajoin.keytab', + default=os.path.expanduser('~/novajoin.keytab'), help='Keytab to connect to IPA as the novajoin user'), cfg.StrOpt('tripleo', default='True', diff --git a/novajoin_tempest_plugin/ipa/ipa_client.py b/novajoin_tempest_plugin/ipa/ipa_client.py index 9394c80..cb86fe8 100644 --- a/novajoin_tempest_plugin/ipa/ipa_client.py +++ b/novajoin_tempest_plugin/ipa/ipa_client.py @@ -51,9 +51,12 @@ class IPABase(object): except cfg.NoSuchOptError: self.keytab = '/etc/novajoin/krb5.keytab' + with open(self.keytab): + pass # Throw a nicer exception if krb5.keytab does not exist + self.ccache = "MEMORY:" + str(uuid.uuid4()) os.environ['KRB5CCNAME'] = self.ccache - os.environ['KRB5_CLIENT_KTNAME'] = '/home/stack/krb5.keytab' + os.environ['KRB5_CLIENT_KTNAME'] = self.keytab if self._ipa_client_configured() and not api.isdone('finalize'): api.bootstrap(context='novajoin') api.finalize()