Actions
Bug #16805
closedHost group change on host edit does not reload parameters etc.
Description
When editing a host and changing its host group, the parameters tab isn't reloaded with data coming from the new host group. If you save the host and revisit the page, the host group parameters are now shown.
The implementation of handleHostgroupChangeEdit in host_edit.js suggests that it should via the third part of this conditional:
244 function handleHostgroupChangeEdit(element, host_id, host_changed) { 1 if (host_changed){ 2 update_form(element,{data:"&host[id]="+host_id}) 3 } else if (host_changed == undefined) { // hostgroup changes parent 4 update_form(element) 5 } else { // edit host 6 set_inherited_value(element); 7 update_puppetclasses(element); 8 reload_host_params(); 9 } 10 }
Instead when the host group is changed, the second part (designed for the hostgroup#edit form, changing parent) is followed instead. This stems from the "data-type-changed" attribute being missing on the host form, due to Rails bug https://github.com/rails/rails/issues/24220, fixed in 5.0.0. In app/views/hosts/_form.html.erb, @host.type_changed?
may return nil, it should be !!@host.type_changed?
.
Actions