Bug 1127164
| Summary: | Correctly set hostgroup after provisioning from PXE menu | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Nick Strugnell <nstrug> |
| Component: | Puppet | Assignee: | Amir <afeferku> |
| Status: | CLOSED ERRATA | QA Contact: | Lukas Zapletal <lzap> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.0.4 | CC: | bbuckingham, bkearney, brubisch, cwelton, dlobatog, lzap, ohadlevy, peter.vreman |
| Target Milestone: | Unspecified | Keywords: | PrioBumpPM, Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://projects.theforeman.org/issues/6952 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-02-21 16:54:17 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1122832 | ||
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. 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. https://github.com/theforeman/foreman_default_hostgroup/issues/16 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 afeferku Upstream bug assigned to afeferku 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 foreman-1.15.3-1.el7sat.noarch katello-3.4.4-2.el7sat.noarch 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
|
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