Sha256: bd46b1b83d54bd7ea6f48b007c8c74613714872b306bcd2309a76a8c24d7303f

Contents?: true

Size: 1.54 KB

Versions: 21

Compression:

Stored size: 1.54 KB

Contents

module Actions
  module Katello
    module Host
      class UpdateContentOverrides < Actions::EntryAction
        middleware.use Actions::Middleware::KeepCurrentUser

        def plan(host, content_override_params, prune_invalid_content_overrides = true)
          action_subject(host)
          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

21 entries across 21 versions & 1 rubygems

Version Path
katello-3.7.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.2 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.6.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.6.0.1.rc2 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.6.0.rc2 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.6.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.1.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.0.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.0.rc2 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.5.0.rc1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.5 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.4 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.2 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.0.2 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.0.1 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.0 app/lib/actions/katello/host/update_content_overrides.rb
katello-3.4.0.rc2 app/lib/actions/katello/host/update_content_overrides.rb