Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
enolfc committed Jun 7, 2024
1 parent 9952bcf commit 5c4add6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions dashboard/dashy_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pathlib import Path
from urllib import parse

import defusedxml.ElementTree as ElementTree
from defusedxml import ElementTree
import requests
import yaml

Expand Down Expand Up @@ -91,6 +91,9 @@ def find_endpoints(service_type, production=True, monitored=True):


def main():
"""
Main function, generates config
"""
dashy_conf = {
"pageInfo": {
"title": "EGI Cloud Compute",
Expand Down Expand Up @@ -128,18 +131,19 @@ def main():
items.append(
{
"title": s[0],
"description": "%s (%s)" % (s[3], s[4]),
"description": f"{s[3]} ({s[4]})",
"icon": DEFAULT_ICON,
"url": s[2],
"target": "newtab",
}
)
print(yaml.dump(dashy_conf))
with open(DASHY_OUTOUT, "w") as f:
with open(DASHY_OUTOUT, "w", encoding="utf-8") as f:
yaml.dump(dashy_conf, f)
except Exception:
# catching anything, we don't need to be specific
except Exception: # pylint: disable=broad-exception-caught
if Path(DASHY_OUTOUT).is_file():
with open(DASHY_OUTOUT) as f:
with open(DASHY_OUTOUT, "r", encoding="utf-8") as f:
print(yaml.dump(yaml.safe_load(f)))
else:
# to-do: write in dashy_conf: "site not available at the moment"
Expand Down

0 comments on commit 5c4add6

Please sign in to comment.