Project

General

Profile

Actions

Refactor #16987

closed

Explicit building of facets

Added by Lukas Zapletal about 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Plugin integration
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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 issues 3 (0 open3 closed)

Related to Katello - Bug #16063: Autoprovisioning fails with Katello plugin installedClosedLukas Zapletal08/11/2016Actions
Related to Foreman - Refactor #17439: Refactor facet base class to a concern.ClosedShimon Shtein11/22/2016Actions
Copied to Katello - Refactor #17869: Explicit building of facetsClosedShimon Shtein10/18/2016Actions
Actions #1

Updated by Lukas Zapletal about 8 years ago

  • Related to Bug #16063: Autoprovisioning fails with Katello plugin installed added
Actions #2

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).

Actions #3

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.

Actions #4

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
Actions #5

Updated by Shimon Shtein almost 8 years ago

  • Related to Refactor #17439: Refactor facet base class to a concern. added
Actions #6

Updated by Shimon Shtein almost 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #7

Updated by Dominic Cleal almost 8 years ago

  • Translation missing: en.field_release set to 189
Actions #8

Updated by Justin Sherrill almost 8 years ago

Actions

Also available in: Atom PDF