Skip to content

Commit

Permalink
Merge pull request #260 from Axonius/develop
Browse files Browse the repository at this point in the history
[5.0.6] Custom Attribute Field Parsing from Dynamic Fields
  • Loading branch information
nate-axonius committed Jul 10, 2023
2 parents 3ecda3c + b8ca854 commit 5c636c7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .python-version
@@ -1 +1 @@
3.11.2
3.11.1
7 changes: 7 additions & 0 deletions Pipfile
Expand Up @@ -5,3 +5,10 @@ name = "pypi"

[packages]
e1839a8 = {path = ".",editable = true}

[dev-packages]
ipython = "*"
pytest = "*"
flaky = "*"
coverage = "*"
pytest-cov = "*"
6 changes: 3 additions & 3 deletions axonius_api_client/api/assets/fields.py
Expand Up @@ -614,14 +614,15 @@ def split_search(self, value: str, adapter: str = AGG_ADAPTER_NAME) -> Tuple[str
"""
search = value.strip().lower()

if ":" in search:
# Problem are fields containing ":" from adapters that populate dynamic fields
# PBUG: special check for 'custom attributes' coming from esx adapter.
if ":" in search and 'custom attributes' not in search:
adapter_split, field = [x.strip() for x in search.split(":", 1)]
if not adapter_split:
adapter_split = adapter
else:
field = search
adapter_split = adapter

qual_check = re.match(r"adapters_data\.(.*?)\.", field)
if qual_check and len(qual_check.groups()) == 1:
adapter_split = qual_check.groups()[0]
Expand All @@ -639,7 +640,6 @@ def split_search(self, value: str, adapter: str = AGG_ADAPTER_NAME) -> Tuple[str

if not fields:
raise ApiError(f"No fields provided in {value!r}, format must be 'adapter:field'")

return adapter_split, fields

def _prettify_schemas(
Expand Down
2 changes: 1 addition & 1 deletion axonius_api_client/version.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""Version information for this package."""
__version__ = "5.0.5"
__version__ = "5.0.6"
VERSION: str = __version__
"""Version of package."""

Expand Down

0 comments on commit 5c636c7

Please sign in to comment.