Skip to content

Commit

Permalink
[Fleet] Fix policy revision number getting bumped for no reason
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Jul 7, 2021
1 parent e01e682 commit a5fb603
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/fleet/server/services/preconfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { ElasticsearchClient, SavedObjectsClientContract } from 'src/core/server';
import { i18n } from '@kbn/i18n';
import { groupBy, omit, isEqual } from 'lodash';
import { groupBy, omit, pick, isEqual } from 'lodash';

import type {
NewPackagePolicy,
Expand Down Expand Up @@ -143,7 +143,8 @@ export async function ensurePreconfiguredPackagesAndPolicies(
if (!created) {
if (!policy?.is_managed) return { created, policy };
const configTopLevelFields = omit(preconfiguredAgentPolicy, 'package_policies', 'id');
const currentTopLevelFields = omit(policy, 'package_policies');
const currentTopLevelFields = pick(policy, ...Object.keys(configTopLevelFields));

if (!isEqual(configTopLevelFields, currentTopLevelFields)) {
const updatedPolicy = await agentPolicyService.update(
soClient,
Expand Down

0 comments on commit a5fb603

Please sign in to comment.