Tweak logic to allow Deletes on already-deleting job (elastic/elasticsearch#658)
Original commit: elastic/x-pack-elasticsearch@5352cba1e76f7d8396945c5192db109cc6fc5020
@@ -363,9 +363,13 @@ public class PrelertMetadata implements MetaData.Custom {
}
}
+ 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
- if (previous.getStatus().equals(JobStatus.DELETING)) {
throw new ElasticsearchStatusException("Cannot change status of job [" + jobId + "] to [" + jobStatus + "] because " +
"it is currently in [" + JobStatus.DELETING + "] status.", RestStatus.CONFLICT);
}
