Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
fix: allow * in profile (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
weliasz authored Oct 14, 2021
1 parent 7bdb37c commit 880dbce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion splunk_connect_for_snmp_poller/manager/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def get_snmp_data(
var_binds,
)
except Exception as e:
logger.error(f"Error occurred while calling {handler.__name__}(): {e}")
logger.exception(f"Error occurred while calling {handler.__name__}(): {e}")


def sort_varbinds(varbind_list: list) -> VarbindCollection:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

profile_pattern = re.compile("^[A-Za-z0-9_-]*$")

DYNAMIC_PROFILE = "*"

SNMP_VERSION_1 = "1"
SNMP_VERSION_2C = "2c"
SNMP_VERSION_3 = "3"
Expand Down Expand Up @@ -114,7 +116,7 @@ def is_valid_community(community_string):


def is_valid_profile(profile):
return profile_pattern.match(profile.strip())
return profile == DYNAMIC_PROFILE or profile_pattern.match(profile.strip())


def is_valid_inventory_line_from_dict(host, version, community, profile, seconds):
Expand Down
1 change: 1 addition & 0 deletions tests/test_inventory_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ def test_invalid_profile_name(self):
self.assertFalse(is_valid_profile("asd sa"))
self.assertFalse(is_valid_profile("&asd"))
self.assertTrue(is_valid_profile("1_asd-asds"))
self.assertTrue(is_valid_profile("*"))

0 comments on commit 880dbce

Please sign in to comment.