Skip to content

Commit eb264e7

Browse files
authored
Merge pull request #37 from ConductorOne/russell_h/fix_nothing_to_change
Handle "nothing to change" errors
2 parents 719837e + 3e49da7 commit eb264e7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/connector/account_roles.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ func (o *accountRoleBuilder) Grant(ctx context.Context, principal *v2.Resource,
178178
req := &cloudservicev1.UpdateUserRequest{UserId: userID, Spec: newSpec, ResourceVersion: userResp.GetUser().GetResourceVersion()}
179179
resp, err := o.client.UpdateUser(ctx, req)
180180
if err != nil {
181+
if strings.Contains(err.Error(), "nothing to change") {
182+
return nil, annotations.New(&v2.GrantAlreadyExists{}), nil
183+
}
184+
181185
return nil, nil, fmt.Errorf("temporalcloud-connector: could not grant entitlement to user: %w", err)
182186
}
183187

pkg/connector/namespaces.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func (o *namespaceBuilder) Grant(ctx context.Context, principal *v2.Resource, e
173173
req := &cloudservicev1.UpdateUserRequest{UserId: userID, Spec: spec, ResourceVersion: user.GetResourceVersion()}
174174
resp, err := o.client.UpdateUser(ctx, req)
175175
if err != nil {
176+
if strings.Contains(err.Error(), "nothing to change") {
177+
return nil, annotations.New(&v2.GrantAlreadyExists{}), nil
178+
}
179+
176180
return nil, nil, fmt.Errorf("temporalcloud-connector: could not grant entitlement to user: %w", err)
177181
}
178182

0 commit comments

Comments
 (0)