[Bug] resolves bug in Rule version methods (#2021)
* [Bug] resolves bug in Rule version methods
* comment out unused code with notes
(cherry picked from commit 744f56d98e)
This commit is contained in:
committed by
github-actions[bot]
parent
57194b8e59
commit
8564185a7d
@@ -21,7 +21,7 @@ import kql
|
||||
from . import utils
|
||||
from .mixins import MarshmallowDataclassMixin
|
||||
from .rule_formatter import toml_write, nested_normalize
|
||||
from .schemas import SCHEMA_DIR, definitions, downgrade, get_stack_schemas
|
||||
from .schemas import SCHEMA_DIR, definitions, downgrade, get_stack_schemas, get_min_supported_stack_version
|
||||
from .utils import cached
|
||||
|
||||
_META_SCHEMA_REQ_DEFAULTS = {}
|
||||
@@ -406,7 +406,8 @@ class BaseRuleContents(ABC):
|
||||
@property
|
||||
def is_dirty(self) -> Optional[bool]:
|
||||
"""Determine if the rule has changed since its version was locked."""
|
||||
existing_sha256 = self.version_lock.get_locked_hash(self.id, self.metadata.get('min_stack_version'))
|
||||
min_stack = self.metadata.get('min_stack_version') or str(get_min_supported_stack_version(drop_patch=True))
|
||||
existing_sha256 = self.version_lock.get_locked_hash(self.id, min_stack)
|
||||
|
||||
if existing_sha256 is not None:
|
||||
return existing_sha256 != self.sha256()
|
||||
@@ -414,7 +415,8 @@ class BaseRuleContents(ABC):
|
||||
@property
|
||||
def latest_version(self) -> Optional[int]:
|
||||
"""Retrieve the latest known version of the rule."""
|
||||
return self.version_lock.get_locked_version(self.id, self.metadata.get('min_stack_version'))
|
||||
min_stack = self.metadata.get('min_stack_version') or str(get_min_supported_stack_version(drop_patch=True))
|
||||
return self.version_lock.get_locked_version(self.id, min_stack)
|
||||
|
||||
@property
|
||||
def autobumped_version(self) -> Optional[int]:
|
||||
|
||||
Reference in New Issue
Block a user