check for active fleet servers (#207920)

## Summary

The Upgrade Assistant deprecations for Native Connectors -> Agentless
Connectors care about if Fleet Server is _actively_ running, but it
seems that the check we're using is whether one was _ever_ running. This
change introduces an optional `activeOnly` param to `hasFleetServer`,
and uses it for these deprecations.
This commit is contained in:
Sean Story 2025-01-22 16:33:59 -06:00 committed by GitHub
parent ae8be0d485
commit 3fde9d6ae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -86,16 +86,19 @@ export const hasFleetServersForPolicies = async (
};
/**
* Check if at least one fleet server agent exists, regardless of its online status
* Check if at least one fleet server agent exists.
* `activeOnly` flag can be used to filter only active agents.
*/
export async function hasFleetServers(
esClient: ElasticsearchClient,
soClient: SavedObjectsClientContract
soClient: SavedObjectsClientContract,
activeOnly: boolean = false
) {
return await hasFleetServersForPolicies(
esClient,
soClient,
await getFleetServerPolicies(soClient)
await getFleetServerPolicies(soClient),
activeOnly
);
}

View file

@ -55,7 +55,8 @@ export const getRegisteredDeprecations = (
const hasAgentless = isAgentlessEnabled();
const hasFleetServer = await hasFleetServers(
ctx.esClient.asInternalUser,
ctx.savedObjectsClient
ctx.savedObjectsClient,
true // only counts if the Fleet Server is active
);
const entSearchDetails = getEnterpriseSearchNodeDeprecation(config, cloud, docsUrl);
const [crawlerDetails, nativeConnectorsDetails] = await Promise.all([