Project

General

Profile

Bug #6958

Hostgroup provisioning does not support nested groups

Added by Dominic Cleal over 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Unattended installations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1127267
Description of problem:
The host group interface provides the opportunity to nest host groups, with host groups inheriting parameters from parents.

When the default PXE menu is created however, this nesting is not replicated and only the final element of the hostgroup path is inserted into the kickstart URL.

e.g. we might have nested groups:

dev/SAPServers
qa/SAPServers
prod/SAPServers

where dev, qa and prod have e.g. different root passwords.

However, the PXE template generated will generate an identical kickstart URL for each group:

http://foreman.example.com/unattended/template/kickstart-templ/SAPServers

and all servers will install with parameters from the first host group (e.g. dev/SAPServers)

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

How reproducible:
always

Steps to Reproduce:
1. Set up nested host groups
2. Generate default PXE menu
3. PXE boot host
4. Hit tab to inspect the kickstart URL

Actual results:
As above, kickstart URL only contains the last path element of the hostgroup and therefore are not unique to each hostgroup

Expected results:
kickstart URLs should be unique to each hostgroup to ensure that @host.params are inherited from the correct parent hostgroup.

Additional info:

Associated revisions

Revision 06cd3955 (diff)
Added by Amir Fefer over 4 years ago

Fixes #6958 - supports in nested hostgroup in default PXE menu

The host group interface provides the opportunity to nest hostgroups,
with host groups inheriting parameters from parents.
when the default PXE menu is created however,
this nesting is not replicated, and only the final element
of the hostgroup path is inserted into the kickstart URL.

History

#1 Updated by Dominic Cleal over 6 years ago

  • Category set to Unattended installations

#2 Updated by Bryan Kearney almost 5 years ago

Proposed patch from downstream.

patch p0 -l -f << EOF
--
/usr/share/foreman/app/controllers/unattended_controller.rb
+++ /usr/share/foreman/app/controllers/unattended_controller.rb
@ -44,7 +44,7 @
return head(:not_found) unless (params.has_key?("id") and params.has_key?(:hostgroup))

template = ConfigTemplate.find_by_name(params['id'])
- @host = Hostgroup.find_by_name(params['hostgroup'])
+ @host = Hostgroup.find_by_title(params['hostgroup'].gsub('::','/'))
return head(:not_found) unless template and @host

EOF
patch p0 -l -f << EOF
--
/usr/share/foreman/app/controllers/api/v2/config_templates_controller.rb
+++ /usr/share/foreman/app/controllers/api/v2/config_templates_controller.rb
@ -97,7 +97,7 @ module Api

url_for :only_path => false, :action => :template, :controller => '/unattended',
:protocol => protocol, :host => host, :port => port,
- :id => template.name, :hostgroup => hostgroup.name
+ :id => template.name, :hostgroup => hostgroup.title.gsub('/','::')
end
def process_template_kind

EOF
patch p0 -l -f << EOF
--
/usr/share/foreman/app/controllers/config_templates_controller.rb
+++ /usr/share/foreman/app/controllers/config_templates_controller.rb
@ -69,7 +69,7 @

def default_template_url template, hostgroup
url_for :only_path => false, :action => :template, :controller => '/unattended',
- :id => template.name, :hostgroup => hostgroup.name
+ :id => template.name, :hostgroup => hostgroup.title.gsub('/','::')
end
def controller_permission

EOF

#3 Updated by Ohad Levy almost 5 years ago

  • Assignee set to Amir Fefer

#4 Updated by The Foreman Bot over 4 years ago

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

#5 Updated by Amir Fefer over 4 years ago

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

#6 Updated by Dominic Cleal over 4 years ago

  • Legacy Backlogs Release (now unused) set to 136

Also available in: Atom PDF