Sha256: 0458d41b5e17dd11776b7a693ddb6b3693af7a3a62b73f8f456eb988d242f726

Contents?: true

Size: 1018 Bytes

Versions: 17

Compression:

Stored size: 1018 Bytes

Contents

module Actions
  module Katello
    module UpstreamSubscriptions
      class RemoveEntitlements < Actions::Base
        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

17 entries across 17 versions & 1 rubygems

Version Path
katello-3.12.3 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.12.2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.12.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.11.2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.10.2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.12.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.12.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.10.1.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.12.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.10.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.11.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.11.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.11.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.11.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.10.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-3.10.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb