From ebdc6be5d2e42b4bb66dcedaaa22a7642c9edd9d Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Tue, 23 Jul 2024 12:15:31 -0400 Subject: [PATCH] [Fleet] Fix get one agent when feature flag disabled (#188953) --- x-pack/plugins/fleet/server/routes/agent/handlers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x-pack/plugins/fleet/server/routes/agent/handlers.ts b/x-pack/plugins/fleet/server/routes/agent/handlers.ts index 6f1ac12edb163..52a0540c384fa 100644 --- a/x-pack/plugins/fleet/server/routes/agent/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/handlers.ts @@ -45,8 +45,12 @@ import { defaultFleetErrorHandler, FleetNotFoundError } from '../../errors'; import * as AgentService from '../../services/agents'; import { fetchAndAssignAgentMetrics } from '../../services/agents/agent_metrics'; import { getAgentStatusForAgentPolicy } from '../../services/agents'; +import { appContextService } from '../../services'; export function verifyNamespace(agent: Agent, currentNamespace?: string) { + if (!appContextService.getExperimentalFeatures().useSpaceAwareness) { + return; + } const isInNamespace = (currentNamespace && agent.namespaces?.includes(currentNamespace)) || (!currentNamespace &&