Skip to content

Commit

Permalink
added validation error if input has no vars
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Feb 2, 2022
1 parent 35e2d19 commit 895027b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions x-pack/plugins/fleet/common/services/validate_package_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,22 @@ export const validatePackagePolicy = (
if (inputVars.length) {
inputValidationResults.vars = inputVars.reduce((results, [name, configEntry]) => {
results[name] = input.enabled
? validatePackagePolicyConfig(
configEntry,
(inputVarDefsByPolicyTemplateAndType[inputKey] ?? {})[name],
name,
safeLoadYaml
)
? inputVarDefsByPolicyTemplateAndType[inputKey] === undefined
? [
i18n.translate('xpack.fleet.packagePolicyValidation.missingInputKeyMessage', {
defaultMessage: '{inputKey} has no vars in policy template',
values: {
inputKey,
name,
},
}),
]
: validatePackagePolicyConfig(
configEntry,
inputVarDefsByPolicyTemplateAndType[inputKey][name],
name,
safeLoadYaml
)
: null;
return results;
}, {} as ValidationEntry);
Expand Down

0 comments on commit 895027b

Please sign in to comment.