Project

General

Profile

« Previous | Next » 

Revision 22a5bf03

Added by Daniel Lobato Garcia over 7 years ago

Fixes #18045 - Puppet classes show up choosing only env.

After #3551 was merged, the hosts controller requires both environment
and hostgroup to be set in order to display puppetclasses.

It shouldn't be required to have both, so we should check what's
available and use it. If it's only the hostgroup or the environment, it
should work.

View differences:

test/controllers/hosts_controller_test.rb
assert_response :method_not_allowed
end
describe '#hostgroup_or_environment_selected' do
test 'choosing only one of hostgroup or environment renders classes' do
xhr :post, :hostgroup_or_environment_selected, {
:host_id => nil,
:host => {
:environment_id => Environment.unscoped.first.id
}
}, set_session_user
assert_response :success
assert_template :partial => 'puppetclasses/_class_selection'
end
test 'choosing both hostgroup and environment renders classes' do
xhr :post, :hostgroup_or_environment_selected, {
:host_id => @host.id,
:host => {
:environment_id => Environment.unscoped.first.id,
:hostgroup_id => Hostgroup.unscoped.first.id
}
}, set_session_user
assert_response :success
assert_template :partial => 'puppetclasses/_class_selection'
end
end
private
def initialize_host

Also available in: Unified diff