Bugfixes#138
Conversation
- Remove complex NABSL-to-request UUID mapping in favor of direct request listing - Fix import path to use internal output package instead of Velero's - Skip output wrapper for delete commands to allow real-time display - Improve parent command checking for logs/describe/delete patterns Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com>
…ation The --force flag allowed users to bypass the storage-location requirement, which could lead to unexpected behavior. This change removes the flag and simplifies the backup creation flow by making --storage-location a required parameter. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com>
📝 WalkthroughWalkthroughThis PR removes the Force flag from non-admin backup creation, refactors NABSL request retrieval to use admin namespace directly instead of user namespace lookups, consolidates output package imports, and adds parent command awareness to output wrapping logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 4❌ Failed checks (1 warning, 3 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmd/nabsl-request/get.go`:
- Around line 108-127: The help/example no longer matches the lookup behavior in
cmd/nabsl-request/get.go where the code path using o.Name treats NAME as the
request object name/UUID (the block that GETs
nacv1alpha1.NonAdminBackupStorageLocationRequest and calls
output.PrintWithFormat and printRequestTable); update the command Example/help
text to state that NAME must be the request name/UUID (e.g., "Get a specific
request by request name or UUID") and provide the suggested usage example, or
alternatively reintroduce the NABSL-name lookup code path (resolve NABSL name to
the request object name before calling o.client.Get) so the original example
remains valid.
| if o.Name != "" { | ||
| // Get specific request by UUID or NABSL name | ||
| var targetUUID string | ||
|
|
||
| // Check if o.Name is a UUID or NABSL name | ||
| if _, exists := requestUUIDs[o.Name]; exists { | ||
| // o.Name is a UUID | ||
| targetUUID = o.Name | ||
| } else { | ||
| // o.Name might be a NABSL name, find its UUID | ||
| for uuid, nabslName := range requestUUIDs { | ||
| if nabslName == o.Name { | ||
| targetUUID = uuid | ||
| break | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if targetUUID != "" { | ||
| var request nacv1alpha1.NonAdminBackupStorageLocationRequest | ||
| err := o.client.Get(context.Background(), kbclient.ObjectKey{ | ||
| Name: targetUUID, | ||
| Namespace: adminNS, | ||
| }, &request) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to get request for %q: %w", o.Name, err) | ||
| } | ||
|
|
||
| if printed, err := output.PrintWithFormat(c, &request); printed || err != nil { | ||
| return err | ||
| } | ||
|
|
||
| list := &nacv1alpha1.NonAdminBackupStorageLocationRequestList{ | ||
| Items: []nacv1alpha1.NonAdminBackupStorageLocationRequest{request}, | ||
| } | ||
| return printRequestTable(list) | ||
| } | ||
|
|
||
| return fmt.Errorf("request %q not found for NABSLs in namespace %s", o.Name, currentNS) | ||
| } | ||
|
|
||
| // List all requests related to user's NABSLs | ||
| var userRequests []nacv1alpha1.NonAdminBackupStorageLocationRequest | ||
| for uuid := range requestUUIDs { | ||
| // Get specific request by name (UUID) | ||
| var request nacv1alpha1.NonAdminBackupStorageLocationRequest | ||
| err := o.client.Get(context.Background(), kbclient.ObjectKey{ | ||
| Name: uuid, | ||
| Name: o.Name, | ||
| Namespace: adminNS, | ||
| }, &request) | ||
| if err != nil { | ||
| // Request might not exist yet, skip | ||
| continue | ||
| return fmt.Errorf("failed to get request %q: %w", o.Name, err) | ||
| } | ||
|
|
||
| if printed, err := output.PrintWithFormat(c, &request); printed || err != nil { | ||
| return err | ||
| } | ||
|
|
||
| list := &nacv1alpha1.NonAdminBackupStorageLocationRequestList{ | ||
| Items: []nacv1alpha1.NonAdminBackupStorageLocationRequest{request}, | ||
| } | ||
| userRequests = append(userRequests, request) | ||
| return printRequestTable(list) | ||
| } |
There was a problem hiding this comment.
Help/example no longer matches lookup behavior.
Line 108+ now treats NAME as the request object name/UUID in the admin namespace. The Example still says “Get a specific request by NABSL name,” which will now fail if the NABSL name doesn’t equal the request name. Please update the help/example text or reintroduce the NABSL-name lookup.
Suggested Example wording:
# Get a specific request by request name or UUID
kubectl oadp nabsl-request get nacuser01-my-bsl-96dfa8b7-...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@cmd/nabsl-request/get.go` around lines 108 - 127, The help/example no longer
matches the lookup behavior in cmd/nabsl-request/get.go where the code path
using o.Name treats NAME as the request object name/UUID (the block that GETs
nacv1alpha1.NonAdminBackupStorageLocationRequest and calls
output.PrintWithFormat and printRequestTable); update the command Example/help
text to state that NAME must be the request name/UUID (e.g., "Get a specific
request by request name or UUID") and provide the suggested usage example, or
alternatively reintroduce the NABSL-name lookup code path (resolve NABSL name to
the request object name before calling o.client.Get) so the original example
remains valid.
Why the changes were made
Fixes #123, Fixes #127, Fixes #124, Fixes #125
How to test the changes made
oc oadp nabsl-request getshould now show all nabsl-requests rather than being namespace scopedoc oadp na backup create --forcewill no longer work, as the flag has been removedoc oadp delete backupwill no longer hang, as it is excluded from velero -> oadp string replacementoc oadp na bsl create ....... -o yamlwill now output the yaml definition without the scheme errorSummary by CodeRabbit
Removed Features
--forceflag has been removed from the non-admin backup create command, simplifying the creation workflow by eliminating interactive prompts and confirmation flows.Documentation