Skip to content

Commit

Permalink
[Fleet] Package policy bulkUpdate call isSecretStorageEnabled only on…
Browse files Browse the repository at this point in the history
…ce (elastic#190256)

## Summary

Package policy bulkUpdate call isSecretStorageEnabled only once !!
  • Loading branch information
shahzad31 authored Aug 9, 2024
1 parent dbe2139 commit aa3b89f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x-pack/plugins/fleet/server/services/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,8 @@ class PackagePolicyClientImpl implements PackagePolicyClient {
error: Error | SavedObjectError;
}> = [];

const secretStorageEnabled = await isSecretStorageEnabled(esClient, soClient);

await pMap(packagePolicyUpdates, async (packagePolicyUpdate) => {
try {
const id = packagePolicyUpdate.id;
Expand Down Expand Up @@ -1076,7 +1078,7 @@ class PackagePolicyClientImpl implements PackagePolicyClient {
if (pkgInfoAndAsset) {
const { pkgInfo, assetsMap } = pkgInfoAndAsset;
validatePackagePolicyOrThrow(packagePolicy, pkgInfo);
if (await isSecretStorageEnabled(esClient, soClient)) {
if (secretStorageEnabled) {
const secretsRes = await extractAndUpdateSecrets({
oldPackagePolicy,
packagePolicyUpdate: { ...restOfPackagePolicy, inputs },
Expand Down

0 comments on commit aa3b89f

Please sign in to comment.