Project

General

Profile

Actions

Bug #37602

open

Missing installation media during Host Registration: ERROR: Validation failed: Medium must belong to host's operating system

Added by Bernhard Suttner 7 months ago. Updated 6 months ago.

Status:
Ready For Testing
Priority:
Normal
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

If you register a host using the new Host Registration approach, a host is generated using the subscription-manager. This will create a OS in foreman but this new OS doesn’t have the installation media assigned (because its a new OS).

If you do this and you selected a HostGroup which uses an Operatingsystem + Installation Medium, it will exit with:

The system has been registered with ID: 21312a8f-1b6e-4302-ae9e-1a64b643c6f8
The registered system name is: myra-bergh.master.dev.atix
ERROR: Validation failed: Medium must belong to host's operating system

It fails because of this validation during during the POST request:

  validates :medium_id, :presence => true,
                        :if => proc { |host| host.validate_media? }
  validates :medium_id, :inclusion => {:in => proc { |host| host.operatingsystem.medium_ids },
                                       :message => "must belong to host\'s operating system"},
                        :if => proc { |host| host.operatingsystem && host.medium  }

Analyzed the issue:

During registration

  1. A host group is set in the HostReg formular
    • This host group has an assigned OS
    • This host group has an assigned Installation Media
    • A OS is set in the formular (Alma 8.X) (not really related to this issue)
  1. subscription-manager registers and
    • the OS is created on foreman (Alma 8.10) based on the sent facts
    • this OS (Alma 8.10) doesn’t have a installation media

The OS, which is set in the formular is NOT send in the POST to foreman (maybe an issue - but maybe correct) (1)

The Host group is now used and same options are tried to be used in the Host Init POST request.

The issue does now occur, because the assigned OS (Alma 8.10) for the host does NOT include the installation media, which is part of the Host Group.

(1) if the OS is pushed in the POST in the global registration template (register_katello_host method) than everything works BUT it will create a OS “Alma 8.10” and later assign Alma 8.X to this host - means, a OS is generated which will then not be used.

Notice:
- if the Hostgroup doesn't have a Operatingsystem OR Installation Media > everything works
If the Operatingsystem of the Host, is already configured on foreman, including valid Installatin Media -> everything works

Actions #1

Updated by Bernhard Suttner 7 months ago

  • Description updated (diff)
Actions #2

Updated by The Foreman Bot 7 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Bernhard Suttner
  • Pull request https://github.com/theforeman/foreman/pull/10226 added
Actions #3

Updated by Bernhard Suttner 6 months ago

  • Description updated (diff)
Actions #4

Updated by Bernhard Suttner 6 months ago

  • Description updated (diff)
Actions #5

Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/theforeman/foreman/pull/10246 added
Actions #6

Updated by The Foreman Bot 6 months ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/10226, https://github.com/theforeman/foreman/pull/10246)
Actions #7

Updated by The Foreman Bot 6 months ago

  • Pull request https://github.com/theforeman/foreman/pull/10246 added
Actions

Also available in: Atom PDF