Skip to content

Commit

Permalink
Fix Chronos job deletion (don't fail if the job doesn't exist)
Browse files Browse the repository at this point in the history
See #34
  • Loading branch information
lorenzo-biava committed May 25, 2016
1 parent 51790e3 commit 7b35d92
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,15 @@ protected boolean deleteJobsOnChronos(Deployment deployment,
currentJob = job;

try {
client.deleteJob(job.getChronosJob().getName());
LOG.debug("Deleted job on Chronos: name <{}>", currentJob.getChronosJob().getName());
String jobName = job.getChronosJob().getName();

// Chronos API hack (to avoid error 400 if the job to delete does not exist)
if (getJobStatus(client, jobName) == null) {
LOG.debug("Job on Chronos does not exist: name <{}>", jobName);
} else {
client.deleteJob(jobName);
LOG.debug("Deleted job on Chronos: name <{}>", jobName);
}
} catch (ChronosException ce) {
// Just log the error
String errorMsg = String.format("Failed to delete job <%s> on Chronos. Status Code: <%s>",
Expand Down

0 comments on commit 7b35d92

Please sign in to comment.