-
Notifications
You must be signed in to change notification settings - Fork 284
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 #36498 - Don't try to unset a host's CV/LCE when inheriting from hostgroup #10595
Fixes #36498 - Don't try to unset a host's CV/LCE when inheriting from hostgroup #10595
Conversation
Issues: #36498 |
7edbe46
to
50076fa
Compare
a7b1183
to
0a5a0e5
Compare
0a5a0e5
to
c76af7d
Compare
return attributes if facet_attrs.blank? | ||
cv_id = facet_attrs['content_view_id'] | ||
lce_id = facet_attrs['lifecycle_environment_id'] | ||
if initialized && (cv_id.blank? || lce_id.blank?) |
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.
If both cv_id
and lce_id
are blank, what then?
I considered adding explicit logic for this. But I think we're okay without it, because the two cases are
- Host with content facet: will already have a valid LCE and CV, and the host will use its existing values
- Host without content facet:
facet_attrs
will benil
, meaning this code path isn't touched
anyway, I couldn't get it to error in my testing. But let me know if I'm wrong :D
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.
Working fine for me!
…m hostgroup (Katello#10595) * Fixes #36498 - Don't try to unset a host's CV/LCE when inheriting from hostgroup * Refs #36498 - fix test (cherry picked from commit 08941da)
…m hostgroup (Katello#10595) * Fixes #36498 - Don't try to unset a host's CV/LCE when inheriting from hostgroup * Refs #36498 - fix test (cherry picked from commit 08941da)
What are the changes introduced in this pull request?
Redefines Foreman's
apply_inherited_attributes
method (fromHost::Managed
) to address the case where eithercontent_view_id
orlifecycle_environment_id
are blank. Since they must now be provided together, having a hostgroup where only one of them is set causes problems.Considerations taken when implementing this change?
This whole issue should go away once we make the same multi-CV changes to
Hostgroup::ContentFacet
that have already been made toHost::ContentFacet
.What are the testing steps for this pull request?
Create a hostgroup with CV and LCE
Edit the hostgroup and remove the LCE (click the X)
Go to one of your hosts and click Edit
Assign the host to the hostgroup and click Submit
Before patch: an error
content_view_id and lifecycle_environment_id must be provided together
After patch: no errors
Click around other host and hostgroup edit flows and make sure nothing is broken