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
This commit is contained in:
parent
db3da24c61
commit
d26117be23
|
@ -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',
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue