-
Notifications
You must be signed in to change notification settings - Fork 4
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
APPS-1268 Validate backup/restore namespace exists #244
base: v2
Are you sure you want to change the base?
Conversation
pkg/service/backup_go.go
Outdated
return nil, err | ||
} | ||
if !ok { | ||
return nil, fmt.Errorf("cluster does not have all require namespace") |
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.
return nil, fmt.Errorf("cluster does not have the namespace %s configured", namespace)
@@ -33,6 +33,14 @@ func (b *BackupGo) BackupRun( | |||
namespace string, | |||
path string, | |||
) (BackupHandler, error) { | |||
ok, err := clusterHasRequiredNamespace(namespace, client.AerospikeClient()) |
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.
Won't it be better to validate the namespace either at startup or when modified using an API endpoint?
@@ -16,6 +16,22 @@ import ( | |||
|
|||
const namespaceInfo = "namespaces" | |||
|
|||
// clusterHasRequiredNamespace checks if given namespace exists in cluster. | |||
func clusterHasRequiredNamespace(namespace string, client backup.AerospikeClient) (bool, error) { |
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.
Did you consider verifying the namespace on a restore operation?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2 #244 +/- ##
==========================================
- Coverage 27.75% 27.37% -0.39%
==========================================
Files 39 39
Lines 2104 2137 +33
==========================================
+ Hits 584 585 +1
- Misses 1437 1465 +28
- Partials 83 87 +4 ☔ View full report in Codecov by Sentry. |
I've introduced nsValidator component that does the info request and validates namespaces. |
No description provided.