Refactor #16987
closedExplicit building of facets
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
Updated by Lukas Zapletal about 8 years ago
- Related to Bug #16063: Autoprovisioning fails with Katello plugin installed added
Updated by Lukas Zapletal about 8 years ago
Fore more info visit https://github.com/Katello/katello/pull/6401
Shimon, I assigned to you if you don't mind.
This is not refactoring, but rather extending the code (bad wording).
Updated by Shimon Shtein about 8 years ago
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.
Updated by The Foreman Bot about 8 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3987 added
Updated by Shimon Shtein about 8 years ago
- Related to Refactor #17439: Refactor facet base class to a concern. added
Updated by Shimon Shtein almost 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 86f7f4f58a08488c0ea7d3e06c71eaba2be71d57.
Updated by Dominic Cleal almost 8 years ago
- Translation missing: en.field_release set to 189
Updated by Justin Sherrill almost 8 years ago
- Copied to Refactor #17869: Explicit building of facets added