Skip to content

refactor: add Ansible test python boilerplate#107

Merged
richm merged 1 commit intolinux-system-roles:mainfrom
richm:refactor-add-ansible-boilerplate
May 19, 2025
Merged

refactor: add Ansible test python boilerplate#107
richm merged 1 commit intolinux-system-roles:mainfrom
richm:refactor-add-ansible-boilerplate

Conversation

@richm
Copy link
Copy Markdown
Contributor

@richm richm commented May 19, 2025

ansible-test requires certain python boilerplate in module
and module_utils files.

Signed-off-by: Rich Megginson [email protected]

Summary by Sourcery

Enhancements:

  • Add future imports (absolute_import, division, print_function) and metaclass declaration to modules for ansible-test compatibility

@richm richm requested a review from spetrosi as a code owner May 19, 2025 21:23
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented May 19, 2025

Reviewer's Guide

Introduces the required Ansible test Python boilerplate across all snapshot_lsr module_utils files to ensure consistent compatibility and testability.

Flow Diagram: Addition of Ansible Boilerplate to Python Modules

graph TD
    subgraph "Affected Modules in module_utils/snapshot_lsr/"
        direction LR
        M1["consts.py"]
        M2["lvm.py"]
        M3["lvm_utils.py"]
        M4["snapmgr.py"]
        M5["utils.py"]
        M6["validate.py"]
    end
    Boilerplate["Ansible Test Python Boilerplate Added:\n- from __future__ import ...\n- __metaclass__ = type"]

    Boilerplate -->|Applied to| M1
    Boilerplate -->|Applied to| M2
    Boilerplate -->|Applied to| M3
    Boilerplate -->|Applied to| M4
    Boilerplate -->|Applied to| M5
    Boilerplate -->|Applied to| M6
Loading

File-Level Changes

Change Details Files
Add Ansible-test required Python boilerplate to module_utils files
  • Insert future imports (absolute_import, division, print_function) at top of each file
  • Define metaclass = type for Python 2/3 compatibility
  • Maintain existing module definitions without altering logic
module_utils/snapshot_lsr/consts.py
module_utils/snapshot_lsr/lvm.py
module_utils/snapshot_lsr/lvm_utils.py
module_utils/snapshot_lsr/snapmgr.py
module_utils/snapshot_lsr/utils.py
module_utils/snapshot_lsr/validate.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

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 @richm - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

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.

ansible-test requires certain python boilerplate in module
and module_utils files.

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the refactor-add-ansible-boilerplate branch from a03c58a to 1b16beb Compare May 19, 2025 21:57
@richm richm merged commit fba2a2e into linux-system-roles:main May 19, 2025
26 checks passed
@codecov
Copy link
Copy Markdown

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@1b0bef5). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             main   #107   +/-   ##
=====================================
  Coverage        ?      0           
=====================================
  Files           ?      0           
  Lines           ?      0           
  Branches        ?      0           
=====================================
  Hits            ?      0           
  Misses          ?      0           
  Partials        ?      0           

☔ 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.

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