diff --git a/app/controllers/katello/api/v2/activation_keys_controller.rb b/app/controllers/katello/api/v2/activation_keys_controller.rb index 43d0ab1efb1..a0fcc1c7a80 100644 --- a/app/controllers/katello/api/v2/activation_keys_controller.rb +++ b/app/controllers/katello/api/v2/activation_keys_controller.rb @@ -306,7 +306,7 @@ def find_content_view_environments find_cve_for_single elsif params[:content_view_environments] || params[:content_view_environment_ids] @content_view_environments = ::Katello::ContentViewEnvironment.fetch_content_view_environments( - candlepin_names: params[:content_view_environments], + labels: params[:content_view_environments], ids: params[:content_view_environment_ids], organization: @organization || @activation_key&.organization) if @content_view_environments.blank? diff --git a/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb b/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb index d59cfb8fee7..2268b1b18e9 100644 --- a/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +++ b/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb @@ -47,7 +47,7 @@ def set_content_view_environments return if content_facet_attributes.blank? || @host&.content_facet.blank? || (cve_params[:content_view_id].present? && cve_params[:lifecycle_environment_id].present?) cves = ::Katello::ContentViewEnvironment.fetch_content_view_environments( - candlepin_names: cve_params[:content_view_environments], + labels: cve_params[:content_view_environments], ids: cve_params[:content_view_environment_ids], organization: @organization || @host&.organization) if cves.present? diff --git a/app/models/katello/content_view_environment.rb b/app/models/katello/content_view_environment.rb index f4398bc19bc..99e6c654e49 100644 --- a/app/models/katello/content_view_environment.rb +++ b/app/models/katello/content_view_environment.rb @@ -68,7 +68,7 @@ def priority(content_object) end end - def self.fetch_content_view_environments(candlepin_names: [], ids: [], organization:) + def self.fetch_content_view_environments(labels: [], ids: [], organization:) # Must do maps here to ensure CVEs remain in the same order. # Using ActiveRecord .where will return them in a different order. if ids.present? @@ -76,8 +76,8 @@ def self.fetch_content_view_environments(candlepin_names: [], ids: [], organizat ::Katello::ContentViewEnvironment.find_by(id: id) end cves.compact - elsif candlepin_names.present? - environment_names = candlepin_names.map(&:strip) + elsif labels.present? + environment_names = labels.map(&:strip) environment_names.map! do |name| with_candlepin_name(name, organization: organization) end diff --git a/test/models/content_view_environment_test.rb b/test/models/content_view_environment_test.rb index e3e607e7847..663e8fcfcbd 100644 --- a/test/models/content_view_environment_test.rb +++ b/test/models/content_view_environment_test.rb @@ -41,7 +41,7 @@ def test_fetch_content_view_environments_candlepin_names dev = katello_environments(:dev) view = katello_content_views(:library_dev_view) cve = Katello::ContentViewEnvironment.where(:environment_id => dev, :content_view_id => view).first - assert_equal [cve], ContentViewEnvironment.fetch_content_view_environments(candlepin_names: ['published_dev_view_dev'], organization: dev.organization) + assert_equal [cve], ContentViewEnvironment.fetch_content_view_environments(labels: ['published_dev_view_dev'], organization: dev.organization) end def test_fetch_content_view_environments_ids