patch fix for 2503 (#2527)

This commit is contained in:
Terrance DeJesus
2023-02-07 15:40:51 -05:00
committed by GitHub
parent fb2b4529c5
commit 4054eb43d1
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -678,7 +678,7 @@ class BaseRuleContents(ABC):
@property
def is_dirty(self) -> Optional[bool]:
"""Determine if the rule has changed since its version was locked."""
min_stack = Version.parse(self.get_supported_version())
min_stack = Version.parse(self.get_supported_version(), optional_minor_and_patch=True)
existing_sha256 = self.version_lock.get_locked_hash(self.id, str(min_stack).rstrip(".0"))
if existing_sha256 is not None:
@@ -743,7 +743,7 @@ class BaseRuleContents(ABC):
"""Get the lowest stack version for the rule that is currently supported in the form major.minor."""
rule_min_stack = self.metadata.get('min_stack_version')
min_stack = self.convert_supported_version(rule_min_stack)
return str(min_stack)
return f"{min_stack.major}.{min_stack.minor}"
def _post_dict_transform(self, obj: dict) -> dict:
"""Transform the converted API in place before sending to Kibana."""
+2 -1
View File
@@ -202,7 +202,8 @@ class VersionLock:
for rule in rules:
if rule.contents.metadata.maturity == "production" or rule.id in newly_deprecated:
# assume that older stacks are always locked first
min_stack = Version.parse(rule.contents.get_supported_version())
min_stack = Version.parse(rule.contents.get_supported_version(),
optional_minor_and_patch=True)
lock_from_rule = rule.contents.lock_info(bump=not exclude_version_update)
lock_from_file: dict = lock_file_contents.setdefault(rule.id, {})