Skip to content

Commit

Permalink
template.py: prevent specification of value and xccdf_variable at the…
Browse files Browse the repository at this point in the history
… same time
  • Loading branch information
vojtapolasek committed Aug 1, 2024
1 parent 3d1cc76 commit cd37810
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions shared/templates/sshd_lineinfile/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@


def preprocess(data, lang):
if data.get("value") is not None and data.get("xccdf_variable") is not None:
errmsg = "The template definition of {0} specifies both value and xccdf_variable. This is forbidden.".format(data["_rule_id"])
raise ValueError(errmsg)
if data["datatype"] not in ["string", "int"]:
errmsg = "The template instance of the rule {0} contains invalid datatype. It must be either 'string' or 'int'".format(data["_rule_id"])
raise ValueError(errmsg)
Expand Down

0 comments on commit cd37810

Please sign in to comment.