mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Fleet] Do not reassign actions space (#207381)
This commit is contained in:
parent
2481edcc28
commit
24bab86aef
2 changed files with 2 additions and 21 deletions
|
@ -11,7 +11,6 @@ import type { SortResults } from '@elastic/elasticsearch/lib/api/types';
|
|||
|
||||
import {
|
||||
AGENTS_INDEX,
|
||||
AGENT_ACTIONS_INDEX,
|
||||
AGENT_POLICY_SAVED_OBJECT_TYPE,
|
||||
PACKAGE_POLICY_SAVED_OBJECT_TYPE,
|
||||
SO_SEARCH_LIMIT,
|
||||
|
@ -197,24 +196,6 @@ export async function updateAgentPolicySpaces({
|
|||
|
||||
const lastAgent = agents[agents.length - 1];
|
||||
searchAfter = lastAgent.sort;
|
||||
|
||||
await esClient.updateByQuery({
|
||||
index: AGENT_ACTIONS_INDEX,
|
||||
query: {
|
||||
bool: {
|
||||
must: {
|
||||
terms: {
|
||||
agents: agents.map(({ id }) => id),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
script: `ctx._source.namespaces = [${newSpaceIds
|
||||
.map((spaceId) => `"${spaceId}"`)
|
||||
.join(',')}]`,
|
||||
ignore_unavailable: true,
|
||||
refresh: true,
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
await closePointInTime(esClient, pitId);
|
||||
|
|
|
@ -234,7 +234,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
await assertAgentSpaces(policy1AgentId, ['default', TEST_SPACE_1]);
|
||||
await assertAgentSpaces(policy2AgentId, ['default']);
|
||||
|
||||
await assertActionSpaces(agent1ActionId, ['default', TEST_SPACE_1]);
|
||||
await assertActionSpaces(agent1ActionId, ['default']);
|
||||
await assertActionSpaces(agent2ActionId, ['default']);
|
||||
|
||||
await assertEnrollemntApiKeysForSpace('default', [
|
||||
|
@ -262,7 +262,7 @@ export default function (providerContext: FtrProviderContext) {
|
|||
await assertAgentSpaces(policy1AgentId, [TEST_SPACE_1]);
|
||||
await assertAgentSpaces(policy2AgentId, ['default']);
|
||||
|
||||
await assertActionSpaces(agent1ActionId, [TEST_SPACE_1]);
|
||||
await assertActionSpaces(agent1ActionId, ['default']);
|
||||
await assertActionSpaces(agent2ActionId, ['default']);
|
||||
|
||||
await assertEnrollemntApiKeysForSpace('default', [defaultSpacePolicy2.item.id]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue