mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -03:30
Merge pull request #9744 from shanemcd/fix-k8s-ca
Fix k8s credentials that use a custom ca cert Reviewed-by: Elijah DeLee <kdelee@redhat.com>
This commit is contained in:
@@ -115,6 +115,6 @@ def kubernetes_bearer_token(cred, env, private_data_dir):
|
|||||||
with os.fdopen(handle, 'w') as f:
|
with os.fdopen(handle, 'w') as f:
|
||||||
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR)
|
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR)
|
||||||
f.write(cred.get_input('ssl_ca_cert'))
|
f.write(cred.get_input('ssl_ca_cert'))
|
||||||
env['K8S_AUTH_SSL_CA_CERT'] = path
|
env['K8S_AUTH_SSL_CA_CERT'] = os.path.join('/runner', os.path.basename(path))
|
||||||
else:
|
else:
|
||||||
env['K8S_AUTH_VERIFY_SSL'] = 'False'
|
env['K8S_AUTH_VERIFY_SSL'] = 'False'
|
||||||
|
|||||||
@@ -1003,7 +1003,8 @@ class TestJobCredentials(TestJobExecution):
|
|||||||
|
|
||||||
if verify:
|
if verify:
|
||||||
assert env['K8S_AUTH_VERIFY_SSL'] == 'True'
|
assert env['K8S_AUTH_VERIFY_SSL'] == 'True'
|
||||||
cert = open(env['K8S_AUTH_SSL_CA_CERT'], 'r').read()
|
local_path = os.path.join(private_data_dir, os.path.basename(env['K8S_AUTH_SSL_CA_CERT']))
|
||||||
|
cert = open(local_path, 'r').read()
|
||||||
assert cert == 'CERTDATA'
|
assert cert == 'CERTDATA'
|
||||||
else:
|
else:
|
||||||
assert env['K8S_AUTH_VERIFY_SSL'] == 'False'
|
assert env['K8S_AUTH_VERIFY_SSL'] == 'False'
|
||||||
|
|||||||
Reference in New Issue
Block a user