Class: Actions::Katello::Host::UpdateContentOverrides
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::Host::UpdateContentOverrides
- Defined in:
- app/lib/actions/katello/host/update_content_overrides.rb
Instance Method Summary collapse
- #humanized_name ⇒ Object
- #plan(host, content_override_params, prune_invalid_content_overrides = true) ⇒ Object
- #resource_locks ⇒ Object
- #run ⇒ Object
Instance Method Details
#humanized_name ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/lib/actions/katello/host/update_content_overrides.rb', line 28 def humanized_name if input.try(:[], :host_name) _('Update Content Overrides to %s') % (input[:host_name] || _('Unknown')) else _('Update Content Overrides') end end |
#plan(host, content_override_params, prune_invalid_content_overrides = true) ⇒ Object
5 6 7 8 9 10 |
# File 'app/lib/actions/katello/host/update_content_overrides.rb', line 5 def plan(host, content_override_params, prune_invalid_content_overrides = true) action_subject(host) fail _("This Host is not currently registered with subscription-manager.") unless host.subscription_facet plan_self(:host_id => host.id, :host_name => host.name, :content_overrides => content_override_params, :prune_invalid_content_overrides => prune_invalid_content_overrides) end |
#resource_locks ⇒ Object
36 37 38 |
# File 'app/lib/actions/katello/host/update_content_overrides.rb', line 36 def resource_locks :link end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/lib/actions/katello/host/update_content_overrides.rb', line 12 def run content_overrides = input[:content_overrides].map do |override| ::Katello::ContentOverride.fetch(override) end prune_invalid_content_overrides = input[:prune_invalid_content_overrides] host = ::Host.find(input[:host_id]) if prune_invalid_content_overrides content_overrides = content_overrides.select do |override| host.valid_content_override_label?(override.content_label) end end ::Katello::Resources::Candlepin::Consumer.update_content_overrides(host.subscription_facet.uuid, content_overrides.map(&:to_entitlement_hash)) end |