Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #38014 - Add safe navigation for empty capsule content counts #970

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

chris1984
Copy link
Member

@chris1984 chris1984 commented Nov 14, 2024

What are the changes introduced in this pull request?

  • There is an action in Katello that can cause capsule content counts to be an empty hash, we don't safely navigate in Ruby to handle this and hammer blows up with a traceback causing a bad user experience. @sjha4 can probably add more context on how it happens.

  • Added some unit tests to account for the empty hash and to make sure we handle it correctly

What are the testing steps for this pull request?

  • Spin up a Satellite/Capsule or if you have a katello devel box add a smartproxy to it
  • Have a Satellite with external Capsule, turn automatic content count calculation off.
  • Create an LCE, assign it to the Capsule.
  • Create and sync some repo (fake_yum1)
  • Create a CV, add the repo to it, publish and promote to the LCE -> Capsule gets autosynced.
  • On the Satellite/Devel box run the following:
  • foo = SmartProxy.find(X)
  • foo.content_counts = {}
  • foo.save
  • On Satellite try `hammer capsule content info --id X
  • Apply PR and see if it shows the Capsule content info without a traceback

Copy link
Member

@sjha4 sjha4 left a comment

Choose a reason for hiding this comment

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

Ack..Tested with content_counts populated, nil and {}. Output is formatted correctly for all cases. 💚

@chris1984 chris1984 merged commit ff599e1 into Katello:main Nov 20, 2024
12 checks passed
@chris1984 chris1984 deleted the capsule-safenav branch November 20, 2024 15:40
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.

2 participants