Merge "Default to user home directory to read krb5.keytab"

This commit is contained in:
Zuul 2019-05-03 16:08:59 +00:00 committed by Gerrit Code Review
commit 35d07534e0
2 changed files with 7 additions and 2 deletions

View File

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

View File

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