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 #36828 - add host products report jail methods #10769

Merged
merged 1 commit into from
Oct 24, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 4 additions & 1 deletion app/models/katello/concerns/host_managed_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def remote_execution_proxies(provider, *_rest)
delegate :content_source_id, :single_content_view, :single_lifecycle_environment, :default_environment?, :single_content_view_environment?, :multi_content_view_environment?, :kickstart_repository_id, :bound_repositories,
:installable_errata, :installable_rpms, to: :content_facet, allow_nil: true

delegate :release_version, :purpose_role, :purpose_usage, to: :subscription_facet, allow_nil: true

has_many :content_view_environment_content_facets, through: :content_facet, class_name: 'Katello::ContentViewEnvironmentContentFacet'
has_many :content_view_environments, through: :content_view_environment_content_facets
has_many :content_views, through: :content_view_environments
Expand Down Expand Up @@ -587,7 +589,8 @@ 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, :purpose_usage, :release_version,
: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
Loading