use socket.gethostname() in krb5 test

This commit is contained in:
Max Erenberg 2021-08-20 01:57:53 +00:00
parent dc09210d23
commit 14c058eb67
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import os
import socket
import subprocess
from subprocess import DEVNULL
import tempfile
@ -11,6 +12,7 @@ from ceo_common.krb5.utils import get_fwd_tgt, store_fwd_tgt_creds
def test_fwd_tgt(cfg):
realm = cfg.get('ldap_sasl_realm')
ldap_server = cfg.get('ldap_server_url')
hostname = socket.gethostname()
old_krb5ccname = os.environ['KRB5CCNAME']
f1 = tempfile.NamedTemporaryFile()
d2 = tempfile.TemporaryDirectory()
@ -23,7 +25,7 @@ def test_fwd_tgt(cfg):
['kinit', '-c', 'DIR:' + d2.name, 'ctdalek'],
text=True, input='krb5', check=True, stdout=DEVNULL)
os.environ['KRB5CCNAME'] = 'FILE:' + f1.name
b = get_fwd_tgt('phosphoric-acid')
b = get_fwd_tgt(hostname)
os.environ['KRB5CCNAME'] = 'DIR:' + d2.name
# make sure that we can import the creds from regular1 into the
# cache collection