Skip to content
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

Fix cb uri hostname for replicas using user role. #162

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- `cb config-param set` issue truncating values with multiple `=` characters.
- `cb uri` retrieving correct `user` role credentials for a replica.

## [3.5.0] - 2024-01-31
### Added
Expand Down
2 changes: 2 additions & 0 deletions spec/cb/cluster_uri_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Spectator.describe CB::ClusterURI do
action.role = "user"

expect(client).to receive(:create_role).and_return(role)
expect(client).to receive(:get_role).and_return(role)

action.call

Expand All @@ -48,6 +49,7 @@ Spectator.describe CB::ClusterURI do
action.role = "user"

expect(client).to receive(:create_role).and_return(role)
expect(client).to receive(:get_role).and_return(role)

action.call

Expand Down
7 changes: 2 additions & 5 deletions src/cb/cluster_uri.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ class CB::ClusterURI < CB::APIAction
def run
validate

role = if @role == "user"
client.create_role(@cluster_id[:cluster])
else
client.get_role(@cluster_id[:cluster], @role.to_s)
end
client.create_role(@cluster_id[:cluster]) if @role == "user"
role = client.get_role(@cluster_id[:cluster], @role.to_s)

uri = role.uri
raise Error.new "There is no URI available for this cluster." unless uri
Expand Down