Skip to content

Commit

Permalink
add uninstall token issue to Fleet non-fatal setup errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gergoabraham committed Nov 27, 2023
1 parent 827a86c commit 58bd53b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion x-pack/plugins/fleet/server/services/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import pMap from 'p-map';
import type { ElasticsearchClient, SavedObjectsClientContract } from '@kbn/core/server';
import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common/constants';

import type { UninstallTokenError } from '../../common/errors';

import { AUTO_UPDATE_PACKAGES } from '../../common/constants';
import type { PreconfigurationError } from '../../common/constants';
import type {
Expand Down Expand Up @@ -58,7 +60,10 @@ import { cleanUpOldFileIndices } from './setup/clean_old_fleet_indices';
export interface SetupStatus {
isInitialized: boolean;
nonFatalErrors: Array<
PreconfigurationError | DefaultPackagesInstallationError | UpgradeManagedPackagePoliciesResult
| PreconfigurationError
| DefaultPackagesInstallationError
| UpgradeManagedPackagePoliciesResult
| { error: UninstallTokenError }
>;
}

Expand Down Expand Up @@ -182,6 +187,13 @@ async function createSetupSideEffects(
await appContextService.getUninstallTokenService()?.encryptTokens();
}

logger.debug('Checking validity of Uninstall Tokens');
try {
await appContextService.getUninstallTokenService()?.checkTokenValidityForAllPolicies();
} catch (error) {
nonFatalErrors.push({ error });
}

logger.debug('Upgrade Agent policy schema version');
await upgradeAgentPolicySchemaVersion(soClient);

Expand Down

0 comments on commit 58bd53b

Please sign in to comment.