Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Luna-Valero <sebastian-luna-valero@users.noreply.github.com>
  • Loading branch information
enolfc and sebastian-luna-valero authored Dec 11, 2024
1 parent fc5fd41 commit 59d78bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion fedcloud_vm_monitoring/goc.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def get_sites_slas(self, cert_file, vo_map):
site = svc["SITENAME"]
site_info = sites.get("site", dict())
site_info[sla_name] = {"vos": set(vos or [])}
sites[site] = site_info
if site in sites:
sites[site].update(site_info)
else:
sites[site] = site_info
return sites

def get_endpoint_site(self, endpoint):
Expand Down
4 changes: 3 additions & 1 deletion fedcloud_vm_monitoring/sla_monitor_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def check_site_slas(site, site_slas, goc, acct, appdb):
click.echo(f"[I] {site} is not present in any SLA")
else:
for sla_name, sla in site_slas[site].items():
click.echo(f"Information for SLA {sla_name}")
sla_vos = sla_vos.union(sla["vos"])
accounted_vos = sla["vos"].intersection(acct.site_vos(site))
if accounted_vos:
Expand All @@ -30,6 +31,7 @@ def check_site_slas(site, site_slas, goc, acct, appdb):
click.echo(f"[OK] {site} has configured {info_vos} for SLA {sla_name}")
else:
click.echo(f"[ERR] {site} has no configured VO for SLA {sla_name}")
click.echo()
click.secho(f"[-] Checking aditional VOs at {site}", fg="yellow", bold=True)
# Now check which VOs are being reported without a SLA
if not sla_vos:
Expand All @@ -40,7 +42,7 @@ def check_site_slas(site, site_slas, goc, acct, appdb):
f"[W] {site} has accounting for VOs {non_sla_vos} but not covered by SLA"
)
if "ops" not in acct.site_vos(site):
click.echo(f"[W] {site} has accounting for ops")
click.echo(f"[W] {site} has no accounting for ops")
non_sla_appdb_vos = appdb_vos - sla_vos.union(set(["ops"]))
if non_sla_vos:
click.echo(
Expand Down

0 comments on commit 59d78bd

Please sign in to comment.