-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return cloud-credentials with empty attribute #1333
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c0cd6f5
return cloud-credentials with empty attribute
kian99 eb7eb51
set empty map if attributes not found
kian99 b66f8e6
change application logic to not return error on empty attributes
kian99 f594b5f
add app layer test
kian99 896f58d
return empty map rather than nil
kian99 fd97f08
fix test
kian99 b6af7ac
Merge branch 'v3' into cloud-credential-empty-attribute
kian99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking out loud...
now this map is set to nil, and if you try to access it it will panic, i would prefer j.GetCloudCredentialAttributes to return an empty map without any error. It is even more correct, because we don't want to treat empty attributes as an error.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes fair point