Remove norelease and adjust audit logging

Audit logging in wrong location.  Norelease removed because the proper solution
will take some more work, and this edge-case is not likely to be run into frequently.

More details in elastic/x-pack-elasticsearch#818

Original commit: elastic/x-pack-elasticsearch@ab0d731abf
This commit is contained in:
Zachary Tong 2017-03-23 12:41:33 -04:00
parent fba5c09e3d
commit cf6bca96db
1 changed files with 2 additions and 5 deletions

View File

@ -168,9 +168,6 @@ public class DeleteModelSnapshotAction extends Action<DeleteModelSnapshotAction.
ModelSnapshot deleteCandidate = deleteCandidates.get(0); ModelSnapshot deleteCandidate = deleteCandidates.get(0);
// Verify the snapshot is not being used // Verify the snapshot is not being used
//
// NORELEASE: technically, this could be stale and refuse a delete, but I think that's acceptable
// since it is non-destructive
QueryPage<Job> job = jobManager.getJob(request.getJobId(), clusterService.state()); QueryPage<Job> job = jobManager.getJob(request.getJobId(), clusterService.state());
if (job.count() > 0) { if (job.count() > 0) {
String currentModelInUse = job.results().get(0).getModelSnapshotId(); String currentModelInUse = job.results().get(0).getModelSnapshotId();
@ -186,6 +183,8 @@ public class DeleteModelSnapshotAction extends Action<DeleteModelSnapshotAction.
deleter.commit(new ActionListener<BulkResponse>() { deleter.commit(new ActionListener<BulkResponse>() {
@Override @Override
public void onResponse(BulkResponse bulkResponse) { public void onResponse(BulkResponse bulkResponse) {
auditor.info(request.getJobId(), Messages.getMessage(Messages.JOB_AUDIT_SNAPSHOT_DELETED,
deleteCandidate.getDescription()));
// We don't care about the bulk response, just that it succeeded // We don't care about the bulk response, just that it succeeded
listener.onResponse(new DeleteModelSnapshotAction.Response(true)); listener.onResponse(new DeleteModelSnapshotAction.Response(true));
} }
@ -196,8 +195,6 @@ public class DeleteModelSnapshotAction extends Action<DeleteModelSnapshotAction.
} }
}); });
auditor.info(request.getJobId(), Messages.getMessage(Messages.JOB_AUDIT_SNAPSHOT_DELETED,
deleteCandidate.getDescription()));
}, listener::onFailure); }, listener::onFailure);
} }
} }