Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #20874 - check correct host for for RedHat os #6941

Merged
merged 1 commit into from Sep 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/helpers/katello/hosts_and_hostgroups_helper.rb
Expand Up @@ -191,12 +191,13 @@ def kickstart_repository_options(param_host, options = {})
# case 1
selected_host_group = options.fetch(:selected_host_group, nil)
host = selected_host_group.present? ? selected_host_group : param_host
return [] unless host.operatingsystem.is_a?(Redhat)

new_host = ::Host.new
new_host.operatingsystem = param_host.operatingsystem.present? ? param_host.operatingsystem : host.operatingsystem
new_host.architecture = param_host.architecture.present? ? param_host.architecture : host.architecture

return [] unless new_host.operatingsystem.is_a?(Redhat)

if (host.is_a? Hostgroup)
new_host.content_facet = ::Katello::Host::ContentFacet.new(:lifecycle_environment_id => host.inherited_lifecycle_environment_id,
:content_view_id => host.inherited_content_view_id,
Expand Down
11 changes: 11 additions & 0 deletions test/helpers/hosts_and_hostgroups_helper_test.rb
Expand Up @@ -113,6 +113,17 @@ def setup
assert_equal ret.first[:name], options.first.name
end

test "kickstart_repository_options should_handle_non_redhat_host" do
hostgroup = Hostgroup.new(:operatingsystem => @os)
host = ::Host.new(:architecture => @arch, :operatingsystem => operatingsystems(:opensuse), :hostgroup => hostgroup,
:content_facet_attributes => {:lifecycle_environment_id => @env.id,
:content_view_id => @cv.id,
:content_source_id => @content_source.id})

options = kickstart_repository_options(host, :selected_host_group => hostgroup)
assert_empty options
end

test "kickstart_repository_options should provide options for a populated hostgroup" do
self.params = {}
hostgroup = ::Hostgroup.new(:lifecycle_environment_id => @env.id,
Expand Down