Tweak logic to allow Deletes on already-deleting job (elastic/elasticsearch#658)

Original commit: elastic/x-pack-elasticsearch@5352cba1e7
This commit is contained in:
Zachary Tong 2017-01-06 10:07:28 -05:00 committed by GitHub
parent 3c3509d397
commit ae8695a22d
1 changed files with 6 additions and 2 deletions

View File

@ -363,9 +363,13 @@ public class PrelertMetadata implements MetaData.Custom {
}
}
// Once a job goes into Deleting, it cannot be changed
if (previous.getStatus().equals(JobStatus.DELETING)) {
// If we're already Deleting there's nothing to do
if (jobStatus.equals(JobStatus.DELETING)) {
return this;
}
// Once a job goes into Deleting, it cannot be changed
throw new ElasticsearchStatusException("Cannot change status of job [" + jobId + "] to [" + jobStatus + "] because " +
"it is currently in [" + JobStatus.DELETING + "] status.", RestStatus.CONFLICT);
}