Skip to content

Commit 120fe6a

Browse files
committed
feat(account): Name or email of policy, group, user or service user should be visible in deploy error messages
1 parent e3d0bd9 commit 120fe6a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pkg/account/deployer/deployer.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (d *AccountDeployer) deployPolicies(ctx context.Context, policies map[strin
212212
d.logger.Info("Deploying policy '%s'", policy.Name)
213213
pUuid, err := d.upsertPolicy(d.logCtx(ctx), policy)
214214
if err != nil {
215-
errCh <- fmt.Errorf("unable to deploy policy for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
215+
errCh <- fmt.Errorf("unable to deploy policy '%s' for account %s: %w", policy.Name, d.accClient.getAccountInfo().AccountUUID, err)
216216
}
217217
d.idMap.addPolicy(policy.ID, pUuid)
218218
}
@@ -228,7 +228,7 @@ func (d *AccountDeployer) deployGroups(ctx context.Context, groups map[string]ac
228228
d.logger.Info("Deploying group '%s'", group.Name)
229229
gUuid, err := d.upsertGroup(d.logCtx(ctx), group)
230230
if err != nil {
231-
errCh <- fmt.Errorf("unable to deploy group for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
231+
errCh <- fmt.Errorf("unable to deploy group '%s' for account %s: %w", group.Name, d.accClient.getAccountInfo().AccountUUID, err)
232232
}
233233
d.idMap.addGroup(group.ID, gUuid)
234234

@@ -245,7 +245,7 @@ func (d *AccountDeployer) deployUsers(ctx context.Context, users map[string]acco
245245
defer wg.Done()
246246
d.logger.Info("Deploying user '%s'", user.Email)
247247
if _, err := d.upsertUser(d.logCtx(ctx), user); err != nil {
248-
errCh <- fmt.Errorf("unable to deploy user for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
248+
errCh <- fmt.Errorf("unable to deploy user '%s' for account %s: %w", user.Email, d.accClient.getAccountInfo().AccountUUID, err)
249249
}
250250
}
251251
dispatcher.AddJob(deployUserJob)
@@ -260,7 +260,7 @@ func (d *AccountDeployer) deployServiceUsers(ctx context.Context, serviceUsers [
260260
defer wg.Done()
261261
d.logger.Info("Deploying service user '%s'", serviceUser.Name)
262262
if _, err := d.upsertServiceUser(d.logCtx(ctx), serviceUser); err != nil {
263-
errCh <- fmt.Errorf("unable to deploy service user for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
263+
errCh <- fmt.Errorf("unable to deploy service user '%s' for account %s: %w", serviceUser.Name, d.accClient.getAccountInfo().AccountUUID, err)
264264
}
265265
}
266266
dispatcher.AddJob(deployServiceUserJob)
@@ -276,11 +276,11 @@ func (d *AccountDeployer) deployGroupBindings(ctx context.Context, groups map[ac
276276
updateBindingsJob := func(wg *sync.WaitGroup, errCh chan error) {
277277
defer wg.Done()
278278
if err := d.updateGroupPolicyBindings(d.logCtx(ctx), group); err != nil {
279-
errCh <- fmt.Errorf("unable to deploy policy binding for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
279+
errCh <- fmt.Errorf("unable to update policy bindings for group '%s' for account %s: %w", group.Name, d.accClient.getAccountInfo().AccountUUID, err)
280280
}
281281

282282
if err := d.updateGroupPermissions(d.logCtx(ctx), group); err != nil {
283-
errCh <- fmt.Errorf("unable to deploy permissions for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
283+
errCh <- fmt.Errorf("unable to update permissions for group '%s' for account %s: %w", group.Name, d.accClient.getAccountInfo().AccountUUID, err)
284284
}
285285
}
286286

@@ -297,7 +297,7 @@ func (d *AccountDeployer) deployUserBindings(ctx context.Context, users map[acco
297297
defer wg.Done()
298298
d.logger.Info("Updating group bindings for user '%s'", user.Email)
299299
if err := d.updateUserGroupBindings(d.logCtx(ctx), user); err != nil {
300-
errCh <- fmt.Errorf("unable to deploy user binding for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
300+
errCh <- fmt.Errorf("unable to update bindings for user '%s' for account %s: %w", user.Email, d.accClient.getAccountInfo().AccountUUID, err)
301301
}
302302
}
303303

@@ -314,7 +314,7 @@ func (d *AccountDeployer) deployServiceUserBindings(ctx context.Context, service
314314
defer wg.Done()
315315
d.logger.Info("Updating group bindings for service user '%s'", serviceUser.Name)
316316
if err := d.updateServiceUserGroupBindings(d.logCtx(ctx), serviceUser); err != nil {
317-
errCh <- fmt.Errorf("unable to deploy user binding for account %s: %w", d.accClient.getAccountInfo().AccountUUID, err)
317+
errCh <- fmt.Errorf("unable to update bindings for service user '%s' for account %s: %w", serviceUser.Name, d.accClient.getAccountInfo().AccountUUID, err)
318318
}
319319
}
320320
dispatcher.AddJob(deployUserBindingsJob)

0 commit comments

Comments
 (0)