Bug #6952

Correctly set hostgroup after provisioning from PXE menu

Added by Dominic Cleal over 2 years ago. Updated about 1 month ago.

Status:Closed
Priority:Normal
Assigned To:Amir Fefer
Category:Puppet integration
Target version:Team Daniel - Iteration 9
Difficulty: Bugzilla link:1127164
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4112
Story points-
Velocity based estimate-
Release1.15.0Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1127164
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
+
  1. if we were given a certname but found the Host by hostname we should update the certname
    host.certname = certname if certname.present?

EOF

Associated revisions

Revision 9883149a
Added by Amir Fefer 2 months ago

Fixes #6952 - Set hostgroup after provisioning from pxe

After hostgroup provisioning, when the machine has registered
with foreman, it should be in the same hostgroup.
to achieve this behavier, the fact foreman_hostgroup should be
added to hostgroup provisioning template

History

#1 Updated by Dominic Cleal over 2 years ago

  • Category set to Puppet integration

#2 Updated by Ohad Levy about 1 year ago

  • Assigned To set to Amir Fefer

#3 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4112 added

#4 Updated by Amir Fefer 2 months ago

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

#5 Updated by Dominic Cleal 2 months ago

  • Release set to 1.15.0

#6 Updated by Daniel Lobato Garcia about 1 month ago

  • Target version set to Team Brad - Iteration 11

#7 Updated by Brad Buckingham about 1 month ago

  • Target version deleted (Team Brad - Iteration 11)

#8 Updated by Daniel Lobato Garcia about 1 month ago

  • Target version set to Team Daniel - Iteration 9

Also available in: Atom PDF