1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Check kinit and kdestroy for errors

This commit is contained in:
Игорь Чудов 2020-06-30 21:16:29 +04:00
parent adf4ca4614
commit 883ee62017
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -32,8 +32,18 @@ def machine_kinit(cache_name=None):
kinit_cmd = ['kinit', '-k', host]
if cache_name:
kinit_cmd.extend(['-c', cache_name])
subprocess.call(kinit_cmd)
return check_krb_ticket()
proc = subprocess.Popen(kinit_cmd)
proc.wait()
result = False
if 0 == proc.returncode:
result = True
if result:
result = check_krb_ticket()
return result
def machine_kdestroy(cache_name=None):
@ -44,7 +54,9 @@ def machine_kdestroy(cache_name=None):
kdestroy_cmd = ['kdestroy']
if cache_name:
kdestroy_cmd.extend(['-c', cache_name])
subprocess.call(kdestroy_cmd)
proc = subprocess.Popen(kdestroy_cmd)
proc.wait()
if cache_name and os.path.exists(cache_name):
os.unlink(cache_name)