|
@@ -303,6 +303,8 @@ class KerberosScript(Script):
|
|
|
@staticmethod
|
|
|
def test_kinit(identity, user=None):
|
|
|
principal = get_property_value(identity, 'principal')
|
|
|
+ kinit_path_local = functions.get_kinit_path()
|
|
|
+ kdestroy_path_local = functions.get_kdestroy_path()
|
|
|
|
|
|
if principal is not None:
|
|
|
keytab_file = get_property_value(identity, 'keytab_file')
|
|
@@ -311,11 +313,11 @@ class KerberosScript(Script):
|
|
|
|
|
|
# If a test keytab file is available, simply use it
|
|
|
if (keytab_file is not None) and (os.path.isfile(keytab_file)):
|
|
|
- command = 'kinit -k -t %s %s' % (keytab_file, principal)
|
|
|
+ command = '%s -k -t %s %s' % (kinit_path_local, keytab_file, principal)
|
|
|
Execute(command,
|
|
|
user = user,
|
|
|
)
|
|
|
- return shell.checked_call('kdestroy')
|
|
|
+ return shell.checked_call(kdestroy_path_local)
|
|
|
|
|
|
# If base64-encoded test keytab data is available; then decode it, write it to a temporary file
|
|
|
# use it, and then remove the temporary file
|
|
@@ -325,11 +327,11 @@ class KerberosScript(Script):
|
|
|
os.close(fd)
|
|
|
|
|
|
try:
|
|
|
- command = 'kinit -k -t %s %s' % (test_keytab_file, principal)
|
|
|
+ command = '%s -k -t %s %s' % (kinit_path_local, test_keytab_file, principal)
|
|
|
Execute(command,
|
|
|
user = user,
|
|
|
)
|
|
|
- return shell.checked_call('kdestroy')
|
|
|
+ return shell.checked_call(kdestroy_path_local)
|
|
|
except:
|
|
|
raise
|
|
|
finally:
|
|
@@ -338,13 +340,13 @@ class KerberosScript(Script):
|
|
|
|
|
|
# If no keytab data is available and a password was supplied, simply use it.
|
|
|
elif password is not None:
|
|
|
- process = subprocess.Popen(['kinit', principal], stdin=subprocess.PIPE)
|
|
|
+ process = subprocess.Popen([kinit_path_local, principal], stdin=subprocess.PIPE)
|
|
|
stdout, stderr = process.communicate(password)
|
|
|
if process.returncode:
|
|
|
err_msg = Logger.filter_text("Execution of kinit returned %d. %s" % (process.returncode, stderr))
|
|
|
raise Fail(err_msg)
|
|
|
else:
|
|
|
- return shell.checked_call('kdestroy')
|
|
|
+ return shell.checked_call(kdestroy_path_local)
|
|
|
else:
|
|
|
return 0, ''
|
|
|
else:
|