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 #38116 - Handle version removal for multi-CV hosts #11282

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

pavanshekar
Copy link
Contributor

What are the changes introduced in this pull request?

Added checks for multi-CV host associations and helper methods to handle version removal from the environment, ensuring that relevant content facets and environment links are cleaned up. This ensures that only the targeted version is removed without affecting unrelated associations or environments.

Considerations taken when implementing this change?

Ensured selective removal of associations for multi-CV hosts to avoid reassigning hosts linked to single CVEs or impacting unrelated environments, while preserving existing associations and removing only the targeted version from the hosts' content facets. Existing methods were reused for consistency and to minimize duplication, and checks were added to handle edge cases, such as multiple hosts linked to the same environment, to prevent unintended side effects.

What are the testing steps for this pull request?

Create a multi-CV activation key

  1. Promote a CV Version to multiple environments
  2. Using Hammer CLI, update the activation key to use mutli CVE
    Example command: hammer activation-key update --organization="Default Organization" --id=1 --content-view-environments="ABC/cv1,XYZ/cv1"
  3. Confirm that the activation key uses multi CVEs

Assign and register multiple hosts using the multi-CV activation key

Remove the version from the environment

  1. Go to the CV associated with the activation key -> Versions
  2. Click on the 3 dots of the respective CV Version and select the option "Remove from environments"
  3. Follow the steps to remove the CV Version from the environment
  4. A task will be created which should successfully remove the version from the environment when the CVE is in use by a multi-CV host

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Looks pretty good! some initial comments

@pavanshekar pavanshekar force-pushed the issue-38116 branch 3 times, most recently from c9c6b5a to a019aca Compare January 23, 2025 14:29
Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Tested and seems to work as expected, except for one comment below.

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Another edge case I found:

The correct content view environment label for "Library/Default Organization View" should just be "Library" (without the "Default Organization View").

image

I'm thinking it may be best to alter the rabl somehow to provide the correct content view environment labels, and then we wouldn't have to assemble them on the frontend..

Copy link
Member

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Works well and I feel much better about the logic now. Nice use of flatMap to find the correct content view environment :)

One more translation nit below, but feel free to merge :) ACK 👍

@chris1984 chris1984 merged commit 9c9d486 into Katello:master Feb 4, 2025
19 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.

3 participants