Refactor #16987
closed
Explicit building of facets
Added by Lukas Zapletal about 8 years ago.
Updated over 6 years ago.
Category:
Plugin integration
|
Description
This is a ticket to track required refactoring of the Facet framework. Since I am in hurry with patch for Foreman 1.13 and downstream, I will propose a dirty patch into Katello. This ticket is about properly extending the Facet framework allowing facets to be created in a nice way when creating hosts in a different way (not via expected entry point).
Originally, this is needed for #16063
- Related to Bug #16063: Autoprovisioning fails with Katello plugin installed added
I suggest modifying #apply_inherited_attributes method to query facets about additional attributes that should be added to the host before it is created.
This won't solve the general case of building facets explicitly, unless we assume that "build_xxx_facet" method (which is added by the ActiveRecord framework) will be enough for facet initialization.
This could solve Katello's specific case, since the information to build content facet is available for the hostgroup that is being added to the host.
Basic outline of the suggested solution:
Each facet will have a class method (https://github.com/theforeman/foreman/blob/develop/app/models/host_facets/base.rb#L36) that will be called inside #apply_inherited_attributes. The result of this call will be added to the attributes list that is sent to ActiveRecord for further instantiation of the host.
Optional addition: the hostgroup could store a list of facets that should or should no be created by default - this list can be exposed to the user, so he can decide that despite the fact that the hostgroup contains info about a facet, that facet won't be created automatically.
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3987 added
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 189
Also available in: Atom
PDF