diff --git a/app/services/katello/applicability/applicable_content_helper.rb b/app/services/katello/applicability/applicable_content_helper.rb index 8a658b0f78f..53f2b3d7461 100644 --- a/app/services/katello/applicability/applicable_content_helper.rb +++ b/app/services/katello/applicability/applicable_content_helper.rb @@ -69,7 +69,7 @@ def fetch_deb_content_ids deb_version_compare = Arel::Nodes::NamedFunction.new('deb_version_cmp', [deb[:version], installed_deb[:version]]).gt(0) content = deb.join(repo_deb).on(repo_deb[:deb_id].eq(deb[:id])) - .join(installed_deb).on(installed_deb[:name].eq(deb[:name])) + .join(installed_deb).on(installed_deb[:name].eq(deb[:name]), installed_deb[:architecture].eq(deb[:architecture])) .join(host_installed_deb).on(host_installed_deb[:installed_deb_id].eq(installed_deb[:id])) .where(deb_version_compare) .where(host_installed_deb[:host_id].eq(self.content_facet.host.id)) diff --git a/test/services/katello/applicability/applicable_content_helper_test.rb b/test/services/katello/applicability/applicable_content_helper_test.rb index 3a0586905c5..80035f3cca9 100644 --- a/test/services/katello/applicability/applicable_content_helper_test.rb +++ b/test/services/katello/applicability/applicable_content_helper_test.rb @@ -94,6 +94,13 @@ def test_applicable_differences_adds_deb_id assert_equal [[@deb_one_new.id], []], deb_differences end + def test_applicable_differences_should_not_mix_deb_architectures + @installed_deb1.architecture = 'i386' + @installed_deb1.save + deb_differences = ::Katello::Applicability::ApplicableContentHelper.new(@host2.content_facet, ::Katello::Deb, bound_repos(@host2)).applicable_differences + assert_equal [[], []], deb_differences + end + def test_applicable_differences_adds_and_removes_no_deb_ids ::Katello::Applicability::ApplicableContentHelper.new(@host2.content_facet, ::Katello::Deb, bound_repos(@host2)).calculate_and_import deb_differences = ::Katello::Applicability::ApplicableContentHelper.new(@host2.content_facet, ::Katello::Deb, bound_repos(@host2)).applicable_differences