Sha256: 83b172b17b1b808c3926661cf457c6e7f56a2aa24fa96266525892706dc277de

Contents?: true

Size: 1.59 KB

Versions: 182

Compression:

Stored size: 1.59 KB

Contents

module Actions
  module Katello
    module Host
      class UpdateContentOverrides < Actions::EntryAction
        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

        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

        def humanized_name
          if input.try(:[], :host_name)
            _('Update Content Overrides to %s') % (input[:host_name] || _('Unknown'))
          else
            _('Update Content Overrides')
          end
        end

        def resource_locks
          :link
        end
      end
    end
  end
end

Version data entries

182 entries across 182 versions & 1 rubygems

Version Path
katello-4.16.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.15.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.16.0.rc2 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.16.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.3 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.2 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.15.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.15.0.rc2 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.15.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.0.rc3 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.0.rc2 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.0.rc1.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.14.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.13.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.13.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.12.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.13.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-4.12.0 app/lib/actions/katello/host/update_content_overrides.rb