Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1127164 - Correctly set hostgroup after provisioning from PXE menu
Summary: Correctly set hostgroup after provisioning from PXE menu
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Puppet
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Amir
QA Contact: Lukas Zapletal
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2014-08-06 10:08 UTC by Nick Strugnell
Modified: 2021-03-11 14:14 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 6952 0 None None None 2016-04-22 16:55:56 UTC

Internal Links: 1198065 1198070

Description Nick Strugnell 2014-08-06 10:08:13 UTC
Description of problem:
When we provision from the standard PXE menu, we can choose which hostgroup template to install the new server from.

Version-Release number of selected component (if applicable):
6 beta


How reproducible:
always


Steps to Reproduce:
1. Create some hostgroups with associated content views and lifecycle environments
2. Build the PXE default menu from the Provisioning Templates screen
3. PXE boot a new server
4. From the boot menu, select a hostgroup boot option

Actual results:
Machine boots and installs, however once it has registered with foreman, it is not in a hostgroup


Expected results:
The newly installed machine should be in the same hostgroup that we selected in the PXE menu.


Additional info:
Candidate patch:

patch -p0 -l -f << EOF
--- /usr/share/foreman/app/models/host/managed.rb      2014-08-06 08:24:18.912311511 +0000
+++ /usr/share/foreman/app/models/host/managed.rb  2014-08-06 09:06:02.716311124 +0000
@@ -404,6 +404,14 @@
     host ||= Host.new(:name => hostname, :certname => certname) if Setting[:create_new_host_when_facts_are_uploaded]
 
     return Host.new, true if host.nil?
+
+    # set hostgroup defaults if provided by a fact
+    hostgroup_fact='foreman_hostgroup'
+    if facts.keys.include?(hostgroup_fact)
+      host.hostgroup = Hostgroup.find_by_title(facts[hostgroup_fact])
+      host.set_hostgroup_defaults
+    end
+
     # if we were given a certname but found the Host by hostname we should update the certname
     host.certname = certname if certname.present?
 
EOF

Comment 1 RHEL Program Management 2014-08-06 10:13:46 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Dominic Cleal 2014-08-06 10:19:26 UTC
Created redmine issue http://projects.theforeman.org/issues/6952 from this bug

Comment 4 Peter Vreman 2015-03-03 10:22:48 UTC
Looks like the foreman-plugin-default-hostgroup provides already basic code to select a hostgroup. One thing that is missing in that plugin is a dynamic hostgroup name based on facts. E.g. a foreman_hostgroup facts that the host can provide to select its own custom hostgroup.

Comment 5 Peter Vreman 2015-03-03 13:02:51 UTC
Added two new requests to use the foreman plugin default_hostgroup
BZ1198065
BZ1198070

Comment 6 Peter Vreman 2015-08-04 11:45:12 UTC
This request to select the right hostgroup also applies to AWS dynamic workload (autoscaling and spot instance). The cloud-init script can then generate the foreman_xxxxx facts and then call puppet agent to have the host registered

Comment 7 Peter Vreman 2016-03-16 13:15:57 UTC
For the foreman plugin default_hostgroup i have opened an issue to request for dynamic hostgroup name based on a fact. Currently this is not allowed yet.

https://github.com/theforeman/foreman_default_hostgroup/issues/16

Comment 8 Bryan Kearney 2016-08-10 19:02:22 UTC
Upstream bug component is Configuration Management

Comment 9 Bryan Kearney 2016-08-10 20:03:28 UTC
Upstream bug component is Provisioning

Comment 10 Bryan Kearney 2016-08-10 22:03:14 UTC
Upstream bug component is Puppet

Comment 11 Peter Vreman 2016-08-31 08:40:12 UTC
Confirm that the patch is still needed and also still working for Sat6.2.1

Comment 14 Daniel Lobato Garcia 2016-12-23 07:40:50 UTC
https://github.com/theforeman/foreman/pull/4112 nearly ready for merge upstream

Comment 15 Satellite Program 2017-01-09 14:48:31 UTC
Upstream bug assigned to afeferku

Comment 16 Satellite Program 2017-01-09 14:48:36 UTC
Upstream bug assigned to afeferku

Comment 17 Satellite Program 2017-01-11 13:18:50 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/6952 has been resolved.

Comment 18 Lukas Zapletal 2017-08-23 11:52:14 UTC
[root@zzzap ~]# rpm -q foreman katello
foreman-1.15.3-1.el7sat.noarch
katello-3.4.4-2.el7sat.noarch

Comment 19 Satellite Program 2018-02-21 16:54:17 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> 
> For information on the advisory, and where to find the updated files, follow the link below.
> 
> If the solution does not work for you, open a new bug report.
> 
> https://access.redhat.com/errata/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.