Sha256: e7e32fec6f02a89adbc62d9841dee6bc2a1a8541caa0f13d28f13949264ad57f

Contents?: true

Size: 1.15 KB

Versions: 160

Compression:

Stored size: 1.15 KB

Contents

module Actions
  module Katello
    module UpstreamSubscriptions
      class RemoveEntitlements < Actions::Base
        def plan(pool_ids = [])
          ::Katello::Resources::Candlepin::UpstreamConsumer.get(:include_only => [:uuid])
          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?

              sub_name = pool.subscription.name

              plan_action(::Actions::Katello::UpstreamSubscriptions::RemoveEntitlement, entitlement_id: pool.upstream_entitlement_id, sub_name: sub_name)
            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

160 entries across 160 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.15.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.15.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.15.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.14.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.14.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.14.0.rc3 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.14.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.14.0.rc1.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.14.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.13.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.13.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.12.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.13.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.12.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.12.0.rc3 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.12.0.rc2 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.12.0.rc1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.11.1 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb
katello-4.11.0 app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb