Skip to content

Commit

Permalink
fixup! Pass in arguments instead of unpacking inside function
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Oct 31, 2024
1 parent 4bd2a27 commit 5bfbeb6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/everest/config/everest_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,15 +692,17 @@ def hostfile_path(self):
def server_info(self):
"""Load server information from the hostfile"""
host_file_path = self.hostfile_path
try:
with open(host_file_path, "r", encoding="utf-8") as f:
json_string = f.read()

with open(host_file_path, "r", encoding="utf-8") as f:
json_string = f.read()

data = json.loads(json_string)
if set(data.keys()) != {"host", "port", "cert", "auth"}:
raise RuntimeError("Malformed hostfile")

return data
data = json.loads(json_string)
if set(data.keys()) != {"host", "port", "cert", "auth"}:
raise RuntimeError("Malformed hostfile")
return data
except FileNotFoundError:
# No host file
return {"host": None, "port": None, "cert": None, "auth": None}

@property
def server_context(self) -> Tuple[str, str, Tuple[str, str]]:
Expand Down

0 comments on commit 5bfbeb6

Please sign in to comment.