Skip to content

Commit

Permalink
Set policy_template when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed Nov 30, 2021
1 parent 1146d88 commit 012f6a3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x-pack/plugins/fleet/server/services/package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,12 @@ export function updatePackageInputs(
originalInput.keep_enabled = update.keep_enabled;
}

// `policy_template` should always be defined, so if we have an older policy here we need
// to ensure we set it
if (originalInput.policy_template === undefined && update.policy_template !== undefined) {
originalInput.policy_template = update.policy_template;
}

if (update.vars) {
const indexOfInput = inputs.indexOf(originalInput);
inputs[indexOfInput] = deepMergeVars(originalInput, update, true) as NewPackagePolicyInput;
Expand Down

0 comments on commit 012f6a3

Please sign in to comment.