Skip to content

Commit

Permalink
fix: Clear auto_assign_org last to improve user experience on Grafana (
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgubler authored Feb 13, 2024
1 parent cf98a43 commit 017448f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pkg/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ outAdmins:
}
klog.Infof("Found %d admin users", len(keycloakAdmins))

grafanaOrgsMap, err := reconcileAllOrgs(ctx, config, keycloakOrganizations, grafanaClient, dashboards)
if err != nil {
return err
}

klog.Infof("Checking permissions of normal orgs...")
grafanaPermissionsMap := getGrafanaPermissionsMap(keycloakUserGroups, keycloakAdmins, keycloakOrganizations)
err = reconcilePermissions(ctx, grafanaPermissionsMap, grafanaOrgsMap, grafanaClient)
if err != nil {
return err
}

if config.GrafanaClearAutoAssignOrg {
klog.Infof("Fetching auto_assign_org_id...")
autoAssignOrgId, err := grafanaClient.GetAutoAssignOrgId()
Expand All @@ -82,18 +94,6 @@ outAdmins:
}
}

grafanaOrgsMap, err := reconcileAllOrgs(ctx, config, keycloakOrganizations, grafanaClient, dashboards)
if err != nil {
return err
}

klog.Infof("Checking permissions of normal orgs...")
grafanaPermissionsMap := getGrafanaPermissionsMap(keycloakUserGroups, keycloakAdmins, keycloakOrganizations)
err = reconcilePermissions(ctx, grafanaPermissionsMap, grafanaOrgsMap, grafanaClient)
if err != nil {
return err
}

grafanaClient.CloseIdleConnections()
keycloakClient.CloseIdleConnections()

Expand Down

0 comments on commit 017448f

Please sign in to comment.