Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Fix extra.links of heron-tracker #3696

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions heron/tools/tracker/src/python/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ def load_configs(self):
for extra_link in self.configs[EXTRA_LINKS_KEY]:
self.extra_links.append(self.validate_extra_link(extra_link))

def validate_extra_link(self, extra_link: dict) -> None:
def validate_extra_link(self, extra_link: dict):
"""validate extra link"""
if EXTRA_LINK_NAME_KEY not in extra_link or EXTRA_LINK_FORMATTER_KEY not in extra_link:
raise Exception("Invalid extra.links format. " +
"Extra link must include a 'name' and 'formatter' field")

self.validated_formatter(extra_link[EXTRA_LINK_FORMATTER_KEY])
return extra_link

def validated_formatter(self, url_format: str) -> None:
"""Check visualization url format has no unrecongnised parameters."""
Expand Down Expand Up @@ -97,4 +98,4 @@ def __str__(self):
@staticmethod
def config_str(config):
keys = ("type", "name", "hostport", "rootpath", "tunnelhost")
return "".join("\t{k}: {config[k]}\n" for k in keys if k in config).rstrip()
return "".join("\t{}: {}\n".format(k, config[k]) for k in keys if k in config).rstrip()