Skip to content

Commit

Permalink
fix(provider/kubernetes): Fixed an issue with jobProvider failing out…
Browse files Browse the repository at this point in the history
… other providers.
  • Loading branch information
TT044106 committed Jun 22, 2017
1 parent 3cce38d commit 43688c3
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ class KubernetesJobProvider implements JobProvider<KubernetesJobStatus> {

@Override
KubernetesJobStatus collectJob(String account, String location, String id) {
def credentials = ((KubernetesNamedAccountCredentials) accountCredentialsProvider.getCredentials(account)).credentials
def status = new KubernetesJobStatus(credentials.apiAdaptor.getPod(location, id), account)
def credentials = accountCredentialsProvider.getCredentials(account).credentials
if (!credentials instanceof KubernetesNamedAccountCredentials) {
return null
}
def trueCredentials = credentials as KubernetesNamedAccountCredentials
def status = new KubernetesJobStatus(trueCredentials.apiAdaptor.getPod(location, id), account)
if (status.jobState in [JobState.Failed, JobState.Succeeded]) {
credentials.apiAdaptor.deletePod(location, id)
trueCredentials.apiAdaptor.deletePod(location, id)
}
return status
}
Expand Down

0 comments on commit 43688c3

Please sign in to comment.