Skip to content

Commit

Permalink
service/backup: improve error for nonexistent bucket
Browse files Browse the repository at this point in the history
error is now much more useful and succinct:
```
$ ./sctool backup -L "s3:fake-bucket"
Error: create backup target: specified bucket does not exist
Trace ID: 8KpElsLlRcaRjnW7y3ysJw (grep in scylla-manager logs)
```

fixes #3139
  • Loading branch information
kevinbarbour authored and mmatczuk committed May 26, 2022
1 parent b2bb08e commit 4892615
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/service/backup/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ func (s *Service) GetTarget(ctx context.Context, clusterID uuid.UUID, properties

// Validate locations access
if err := s.checkLocationsAvailableFromNodes(ctx, client, t.liveNodes, t.Location); err != nil {
if strings.Contains(err.Error(), "NoSuchBucket") {
return t, errors.New("specified bucket does not exist")
}
return t, errors.Wrap(err, "location is not accessible")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/service/backup/service_backup_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func TestGetTargetErrorIntegration(t *testing.T) {
{
Name: "inaccessible location",
JSON: `{"location": ["s3:foo", "dc1:s3:bar"]}`,
Error: "location is not accessible",
Error: "specified bucket does not exist",
},
{
Name: "invalid rate limit dc",
Expand Down

0 comments on commit 4892615

Please sign in to comment.