-
Notifications
You must be signed in to change notification settings - Fork 290
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 #16063 - content facet builds when not present #6401
Conversation
@lzap, thanks for your PR! By analyzing the history of the files in this pull request, we identified @xprazak2, @jlsherrill and @bbuckingham to be potential reviewers. |
c995a17
to
38a877d
Compare
Fixed hound comment. Also CCing @ehelms as I am providing backported version already (it's tested on 6.2.2). Reproducer: Create a rule "always" with "cpu_count > 1" and associate with any hostgroup that has some Content (View, Environment, Source, Repo) associated. Discover a fake host (*) and AUTO provision it. Check the host if it has all the content flags set. Without the patch, all the fields are empty, thus provisioning would fail. (*) https://github.com/lzap/bin-public/blob/master/discover-host - script that creates "fake" discovery hosts |
@@ -75,7 +75,18 @@ def content_and_puppet_match? | |||
end | |||
|
|||
def inherited_attributes_with_katello | |||
self.content_facet.kickstart_repository_id ||= hostgroup.inherited_kickstart_repository_id if content_facet.present? | |||
if hostgroup.present? | |||
if content_facet.present? |
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.
We should probably check to see if the hostgroup has a content_view and lifecycle_env first. Content facets aren't valid if both of those are not present.
Err, this should really have been tagged at the build_content_facet part below
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.
Sure, plus as per IRC discussion, I should use "inherited_" flags everywhere.
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.
Fixed.
@lzap, the Redmine ticket used is for a different project than the one associated with this GitHub repository. Please either:
This message was auto-generated by Foreman's prprocessor |
38a877d
to
35de759
Compare
@lzap, the Redmine ticket used is for a different project than the one associated with this GitHub repository. Please either:
This message was auto-generated by Foreman's prprocessor |
Amended the change, also updated the backport code bit in the description. Please test the version against develop Katello before merging, I was testing with older version. Moved the Issue to Katello project. Thanks. |
Ping - see my instructions above how to test this. It's not complex, don't worry :-) |
if hostgroup.inherited_content_view_id && hostgroup.inherited_lifecycle_environment_id | ||
build_content_facet( | ||
:kickstart_repository_id => hostgroup.inherited_kickstart_repository_id, | ||
:content_source_id => hostgroup.inherited_content_source_id, |
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.
getting an error because of this line:
unknown attribute 'content_source_id' for Katello::Host::ContentFacet.
content_source_id is actually on the host object.
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.
Deleting this line, and removing 'content_view_id' and 'lifecycle_environment_id' from the line below:
inherited_attributes_without_katello.concat(%w(content_source_id content_view_id lifecycle_environment_id))
Seems to make it all work.
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.
I'll work on reviewing it quickly after a turnaround :)
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.
Many thanks, let me fix this.
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.
Allright, did you mean this?
diff --git a/app/models/katello/concerns/host_managed_extensions.rb b/app/models/katello/concerns/host_managed_extensions.rb
index 23fc0f1..202ed53 100644
--- a/app/models/katello/concerns/host_managed_extensions.rb
+++ b/app/models/katello/concerns/host_managed_extensions.rb
@@ -83,13 +83,12 @@ module Katello
if hostgroup.inherited_content_view_id && hostgroup.inherited_lifecycle_environment_id
build_content_facet(
:kickstart_repository_id => hostgroup.inherited_kickstart_repository_id,
- :content_source_id => hostgroup.inherited_content_source_id,
:content_view_id => hostgroup.inherited_content_view_id,
:lifecycle_environment_id => hostgroup.inherited_lifecycle_environment_id)
end
end
end
- inherited_attributes_without_katello.concat(%w(content_source_id content_view_id lifecycle_environment_id))
+ inherited_attributes_without_katello.concat(%w(content_source_id))
end
def import_package_profile(simple_packages)
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.
Pushed! Thanks for help with this one.
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.
Yep exactly, thanks! will re-test
35de759
to
bd8fb1c
Compare
APJ |
Sorry, what's that? |
ACK Pending Jenkins :) |
[test] |
thanks @lzap! merging 🍖 |
Thank you so much @jlsherrill ! Is there any chance of getting this into latest stable Katello? Because provisioning is basically blocked for upstream stable users. |
@lzap yep it'll be cherrypicked for 3.2 GA |
Katello as well as the facet framework assumes that the only entrypoint for
host objects are our UI and API controllers (host#create). Facet framework
hooks into there and it just works.
Except there is more. Discovered hosts can be provisioned either via edit host
form (which works with facets) but also via autoprovisioning which is an
alternative path which is missed by Facet framework.
Until Shim comes up with a nicer solution, I propose this "dirty" patch that
explicitly builds the facet object when it's not present. This fixes the issue
in Foreman 1.13, 1.12 and Satellite 6.2 and 6.3. The symptoms are that all
auto-provisioned hosts are completely missing all content flags (source, view,
environment, kickstart repo) and fails provisioning.
I also created and tested downstream version against Satellite 6.2 because
there is opened ticket for 6.2 errata (there were several changes in the
codebase already), so the patch looks like this:
References:
Original issue I need to fix in Foreman and Satellite:
http://projects.theforeman.org/issues/16063
Planned change in Facet framework:
http://projects.theforeman.org/issues/16987
BZ for 6.2:
https://bugzilla.redhat.com/show_bug.cgi?id=1364544