Skip to content

Commit

Permalink
raise anexception if invalid argument to templated platform is supplied
Browse files Browse the repository at this point in the history
and list available arguments
  • Loading branch information
vojtapolasek committed Dec 20, 2022
1 parent b2a0045 commit 6827b63
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ssg/build_cpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,13 @@ def create_resolved_cpe_item_for_fact_ref(self, fact_ref):
if not self.versioned:
raise ValueError("CPE entity '{0}' does not support version specifiers: "
"{1}".format(self.id_, fact_ref.cpe_name))
resolved_parameters = self.args[fact_ref.arg]
try:
resolved_parameters = self.args[fact_ref.arg]
except KeyError:
raise KeyError(
"The {0} CPE item does not support the argument {1}. "
"Following arguments are supported: {2}".format(
self.id_, fact_ref.arg, [a for a in self.args.keys()]))
resolved_parameters.update(fact_ref.as_dict())
cpe_item_as_dict = self.represent_as_dict()
cpe_item_as_dict["args"] = None
Expand Down

0 comments on commit 6827b63

Please sign in to comment.