Sha256: d7cd90e309cf4bdc26617bc49abdb1a585710d8a4b1d2b112db5152559f49a15

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 KB

Contents

module Actions
  module Katello
    module UpstreamSubscriptions
      class RemoveEntitlements < Actions::Base
        middleware.use Actions::Middleware::KeepCurrentTaxonomies

        def plan(pool_ids = [])
          ids = pool_ids.uniq.compact
          fail _("No pool IDs were provided.") if ids.blank?
          fail _("Current organization is not set.") unless ::Organization.current

          sequence do
            ids.each do |pid|
              pool = ::Katello::Pool.find(pid)

              fail _("Provided pool with id %s has no upstream entitlement" % pid) if pool.upstream_entitlement_id.nil?

              plan_action(::Actions::Katello::UpstreamSubscriptions::RemoveEntitlement, entitlement_id: pool.upstream_entitlement_id)
            end

            plan_action(::Actions::Katello::Organization::ManifestRefresh, ::Organization.current)
          end
        end

        def humanized_name
          N_("Delete Upstream Subscription")
        end

        def rescue_strategy
          Dynflow::Action::Rescue::Skip
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
katello-3.9.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.9.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.8.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.9.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.9.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.7.1.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.7.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.8.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.8.0.rc3 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.8.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.7.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.8.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.7.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.7.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb