Bug #6958
closedHostgroup provisioning does not support nested groups
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:
Updated by Dominic Cleal over 10 years ago
- Category set to Unattended installations
Updated by Bryan Kearney almost 9 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
Updated by The Foreman Bot over 8 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3489 added
Updated by Amir Fefer over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 06cd3955c9b2b48289e6698b195f4e36ad8aefbc.
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release set to 136