Skip to content

Bugfixes#138

Merged
weshayutin merged 2 commits into
migtools:oadp-devfrom
Joeavaikath:optimization-fixes-backup
Feb 18, 2026
Merged

Bugfixes#138
weshayutin merged 2 commits into
migtools:oadp-devfrom
Joeavaikath:optimization-fixes-backup

Conversation

@Joeavaikath
Copy link
Copy Markdown
Contributor

@Joeavaikath Joeavaikath commented Feb 18, 2026

Why the changes were made

Fixes #123, Fixes #127, Fixes #124, Fixes #125

How to test the changes made

oc oadp nabsl-request get should now show all nabsl-requests rather than being namespace scoped

oc oadp na backup create --force will no longer work, as the flag has been removed

oc oadp delete backup will no longer hang, as it is excluded from velero -> oadp string replacement

oc oadp na bsl create ....... -o yaml will now output the yaml definition without the scheme error

Summary by CodeRabbit

  • Removed Features

    • The --force flag has been removed from the non-admin backup create command, simplifying the creation workflow by eliminating interactive prompts and confirmation flows.
  • Documentation

    • Updated MVP command documentation to reflect the removal of the force flag, reducing the total number of exposed flags from 13 to 12.

Joeavaikath and others added 2 commits February 18, 2026 12:52
- 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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 18, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Non-admin Backup Command
cmd/non-admin/backup/create.go, cmd/non-admin/backup/README.md, cmd/non-admin/backup/backup_test.go
Removed Force flag from CreateOptions struct and associated confirmation/admin-defaults flow. Simplified validation to require only --storage-location. Updated tests and documentation to reflect flag removal.
NABSL Request Retrieval
cmd/nabsl-request/get.go
Refactored namespace lookup from user-namespace-based to direct admin namespace queries. When name provided, fetches NonAdminBackupStorageLocationRequest directly from admin namespace. When listing, retrieves from admin namespace (or all namespaces with --all-namespaces flag).
Output Package Consolidation
cmd/non-admin/bsl/create.go
Updated import path from velero/pkg/cmd/util/output to github.com/migtools/oadp-cli/cmd/non-admin/output for PrintWithFormat usage.
Root Command Enhancement
cmd/root.go
Added parent command context awareness for determining output wrapper skip logic. Extended isLogsCommand and isDescribeCommand checks to consider parent command's Use value, enabling proper handling for nested commands like "backup describe".
Documentation Updates
docs/oadp-self-service.md
Updated MVP flag count from 13 to 12 by removing Force flag reference and control flags subsection.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • verb-noun order bugfixes #118: Both PRs modify non-admin output handling and consolidate the output package import path used across non-admin commands.

Suggested labels

ai-generated-test

Suggested reviewers

  • weshayutin
  • kaovilai

Poem

🐰 The Force has left the building with grace,
Now NABSL shines in admin's true place,
Parent commands now see what's ahead,
Nested flows unwrapped—simpler, cleaner, well-read!

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (1 warning, 3 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Bugfixes' is vague and does not convey meaningful information about the specific changes made in this pull request. Use a more descriptive title that captures the primary change, such as 'Fix NABSL request visibility and backup creation flow' or similar.
Linked Issues check ❓ Inconclusive The PR addresses the primary objective from #123 (NABSL requests visibility across namespaces), but only one linked issue is provided while the description references four fixes (#123, #127, #124, #125). Provide complete linked issue details for #127, #124, and #125 to fully validate that all referenced fixes are properly scoped.
Out of Scope Changes check ❓ Inconclusive Multiple changes appear out of scope: import path change in bsl/create.go, parent command logic in root.go, and removal of --force flag lack clear issue justification. Clarify whether changes to bsl/create.go imports, root.go parent command checks, and --force flag removal are addressed in the referenced issues #127, #124, #125.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description follows the required template structure with both 'Why' and 'How to test' sections and provides sufficient detail about the changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@Joeavaikath Joeavaikath changed the title Optimization fixes backup Bugfixes Feb 18, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/nabsl-request/get.go
Comment on lines 108 to 127
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)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

@weshayutin weshayutin merged commit b7c9e38 into migtools:oadp-dev Feb 18, 2026
16 checks passed
@Joeavaikath Joeavaikath deleted the optimization-fixes-backup branch February 19, 2026 15:09
@coderabbitai coderabbitai Bot mentioned this pull request Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove --force from NAB creation NABSL -o yaml does not work Delete command hangs NABSL requests not seen when not in the same namspace

2 participants