Sha256: c101a4b73fd34d1f1fe08a0a831eb76a4d43ad5457857ed735ba041472215a92

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

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

        def plan(pools = [])
          fail _("No pools were provided.") if pools.blank?
          fail _("Current organization is not set.") unless ::Organization.current

          sequence do
            concurrence do
              pools.each do |p|
                pool = ::Katello::Pool.find(p[:id])

                fail _("Provided pool with id %s has no upstream entitlement" % p[:id]) if pool.upstream_entitlement_id.nil?
                plan_action(::Actions::Katello::UpstreamSubscriptions::UpdateEntitlement,
                            entitlement_id: pool.upstream_entitlement_id,
                            quantity: p[:quantity])
              end
            end

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

        def humanized_name
          N_("Update 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/update_entitlements.rb
katello-3.9.0 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.8.1 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.9.0.rc2 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.9.0.rc1 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.7.1.1 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.7.1 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.8.0 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.8.0.rc3 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.8.0.rc2 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.7.0 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.8.0.rc1 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.7.0.rc2 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb
katello-3.7.0.rc1 app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb