[Fleet] Do not reassign actions space (#207381)

This commit is contained in:
Nicolas Chaulet 2025-01-22 08:24:20 -05:00 committed by GitHub
parent 2481edcc28
commit 24bab86aef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 21 deletions

View file

@ -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);

View file

@ -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]);