-
Notifications
You must be signed in to change notification settings - Fork 295
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 #38270 - Don't create content view environment when CV is not published to LCE #11338
Fixes #38270 - Don't create content view environment when CV is not published to LCE #11338
Conversation
a4c74d0
to
6ab8066
Compare
Requires theforeman/hammer-cli-foreman#638 to see the hammer error. |
6ab8066
to
4943f41
Compare
I have confirmed that this is working as intended for both a valid and invalid combination of CV and LE. I need to investigate the test failures before acking, however. |
cv_name = ::Katello::ContentView.find_by(:id => content_view_id)&.name | ||
fail ::Katello::Errors::ContentViewEnvironmentError, _("Unable to find a content view with ID %s") % content_view_id if cv_name.nil? | ||
env_name = ::Katello::KTEnvironment.find_by(:id => lifecycle_environment_id)&.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeremylenz Shouldn't these use labels and not names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Labels now render instead of names:
Could not create the host:
Cannot assign content view environment RHEL_9_LE/Default_Organization_View: The content view has either not been published or has not been promoted to that lifecycle environment.
4943f41
to
62721a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring the failing React tests due to us waiting on Patternfly 5, everything looks great! I was able to confirm the error renders properly with the related hammer PR and we're no longer creating new CVEs. The source looks good to me so I'm ACKing!
62721a5
to
55843a2
Compare
Rebased |
Ruby test failures are related! looking |
55843a2
to
d762594
Compare
updated tests |
What are the changes introduced in this pull request?
Previously Katello would create a
Katello::ContentViewEnvironment
when creating a host, if none existed with that combination of cv/lce. The problem is that creating one without the corresponding Pulp content being hosted (e.g. publishing/promoting the content view to the LCE) will break things.Considerations taken when implementing this change?
The UI already guards against this, so I think this fix is mainly for Robottelo.
What are the testing steps for this pull request?
Try
hammer host create
with--lifecycle-environment-id
and--content-view-id
optionsWith a valid combination (published/promoted CV), it should work.
With an invalid combination, you should get one of the new error messages (see the code).