Project

General

Custom queries

Profile

Actions

Bug #16063

closed

Autoprovisioning fails with Katello plugin installed

Added by Lukas Zapletal almost 9 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Urgent
Category:
Content Views
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Autoprovisioning uses Host.becomes method to convert Discovered host to Managed which skips creating of any facets registered with Host::Managed. Method set_hostgroup_defaults is called, but Katello only sets ContentFacet flags when it's present:

      def set_hostgroup_defaults_with_katello_attributes
        if hostgroup.present?
          if content_facet.present?
            self.content_facet.kickstart_repository_id ||= hostgroup.inherited_kickstart_repository_id
          end
          assign_hostgroup_attributes(%w(content_source_id content_view_id lifecycle_environment_id))
        end
        set_hostgroup_defaults_without_katello_attributes
      end

ContentFacet cannot be created until hostgroup is associated, because it requires some (most) attributes to be present. Therefore it can't be created during discovery stage. It can be built as empty using build_content_facet during provisioning phase as well, because of required attributes. The only way is to build/create it explicitly reading all required attributes from hostgroup. Something like:

host.build_content_facet(
:kickstart_repository_id => rule.hostgroup.inherited_kickstart_repository_id,
:content_source_id => rule.hostgroup.content_source_id,
:content_view_id => rule.hostgroup.content_view_id,
:lifecycle_environment_id => rule.hostgroup.lifecycle_environment_id)

But Rails immediately stores ContentFacet model in the database since Host::Discovered is already saved (this is an undocumented behavior of ActiveRecord). Also this creates dependency between Discovery and Katello plugins.

We need to find a way to solve this.


Related issues 3 (0 open3 closed)

Related to Discovery - Bug #9784: Autoprovisioning via hostgroup does not populate all parameters via WebUI or APIClosedLukas Zapletal03/16/2015Actions
Related to Foreman - Refactor #16987: Explicit building of facetsClosedShimon Shtein10/18/2016Actions
Related to Foreman - Refactor #14699: Katello needs foreman's os_selected method to submit all form dataClosedPartha Aji04/18/2016Actions
#1

Updated by Lukas Zapletal almost 9 years ago

  • Bugzilla link set to 1364544
#2

Updated by Lukas Zapletal almost 9 years ago

  • Assignee set to Lukas Zapletal
  • Priority changed from Normal to Urgent
  • Target version set to 1.6.2
#3

Updated by Lukas Zapletal over 8 years ago

  • Related to Bug #9784: Autoprovisioning via hostgroup does not populate all parameters via WebUI or API added
#8

Updated by Daniel Lobato Garcia over 8 years ago

  • Target version changed from 1.6.2 to 1.5.2
#9

Updated by Lukas Zapletal over 8 years ago

#10

Updated by The Foreman Bot over 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/6401 added
#11

Updated by Lukas Zapletal over 8 years ago

  • Project changed from Discovery to Katello
  • Category changed from Discovery plugin to Content Views
#12

Updated by Eric Helms over 8 years ago

  • Translation missing: en.field_release set to 162
#13

Updated by Lukas Zapletal over 8 years ago

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

Updated by Lukas Zapletal about 8 years ago

  • Related to Refactor #14699: Katello needs foreman's os_selected method to submit all form data added
Actions

Also available in: Atom PDF