Skip to content

Commit

Permalink
Simplify template
Browse files Browse the repository at this point in the history
The flags "S" and "R" are set in FLAGS variable always. Since
they're set always, we don't have to set them at all. We
can remove the conditions that check for these flags and always
use the code inside the conditions.
  • Loading branch information
jan-cerny committed Nov 5, 2024
1 parent dd99d71 commit dfcbd95
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions shared/templates/sysctl/oval.template
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
</def-group>

{{%- endif %}}
{{%- if "R" in FLAGS -%}}

{{% if CHECK_RUNTIME == "true" %}}
<def-group>
Expand Down Expand Up @@ -121,8 +120,6 @@
</def-group>
{{% endif %}}

{{%- endif -%}}
{{%- if "S" in FLAGS -%}}

<def-group>
<definition class="compliance" id="{{{ rule_id }}}_static" version="3">
Expand Down Expand Up @@ -269,4 +266,3 @@
{{% endfor %}}
{{% endif %}}
</def-group>
{{%- endif -%}}
2 changes: 1 addition & 1 deletion shared/templates/sysctl/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def preprocess(data, lang):
ipv6_flag = "P"
if data["sysctlid"].find("ipv6") >= 0:
ipv6_flag = "I"
data["flags"] = "SR" + ipv6_flag
data["flags"] = ipv6_flag
if "operation" not in data:
data["operation"] = "equals"
if isinstance(data["sysctlval"], list) and len(data["sysctlval"]) == 0:
Expand Down

0 comments on commit dfcbd95

Please sign in to comment.