Skip to content

Commit

Permalink
Fixes #36828 - add host products report jail methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Oct 13, 2023
1 parent a578284 commit b82414d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions app/lib/katello/concerns/base_template_scope_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ def host_products_names(host)
end
end

apipie :method, 'Returns installed product names for the host with CP IDs' do
required :host, 'Host::Managed', desc: 'Host object to get products for'
returns array_of: String, desc: 'Array with names and CP IDs of installed products on the host'
end
def host_products_names_and_ids(host)
products = host_products(host)
if products
products.collect { |product| "#{product.name} (#{product.cp_product_id})" }
else
[]
end
end

apipie :method, 'Returns the host collections the host belongs to' do
required :host, 'Host::Managed', desc: 'Host object to get the host collections for'
returns array_of: 'HostCollection', desc: "Array of the host collection objects the host belongs to"
Expand Down
2 changes: 1 addition & 1 deletion app/models/katello/concerns/host_managed_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ class ::Host::Managed::Jail < Safemode::Jail
:host_collections, :pools, :hypervisor_host, :installed_debs,
:installed_packages, :traces_helpers, :advisory_ids, :package_names_for_job_template,
:filtered_entitlement_quantity_consumed, :bound_repositories,
:single_content_view, :single_lifecycle_environment
:single_content_view, :single_lifecycle_environment, :purpose_role_status_label, :purpose_usage_status_label
end

class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail
Expand Down
2 changes: 1 addition & 1 deletion app/models/katello/concerns/organization_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,5 @@ def audit_manifest_action(message)
end

class ::Organization::Jail < ::Safemode::Jail
allow :label
allow :label, :simple_content_access?
end

0 comments on commit b82414d

Please sign in to comment.