Skip to content

Commit

Permalink
[Fleet] Fix package policy name verification on update (#126356)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet authored Feb 24, 2022
1 parent 15756a7 commit 43a2622
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x-pack/plugins/fleet/server/services/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
doesAgentPolicyAlreadyIncludePackage,
validatePackagePolicy,
validationHasErrors,
SO_SEARCH_LIMIT,
} from '../../common';
import type {
DeletePackagePoliciesResponse,
Expand Down Expand Up @@ -369,9 +370,10 @@ class PackagePolicyService implements PackagePolicyServiceInterface {
}
// Check that the name does not exist already but exclude the current package policy
const existingPoliciesWithName = await this.list(soClient, {
perPage: 1,
kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.name: "${packagePolicy.name}"`,
perPage: SO_SEARCH_LIMIT,
kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.name:"${packagePolicy.name}"`,
});

const filtered = (existingPoliciesWithName?.items || []).filter((p) => p.id !== id);

if (filtered.length > 0) {
Expand Down

0 comments on commit 43a2622

Please sign in to comment.