Class: Actions::Katello::UpstreamSubscriptions::UpdateEntitlements

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb

Instance Method Summary collapse

Instance Method Details

#humanized_nameObject



25
26
27
# File 'app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb', line 25

def humanized_name
  N_("Update Upstream Subscription")
end

#plan(pools = []) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb', line 5

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

#rescue_strategyObject



29
30
31
# File 'app/lib/actions/katello/upstream_subscriptions/update_entitlements.rb', line 29

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