Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Do not reassign actions space #207381

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down Expand Up @@ -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]);
Expand Down
Loading