Skip to content

Commit

Permalink
[Bug] Fix typo in downgrade_contents_from_rule (elastic#3272)
Browse files Browse the repository at this point in the history
* Fix missing to_dict()

* Update pyproject.toml
  • Loading branch information
eric-forte-elastic authored Nov 15, 2023
1 parent f53f46e commit 66c1d7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions detection_rules/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,8 +1290,12 @@ def downgrade_contents_from_rule(rule: TOMLRule, target_version: str, replace_id

rule_dict = downgrade(rule_dict, target_version=str(min_stack_version))
meta = rule_dict.pop("meta")
rule_contents = TOMLRuleContents.from_dict({"rule": rule_dict, "metadata": meta,
"transform": rule.contents.transform})
rule_contents_dict = {"rule": rule_dict, "metadata": meta}

if rule.contents.transform:
rule_contents_dict["transform"] = rule.contents.transform.to_dict()

rule_contents = TOMLRuleContents.from_dict(rule_contents_dict)
payload = rule_contents.to_api_format()
payload = strip_non_public_fields(min_stack_version, payload)
return payload
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies = [
"elasticsearch~=8.1",
"eql==0.9.19",
"jsl==0.2.4",
"jsonschema==3.2.0",
"jsonschema>=3.2.0",
"marko==2.0.1",
"marshmallow-dataclass[union]~=8.5.12",
"marshmallow-jsonschema~=0.12.0",
Expand Down

0 comments on commit 66c1d7f

Please sign in to comment.