Skip to content

Commit

Permalink
change application logic to not return error on empty attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Aug 29, 2024
1 parent eb7eb51 commit b66f8e6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
3 changes: 0 additions & 3 deletions internal/jimm/cloudcredential.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,5 @@ func (j *JIMM) getCloudCredentialAttributes(ctx context.Context, cred *dbmodel.C
if err != nil {
return nil, errors.E(op, err)
}
if len(attr) == 0 && cred.AuthType != "empty" {
return nil, errors.E(op, errors.CodeNotFound, "cloud-credential attributes not found")
}
return attr, nil
}
6 changes: 1 addition & 5 deletions internal/jujuapi/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,7 @@ func getIdentityCredentials(ctx context.Context, user *openfga.User, j JIMM, arg
var err error
content.Attributes, _, err = j.GetCloudCredentialAttributes(ctx, user, c, args.IncludeSecrets)
if err != nil {
if errors.ErrorCode(err) == errors.CodeNotFound {
content.Attributes = map[string]string{}
} else {
return nil, errors.E(err)
}
return nil, errors.E(err)
}
mas := make([]jujuparams.ModelAccess, len(c.Models))
for i, m := range c.Models {
Expand Down

0 comments on commit b66f8e6

Please sign in to comment.