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):
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
Machine boots and installs, however once it has registered with foreman, it is not in a hostgroup
The newly installed machine should be in the same hostgroup that we selected in the PXE menu.
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
+ if facts.keys.include?(hostgroup_fact)
+ host.hostgroup = Hostgroup.find_by_title(facts[hostgroup_fact])
# if we were given a certname but found the Host by hostname we should update the certname
host.certname = certname if certname.present?
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.
Created redmine issue http://projects.theforeman.org/issues/6952 from this bug
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.
Added two new requests to use the foreman plugin default_hostgroup
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
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.
Upstream bug component is Configuration Management
Upstream bug component is Provisioning
Upstream bug component is Puppet
Confirm that the patch is still needed and also still working for Sat6.2.1
https://github.com/theforeman/foreman/pull/4112 nearly ready for merge upstream
Upstream bug assigned to email@example.com
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/6952 has been resolved.
[root@zzzap ~]# rpm -q foreman katello
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.