Skip to content

Conversation

@hugglesfox
Copy link
Contributor

@hugglesfox hugglesfox commented Nov 14, 2025

Enhancement:
Use __ad_integration_rh_distros instead of a fixed list when checking the distro release for determining the crypto policy

Reason:
Adds support for Alma and Rocky Linux
Fixes #39

Summary by Sourcery

Use a dynamic clone list to determine supported RHEL-based distributions when checking crypto policies to add support for Alma and Rocky Linux.

New Features:

  • Add support for Alma and Rocky Linux in crypto policy checks

Enhancements:

  • Replace hardcoded ['CentOS', 'RedHat'] list with __ad_integration_rh_distros for distribution checks

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 14, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces hardcoded Red Hat clones list with the dynamic __lsr_redhat_clones variable in distribution checks to extend support to Alma and Rocky Linux.

Class diagram for distribution check logic update

classDiagram
    class MainTask {
        +ansible_distribution: string
        +ansible_distribution_version: string
        +ad_integration_manage_crypto_policies: bool
        +ad_integration_allow_rc4_crypto: bool
        +crypto_policies_policy: string
    }
    class __lsr_redhat_clones {
        +["CentOS", "RedHat", "AlmaLinux", "RockyLinux", ...]
    }
    MainTask --> __lsr_redhat_clones: uses for distribution checks
Loading

File-Level Changes

Change Details Files
Use dynamic distribution list for crypto policy checks
  • Replaced ['CentOS', 'RedHat'] with __lsr_redhat_clones in Fedora/RHEL8+ condition
  • Replaced ['CentOS', 'RedHat'] with __lsr_redhat_clones in RHEL9 RC4 policy condition
tasks/main.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#39 Add support for Rocky Linux by including it in the relevant distribution conditionals in tasks/main.yml.

Possibly linked issues

  • Add support for Rocky #39: PR updates distribution checks to __lsr_redhat_clones, adding Rocky Linux support as requested in the issue.

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

@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 there - I've reviewed your changes - here's some feedback:

  • Verify that __lsr_redhat_clones is defined in your role defaults and includes all intended distros (Alma, Rocky, etc.) before using it in the when statements.
  • Consider using ansible_distribution_major_version for the version checks to simplify the when conditions and make them more readable.
  • The two crypto‐policy when blocks share very similar logic—extracting the distribution check into a separate variable or combined conditional could reduce duplication and improve maintainability.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Verify that __lsr_redhat_clones is defined in your role defaults and includes all intended distros (Alma, Rocky, etc.) before using it in the when statements.
- Consider using ansible_distribution_major_version for the version checks to simplify the when conditions and make them more readable.
- The two crypto‐policy when blocks share very similar logic—extracting the distribution check into a separate variable or combined conditional could reduce duplication and improve maintainability.

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.

@hugglesfox
Copy link
Contributor Author

Apologies for the force push, I forgot to signoff the commit

Copy link
Contributor

@richm richm left a comment

Choose a reason for hiding this comment

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

Use __ad_integration_rh_distros instead of __lsr_redhat_clones, or __ad_integration_rh_distros_fedora if this applies to Red Hat clones and Fedora

@hugglesfox
Copy link
Contributor Author

hugglesfox commented Nov 14, 2025

Done 🙂

I assume this check can't be simplified using __ad_integration_rh_distros_fedora

- (ansible_distribution == "Fedora" or
(ansible_distribution in __ad_integration_rh_distros and
ansible_distribution_version is version('8', '>=')))

@hugglesfox hugglesfox requested a review from richm November 14, 2025 08:39
@richm richm changed the title refactor: Use __lsr_redhat_clones when checking distribution refactor: Use __ad_integration_rh_distros when checking distribution Nov 14, 2025
@richm
Copy link
Contributor

richm commented Nov 14, 2025

[citest]

@richm richm merged commit 74ffae1 into linux-system-roles:main Nov 14, 2025
26 of 29 checks passed
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.

Add support for Rocky

2 participants