Skip to content

Commit 040ea98

Browse files
committed
Make migrate/30_create_from/* pass
1 parent 59eaa78 commit 040ea98

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/action/CreateIndexFromSourceTransportAction.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.elasticsearch.client.internal.Client;
1717
import org.elasticsearch.cluster.metadata.IndexMetadata;
1818
import org.elasticsearch.cluster.metadata.MappingMetadata;
19+
import org.elasticsearch.cluster.project.ProjectResolver;
1920
import org.elasticsearch.cluster.service.ClusterService;
2021
import org.elasticsearch.common.compress.CompressedXContent;
2122
import org.elasticsearch.common.settings.IndexScopedSettings;
@@ -46,6 +47,7 @@ public class CreateIndexFromSourceTransportAction extends HandledTransportAction
4647
private final ClusterService clusterService;
4748
private final Client client;
4849
private final IndexScopedSettings indexScopedSettings;
50+
private final ProjectResolver projectResolver;
4951
private static final Set<String> INDEX_BLOCK_SETTINGS = Set.of(
5052
IndexMetadata.SETTING_READ_ONLY,
5153
IndexMetadata.SETTING_READ_ONLY_ALLOW_DELETE,
@@ -60,7 +62,8 @@ public CreateIndexFromSourceTransportAction(
6062
ClusterService clusterService,
6163
ActionFilters actionFilters,
6264
Client client,
63-
IndexScopedSettings indexScopedSettings
65+
IndexScopedSettings indexScopedSettings,
66+
ProjectResolver projectResolver
6467
) {
6568
super(
6669
CreateIndexFromSourceAction.NAME,
@@ -73,12 +76,13 @@ public CreateIndexFromSourceTransportAction(
7376
this.clusterService = clusterService;
7477
this.client = client;
7578
this.indexScopedSettings = indexScopedSettings;
79+
this.projectResolver = projectResolver;
7680
}
7781

7882
@Override
7983
protected void doExecute(Task task, CreateIndexFromSourceAction.Request request, ActionListener<AcknowledgedResponse> listener) {
8084

81-
IndexMetadata sourceIndex = clusterService.state().getMetadata().getProject().index(request.sourceIndex());
85+
IndexMetadata sourceIndex = projectResolver.getProjectMetadata(clusterService.state()).index(request.sourceIndex());
8286

8387
if (sourceIndex == null) {
8488
listener.onFailure(new IndexNotFoundException(request.sourceIndex()));

x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ tasks.named("yamlRestTest").configure {
4949
'^ilm/60_operation_mode/*',
5050
'^ilm/80_health/*',
5151
'^logsdb/10_usage/*',
52-
'^migrate/30_create_from/*',
5352
'^migration/10_get_feature_upgrade_status/*',
5453
'^migration/20_post_feature_upgrade/*',
5554
'^ml/3rd_party_deployment/*',

0 commit comments

Comments
 (0)