Skip to content

Remove golden_ticket? method and simplify SCA handling#1158

Merged
jeremylenz merged 2 commits intotheforeman:developfrom
jeremylenz:remove-golden-ticket-method
Feb 24, 2026
Merged

Remove golden_ticket? method and simplify SCA handling#1158
jeremylenz merged 2 commits intotheforeman:developfrom
jeremylenz:remove-golden-ticket-method

Conversation

@jeremylenz
Copy link
Collaborator

@jeremylenz jeremylenz commented Feb 24, 2026

What are the changes introduced in this pull request?

This PR removes the obsolete golden_ticket? helper method and simplifies Simple Content Access (SCA) handling in inventory reports. The changes include:

  • Removed the golden_ticket? method from FactHelpers which referenced Katello methods that no longer exist (golden_ticket? and content_access_mode)
  • Changed is_simple_content_access field to always be true in inventory reports, since all organizations are now in SCA mode
  • Removed associated tests for the obsolete method
  • Updated test data in inventory sync tests to reflect that all organizations are in SCA mode

Considerations taken when implementing this change?

  • Katello 4.12 removed entitlement mode and migrated all organizations to SCA-only mode (commits f174f2ed65, 16cbea2ed6, ec23330bd7)
  • The is_simple_content_access field is still included in inventory reports (for cloud API compatibility), but is now always true instead of conditionally checking organization settings
  • This is backward compatible since the field will always have the correct value for current Katello/Satellite installations

What are the testing steps for this pull request?

  1. Run the full test suite to verify no regressions: cd /home/vagrant/foreman && bundle exec rake test:foreman_rh_cloud
  2. (Optional) Generate an inventory report for an organization and verify is_simple_content_access: true appears in the satellite facts
  3. (Optional) Upload an inventory report to verify the cloud API accepts it with the field set to true

🤖 Generated with Claude Code

Summary by Sourcery

Remove legacy Simple Content Access (SCA) handling and always report SCA as enabled in inventory uploads.

Bug Fixes:

  • Ensure the is_simple_content_access fact in generated inventory reports is consistently true to match current SCA-only behavior.

Enhancements:

  • Remove the obsolete golden_ticket? helper and its caching, simplifying SCA-related logic in fact generation.
  • Clean up tests and helpers that stub or depend on golden_ticket? to reflect the always-on SCA model.
  • Update inventory sync test fixtures to expect is_simple_content_access to be true in all generated reports.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes the obsolete golden_ticket?-based logic from inventory report generation and hardcodes Simple Content Access to always be enabled, while updating tests and fixtures to match the new SCA-only behavior.

Class diagram for updated inventory fact generation helpers

classDiagram

class FactHelpers {
  +account_id(organization)
  +cloud_provider(host)
}

class Slice {
  +report_satellite_facts(host)
}

FactHelpers <.. Slice : uses
Loading

File-Level Changes

Change Details Files
Remove golden_ticket? helper and its usage from inventory slice generation logic.
  • Delete golden_ticket? method and its memoization cache from FactHelpers.
  • Stop stubbing golden_ticket? in archived report generator tests and slice generator helper method.
  • Change report_satellite_facts to always emit is_simple_content_access as true instead of consulting organization settings.
lib/foreman_inventory_upload/generators/fact_helpers.rb
lib/foreman_inventory_upload/generators/slice.rb
test/unit/archived_report_generator_test.rb
test/unit/slice_generator_test.rb
Simplify tests to reflect SCA-only mode and remove behavior tied to golden ticket logic.
  • Remove unit tests that verify golden_ticket? behavior and slice generation for golden ticket organizations.
  • Update inventory sync job tests to expect is_simple_content_access: true in all inventory payloads.
  • Simplify test slice generator helper to no longer stub golden_ticket? by default.
test/unit/fact_helpers_test.rb
test/unit/slice_generator_test.rb
test/jobs/inventory_hosts_sync_test.rb
test/jobs/inventory_full_sync_test.rb
test/jobs/inventory_self_host_sync_test.rb

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

Katello removed the golden_ticket? and content_access_mode methods in
4.12 when migrating all organizations to Simple Content Access (SCA)
mode. This change removes the obsolete golden_ticket? helper method
and simplifies the is_simple_content_access field to always be true,
since all organizations are now in SCA mode.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jeremylenz jeremylenz force-pushed the remove-golden-ticket-method branch from 9f62062 to 2ba7df9 Compare February 24, 2026 17:43
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 - I've reviewed your changes and they look great!


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.

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

Looks good to me, don't see any more references to golden_ticket?

I was wondering if it might make sense to add a small assertion in an existing slice generator test to check that is_simple_content_access is true in the rendered output. The old “golden ticket” test was the only one covering that field in generated reports, so this might help keep that covered. I will leave that up to you and not block it.

Tested:

  • Generate an inventory report for an organization and verify is_simple_content_access: true appears in the satellite facts
  • Upload an inventory report to verify the cloud API accepts it with the field set to true

Adds assertion to verify is_simple_content_access is true in slice
generator output, maintaining coverage after golden ticket test removal.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jeremylenz
Copy link
Collaborator Author

@chris1984 good idea, added an assertion. 👍

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding the assertion.

@jeremylenz jeremylenz merged commit badcec1 into theforeman:develop Feb 24, 2026
13 of 14 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.

2 participants