Class: Actions::Katello::Applicability::Hosts::BulkGenerate
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Applicability::Hosts::BulkGenerate
- Defined in:
- app/lib/actions/katello/applicability/hosts/bulk_generate.rb
Instance Method Summary collapse
- #hostname(host_id) ⇒ Object
- #humanized_name ⇒ Object
- #queue ⇒ Object
- #resource_locks ⇒ Object
- #run ⇒ Object
Instance Method Details
#hostname(host_id) ⇒ Object
29 30 31 32 |
# File 'app/lib/actions/katello/applicability/hosts/bulk_generate.rb', line 29 def hostname(host_id) content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id) content_facet&.host&.name end |
#humanized_name ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/lib/actions/katello/applicability/hosts/bulk_generate.rb', line 34 def humanized_name if input && input[:host_ids]&.length == 1 _("Bulk generate applicability for host %s" % hostname(input[:host_ids]&.first)) else _("Bulk generate applicability for hosts") end end |
#queue ⇒ Object
21 22 23 |
# File 'app/lib/actions/katello/applicability/hosts/bulk_generate.rb', line 21 def queue ::Katello::HOST_TASKS_QUEUE end |
#resource_locks ⇒ Object
25 26 27 |
# File 'app/lib/actions/katello/applicability/hosts/bulk_generate.rb', line 25 def resource_locks :link end |
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/lib/actions/katello/applicability/hosts/bulk_generate.rb', line 10 def run input[:host_ids].each do |host_id| content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id) if content_facet.present? content_facet.calculate_and_import_applicability else Rails.logger.warn(_("Content Facet for host with id %s is non-existent. Skipping applicability calculation.") % host_id) end end end |