changed file handling

This commit is contained in:
jenkins-x-bot 2020-01-13 22:46:34 +02:00
parent cad56c813e
commit 8d957f22af
1 changed files with 6 additions and 4 deletions

View File

@ -109,8 +109,9 @@ class VaultSourcePlugin(SourcePlugin):
client.token = token client.token = token
if auth_method == 'kubernetes': if auth_method == 'kubernetes':
f = open('/var/run/secrets/kubernetes.io/serviceaccount/token') token_path = '/var/run/secrets/kubernetes.io/serviceaccount/token'
jwt = f.read() with open(token_path, 'r') as f:
jwt = f.read()
client.auth_kubernetes(auth_key, jwt) client.auth_kubernetes(auth_key, jwt)
client.secrets.kv.default_kv_version = api_version client.secrets.kv.default_kv_version = api_version
@ -277,8 +278,9 @@ class VaultDestinationPlugin(DestinationPlugin):
client.token = token client.token = token
if auth_method == 'kubernetes': if auth_method == 'kubernetes':
f = open('/var/run/secrets/kubernetes.io/serviceaccount/token') token_path = '/var/run/secrets/kubernetes.io/serviceaccount/token'
jwt = f.read() with open(token_path, 'r') as f:
jwt = f.read()
client.auth_kubernetes(auth_key, jwt) client.auth_kubernetes(auth_key, jwt)
client.secrets.kv.default_kv_version = api_version client.secrets.kv.default_kv_version = api_version