Skip to content

Commit

Permalink
return cloud-credentials with empty attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Aug 29, 2024
1 parent 6c1d24d commit c0cd6f5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/jujuapi/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,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 err != nil && errors.ErrorCode(err) != errors.CodeNotFound {
return nil, errors.E(err)
}
mas := make([]jujuparams.ModelAccess, len(c.Models))
Expand Down
27 changes: 27 additions & 0 deletions internal/jujuapi/cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,33 @@ func (s *cloudSuite) TestCredentialContents(c *gc.C) {
}})
}

func (s *cloudSuite) TestCredentialContentsWithEmptyAttributes(c *gc.C) {
conn := s.open(c, nil, "test")
defer conn.Close()
client := cloudapi.NewClient(conn)
credentialTag := names.NewCloudCredentialTag(jimmtest.TestCloudName + "/[email protected]/cred3")
err := client.AddCredential(
credentialTag.String(),
cloud.NewCredential(
"certificate",
nil,
),
)
c.Assert(err, gc.Equals, nil)
creds, err := client.CredentialContents(jimmtest.TestCloudName, "cred3", false)
c.Assert(err, gc.Equals, nil)
c.Assert(creds, jc.DeepEquals, []jujuparams.CredentialContentResult{{
Result: &jujuparams.ControllerCredentialInfo{
Content: jujuparams.CredentialContent{
Name: "cred3",
Cloud: jimmtest.TestCloudName,
AuthType: "certificate",
Attributes: nil,
},
},
}})
}

func (s *cloudSuite) TestRemoveCloud(c *gc.C) {
conn := s.open(c, nil, "test")
defer conn.Close()
Expand Down

0 comments on commit c0cd6f5

Please sign in to comment.