aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-02-13 20:26:15 +0000
committerGravatar Chris Lovering <[email protected]>2024-02-13 20:26:15 +0000
commit935140ffcdc0e959f17891428d4327acdeffaf08 (patch)
tree8a2bae137ffc8ea366c6cacce7717b5fa0672279
parentRemove Grafana users from a team if they are not in the Github team (diff)
Improve grafana sync command output
-rw-r--r--arthur/exts/grafana/team_sync.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/arthur/exts/grafana/team_sync.py b/arthur/exts/grafana/team_sync.py
index 0441ddb..289cebd 100644
--- a/arthur/exts/grafana/team_sync.py
+++ b/arthur/exts/grafana/team_sync.py
@@ -123,6 +123,10 @@ class GrafanaTeamSync(commands.Cog):
async def sync_github_grafana_teams(self, channel: discord.TextChannel | None = None) -> None:
"""Update Grafana team membership to match Github team membership."""
grafana_teams = await grafana.list_teams(self.bot.http_session)
+ embed = discord.Embed(
+ title="Sync Stats",
+ colour=discord.Colour.blue(),
+ )
for team in grafana_teams:
logger.debug(f"Processing {team['name']}")
try:
@@ -133,11 +137,19 @@ class GrafanaTeamSync(commands.Cog):
await channel.send(e)
continue
- if channel:
- await channel.send(
- f"Found {figures.added.count} users not in the {team['name']} Grafana team, added {figures.added.successfully_added} of them. "
- f"{figures.removed} members were found in the Grafana team who shouldn't be, and were removed."
- )
+ lines = [
+ f"Missing: {figures.added.count}",
+ f"Added: {figures.added.successfully_added}",
+ f"Removed: {figures.removed}",
+ ]
+ embed.add_field(
+ name=team["name"],
+ value="\n".join(lines),
+ inline=False,
+ )
+
+ if channel:
+ await channel.send(embed=embed)
@sync_github_grafana_teams.error
async def on_task_error(self, error: Exception) -> None: