Skip to content

Commit

Permalink
linters
Browse files Browse the repository at this point in the history
  • Loading branch information
jkppr committed Oct 2, 2023
1 parent 547237b commit 867f003
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions timesketch/api/v1/resources/contextlinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,35 @@ def get(self):
return jsonify(response)

if context_link_yaml.get("hardcoded_modules"):
for entry in context_link_yaml.get("hardcoded_modules"):
for entry in context_link_yaml.get("hardcoded_modules", []):
context_link_config = {
"type": "hardcoded_modules",
"short_name": context_link_yaml["hardcoded_modules"][entry]["short_name"],
"short_name": context_link_yaml["hardcoded_modules"][entry][
"short_name"
],
"module": entry,
}
if context_link_yaml["hardcoded_modules"][entry].get("validation_regex"):
context_link_config["validation_regex"] = context_link_yaml["hardcoded_modules"][entry]["validation_regex"]
for field in context_link_yaml["hardcoded_modules"][entry]["match_fields"]:
if context_link_yaml["hardcoded_modules"][entry].get(
"validation_regex"
):
context_link_config["validation_regex"] = context_link_yaml[
"hardcoded_modules"
][entry]["validation_regex"]
for field in context_link_yaml["hardcoded_modules"][entry][
"match_fields"
]:
response.setdefault(field.lower(), []).append(context_link_config)

if context_link_yaml.get("linked_services"):
for entry in context_link_yaml.get("linked_services"):
context_link_config = deepcopy(context_link_yaml["linked_services"][entry])
for entry in context_link_yaml.get("linked_services", []):
context_link_config = deepcopy(
context_link_yaml["linked_services"][entry]
)
context_link_config["type"] = "linked_services"
del context_link_config["match_fields"]
for field in context_link_yaml["linked_services"][entry]["match_fields"]:
for field in context_link_yaml["linked_services"][entry][
"match_fields"
]:
response.setdefault(field.lower(), []).append(context_link_config)

return jsonify(response)

0 comments on commit 867f003

Please sign in to comment.