Update robot account to skip NotFoundErr (#18321)

Fix #18320

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Yang Jiao 2023-03-08 15:39:50 +08:00 committed by GitHub
parent 2c287cf27a
commit fecee37439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,7 +152,7 @@ func (d *controller) Update(ctx context.Context, r *Robot, option *Option) error
}
// update the permission
if option != nil && option.WithPermission {
if err := d.rbacMgr.DeletePermissionsByRole(ctx, ROBOTTYPE, r.ID); err != nil {
if err := d.rbacMgr.DeletePermissionsByRole(ctx, ROBOTTYPE, r.ID); err != nil && !errors.IsNotFoundErr(err) {
return err
}
if err := d.createPermission(ctx, r); err != nil {