Skip to content

fix: handle_exceptions is not a valid parameter#864

Merged
richm merged 1 commit intolinux-system-roles:mainfrom
richm:debug-it
Apr 30, 2026
Merged

fix: handle_exceptions is not a valid parameter#864
richm merged 1 commit intolinux-system-roles:mainfrom
richm:debug-it

Conversation

@richm
Copy link
Copy Markdown
Contributor

@richm richm commented Apr 29, 2026

Signed-off-by: Rich Megginson rmeggins@redhat.com

Summary by Sourcery

Improve error handling and logging when forgetting a NetworkManager connection.

Bug Fixes:

  • Remove use of an invalid handle_exceptions parameter when invoking the forget_nm_connection command.

Enhancements:

  • Add info and error logging of the result and any exceptions when forgetting a NetworkManager connection.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 29, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the NetworkManager connection forgetting logic to remove an invalid subprocess parameter and add logging for both normal and exceptional paths.

Sequence diagram for updated forget_nm_connection subprocess handling

sequenceDiagram
    participant NetworkConnections
    participant Subprocess
    participant Logger

    NetworkConnections->>Subprocess: run_command(args)
    Subprocess-->>NetworkConnections: rc, stdout, stderr
    NetworkConnections->>Logger: log_info(0, forget_nm_connection rc, stdout, stderr)

    alt exception_raised
        NetworkConnections->>Logger: log_error(0, forget_nm_connection exception traceback)
    end
Loading

Flow diagram for updated forget_nm_connection control flow

flowchart TD
    A[forget_nm_connection called] --> B[Call run_command without handle_exceptions]
    B --> C{Exception raised?}
    C -- No --> D[log_info rc, stdout, stderr]
    D --> E[Return]
    C -- Yes --> F[log_error with traceback]
    F --> E[Return]
Loading

File-Level Changes

Change Details Files
Fix invalid subprocess call option and add logging around forget_nm_connection execution.
  • Remove unsupported handle_exceptions parameter from the subprocess helper invocation when forgetting a NetworkManager connection.
  • Capture and log the return code, stdout, and stderr from the forget operation on success.
  • Log full traceback details when an exception occurs during the forget operation to aid debugging.
library/network_connections.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@richm
Copy link
Copy Markdown
Contributor Author

richm commented Apr 29, 2026

[citest]

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The except Exception: pass block still swallows all errors; now that you log the traceback, consider either narrowing the exception type or re-raising after logging so unexpected failures aren’t silently ignored.
  • The new info-level log of every forget_nm_connection call may be noisy in normal operation; consider using a debug-level log or gating it behind a verbosity flag if this is primarily for troubleshooting.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `except Exception: pass` block still swallows all errors; now that you log the traceback, consider either narrowing the exception type or re-raising after logging so unexpected failures aren’t silently ignored.
- The new info-level log of every `forget_nm_connection` call may be noisy in normal operation; consider using a debug-level log or gating it behind a verbosity flag if this is primarily for troubleshooting.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.68%. Comparing base (1b57520) to head (1a94d07).
⚠️ Report is 91 commits behind head on main.

Files with missing lines Patch % Lines
library/network_connections.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
- Coverage   43.11%   42.68%   -0.43%     
==========================================
  Files          12       13       +1     
  Lines        3124     3160      +36     
==========================================
+ Hits         1347     1349       +2     
- Misses       1777     1811      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@richm
Copy link
Copy Markdown
Contributor Author

richm commented Apr 29, 2026

[citest]

@richm richm merged commit 0cd3b7a into linux-system-roles:main Apr 30, 2026
40 of 48 checks passed
@richm richm deleted the debug-it branch April 30, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant