[ML][Data Frame] Adjusting error message (#43455) (#43580)

* Adjusting error message

* Update TransportPutDataFrameTransformAction.java

* Update TransportPutDataFrameTransformAction.java
This commit is contained in:
Benjamin Trent 2019-06-25 10:09:39 -05:00 committed by GitHub
parent 66693c2706
commit 970e157eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 12 deletions

View File

@ -25,8 +25,6 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.license.LicenseUtils;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData;
@ -233,17 +231,16 @@ public class TransportPutDataFrameTransformAction
if (privilegesResponse.isCompleteMatch()) {
putDataFrame(config, listener);
} else {
XContentBuilder builder = JsonXContent.contentBuilder();
builder.startObject();
for (ResourcePrivileges index : privilegesResponse.getIndexPrivileges()) {
builder.field(index.getResource());
builder.map(index.getPrivileges());
}
builder.endObject();
List<String> indices = privilegesResponse.getIndexPrivileges()
.stream()
.map(ResourcePrivileges::getResource)
.collect(Collectors.toList());
listener.onFailure(Exceptions.authorizationError("Cannot create data frame transform [{}]" +
" because user {} lacks permissions on the indices: {}",
config.getId(), username, Strings.toString(builder)));
listener.onFailure(Exceptions.authorizationError(
"Cannot create data frame transform [{}] because user {} lacks all the required permissions for indices: {}",
config.getId(),
username,
indices));
}
}