From 4ec835b683ca1fc6862eb0e2fecb75a376b8e1bf Mon Sep 17 00:00:00 2001 From: Paulo Silva Date: Thu, 7 Nov 2024 06:32:47 -0800 Subject: [PATCH] [Agentless] Fix agentless global_data_tags (#199247) --- .../services/agents/agentless_agent.test.ts | 16 ++++++++++------ .../server/services/agents/agentless_agent.ts | 8 +++++--- .../agentless_api/create_agent.ts | 2 -- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/fleet/server/services/agents/agentless_agent.test.ts b/x-pack/plugins/fleet/server/services/agents/agentless_agent.test.ts index fe8b7a220470d..b278cda4fc278 100644 --- a/x-pack/plugins/fleet/server/services/agents/agentless_agent.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/agentless_agent.test.ts @@ -814,9 +814,11 @@ describe('Agentless Agent service', () => { policy_id: 'mocked-agentless-agent-policy-id', stack_version: 'mocked-kibana-version-infinite', labels: { - organization: 'elastic', - division: 'cloud', - team: 'fleet', + owner: { + org: 'elastic', + division: 'cloud', + team: 'fleet', + }, }, }), headers: expect.anything(), @@ -911,9 +913,11 @@ describe('Agentless Agent service', () => { fleet_url: 'http://fleetserver:8220', policy_id: 'mocked-agentless-agent-policy-id', labels: { - organization: 'elastic', - division: 'cloud', - team: 'fleet', + owner: { + org: 'elastic', + division: 'cloud', + team: 'fleet', + }, }, }, headers: expect.anything(), diff --git a/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts b/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts index 7400b5958eb65..314af0ada7bf4 100644 --- a/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts +++ b/x-pack/plugins/fleet/server/services/agents/agentless_agent.ts @@ -220,9 +220,11 @@ class AgentlessAgentService { agentlessAgentPolicy.global_data_tags?.find((tag) => tag.name === name)?.value; return { - organization: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_ORGANIZATION), - division: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_DIVISION), - team: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_TEAM), + owner: { + org: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_ORGANIZATION), + division: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_DIVISION), + team: getGlobalTagValueByName(AGENTLESS_GLOBAL_TAG_NAME_TEAM), + }, }; } diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts index 6d0686e189572..b26581fb46dfd 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/agentless_api/create_agent.ts @@ -25,8 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const AWS_SINGLE_ACCOUNT_TEST_ID = 'awsSingleTestId'; describe('Agentless API Serverless', function () { - // see details: https://github.com/elastic/kibana/issues/199091 - this.tags(['failsOnMKI']); let mockApiServer: http.Server; let cisIntegration: typeof pageObjects.cisAddIntegration;