Skip to content

Commit

Permalink
Fixes #36980 - Update the Lifecycle environment and content view for …
Browse files Browse the repository at this point in the history
…the host with new hostgroup
  • Loading branch information
lfu committed Dec 14, 2023
1 parent b793575 commit 85cccdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/controllers/hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,10 @@ def update_multiple_hostgroup
redirect_to(select_multiple_hostgroup_hosts_path)
return
end
hg = Hostgroup.find_by_id(id)
# update the hosts
@hosts.each do |host|
host.hostgroup = hg
host.save(:validate => false)
attributes = host.apply_inherited_attributes("hostgroup_id" => id)
host.update(attributes)
end

success _('Updated hosts: changed host group')
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/hosts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def setup_user_and_host(operation, filter = nil, &block)

test 'multiple hostgroup change by host names' do
@request.env['HTTP_REFERER'] = current_hosts_path
hosts = FactoryBot.create_list(:host, 2)
hosts = FactoryBot.create_list(:host, 2, :domain => domains(:mydomain))
host_names = hosts.map(&:name)
# check that we have hosts and their hostgroup is empty
host_names.each do |name|
Expand Down

0 comments on commit 85cccdf

Please sign in to comment.