diff --git a/package.json b/package.json index 0db689f1f3433..20613741aa8e6 100644 --- a/package.json +++ b/package.json @@ -614,7 +614,7 @@ "react-fast-compare": "^2.0.4", "react-focus-on": "^3.7.0", "react-grid-layout": "^1.3.4", - "react-hook-form": "^7.39.5", + "react-hook-form": "^7.39.7", "react-intl": "^2.8.0", "react-is": "^17.0.2", "react-markdown": "^6.0.3", diff --git a/x-pack/plugins/osquery/server/lib/update_global_packs.ts b/x-pack/plugins/osquery/server/lib/update_global_packs.ts index 40e08ad92d9a2..e0ff7b1fcffe2 100644 --- a/x-pack/plugins/osquery/server/lib/update_global_packs.ts +++ b/x-pack/plugins/osquery/server/lib/update_global_packs.ts @@ -50,43 +50,46 @@ export const updateGlobalPacksCreateCallback = async ( }); }); - await Promise.all( - map(packsContainingShardForPolicy, (pack) => { - packsClient.update( - packSavedObjectType, - pack.id, - {}, - { - references: [ - ...pack.references, - { - id: packagePolicy.policy_id, - name: agentPolicies[packagePolicy.policy_id]?.name, - type: AGENT_POLICY_SAVED_OBJECT_TYPE, - }, - ], + if (packsContainingShardForPolicy.length) { + await Promise.all( + map(packsContainingShardForPolicy, (pack) => { + packsClient.update( + packSavedObjectType, + pack.id, + {}, + { + references: [ + ...pack.references, + { + id: packagePolicy.policy_id, + name: agentPolicies[packagePolicy.policy_id]?.name, + type: AGENT_POLICY_SAVED_OBJECT_TYPE, + }, + ], + } + ); + }) + ); + + await packagePolicyService?.update( + packsClient, + esClient, + packagePolicy.id, + produce(packagePolicy, (draft) => { + unset(draft, 'id'); + if (!has(draft, 'inputs[0].streams')) { + set(draft, 'inputs[0].streams', []); } - ); - }) - ); - await packagePolicyService?.update( - packsClient, - esClient, - packagePolicy.id, - produce(packagePolicy, (draft) => { - unset(draft, 'id'); - if (!has(draft, 'inputs[0].streams')) { - set(draft, 'inputs[0].streams', []); - } - map(packsContainingShardForPolicy, (pack) => { - set(draft, `inputs[0].config.osquery.value.packs.${pack.attributes.name}`, { - shard: 100, - queries: convertSOQueriesToPackConfig(pack.attributes.queries), + map(packsContainingShardForPolicy, (pack) => { + set(draft, `inputs[0].config.osquery.value.packs.${pack.attributes.name}`, { + shard: 100, + queries: convertSOQueriesToPackConfig(pack.attributes.queries), + }); }); - }); - return draft; - }) - ); + return draft; + }) + ); + } }; diff --git a/yarn.lock b/yarn.lock index dcd398856d201..fa62aa0fc81c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22696,10 +22696,10 @@ react-grid-layout@^1.3.4: react-draggable "^4.0.0" react-resizable "^3.0.4" -react-hook-form@^7.39.5: - version "7.39.7" - resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.39.7.tgz#8eabf2dbb9fce5baccfa60f401f6ef99c4e17fb4" - integrity sha512-RT0NE1uW1bY3nAuMdzfqHrpv2+sICVFaxBOvNJsCva4if2sxPxcyJy/CSqU56UXqAdRg724CNDhjMYPSHSF3rg== +react-hook-form@^7.39.7: + version "7.40.0" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.40.0.tgz#62bc939dddca88522cd7f5135b6603192ccf7e17" + integrity sha512-0rokdxMPJs0k9bvFtY6dbcSydyNhnZNXCR49jgDr/aR03FDHFOK6gfh8ccqB3fl696Mk7lqh04xdm+agqWXKSw== react-input-autosize@^3.0.0: version "3.0.0"