Sha256: 64142f465dfba5edb0becb8a5fe0dbdf1062771764bdf1bbbe414e9c1761f38d

Contents?: true

Size: 1.29 KB

Versions: 48

Compression:

Stored size: 1.29 KB

Contents

module Actions
  module Katello
    module ActivationKey
      class Create < Actions::EntryAction
        def plan(activation_key, params = {})
          activation_key.save!
          if ::SETTINGS[:katello][:use_cp]
            cp_create = plan_action(Candlepin::ActivationKey::Create,
                                    organization_label: activation_key.organization.label,
                                    auto_attach: activation_key.auto_attach,
                                    service_level: params[:service_level],
                                    release_version: activation_key.release_version,
                                    purpose_role: activation_key.purpose_role,
                                    purpose_usage: activation_key.purpose_usage,
                                    purpose_addons: activation_key.purpose_addons.pluck(:name))
            cp_id = cp_create.output[:response][:id]
          end
          action_subject(activation_key, :cp_id => cp_id)
          plan_self
        end

        def humanized_name
          _("Create")
        end

        def finalize
          activation_key = ::Katello::ActivationKey.find(input[:activation_key][:id])
          activation_key.cp_id = input[:cp_id]
          activation_key.save!
        end
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
katello-3.18.5 app/lib/actions/katello/activation_key/create.rb
katello-3.18.4 app/lib/actions/katello/activation_key/create.rb
katello-3.18.3.1 app/lib/actions/katello/activation_key/create.rb
katello-3.18.3 app/lib/actions/katello/activation_key/create.rb
katello-3.18.2.1 app/lib/actions/katello/activation_key/create.rb
katello-3.18.2 app/lib/actions/katello/activation_key/create.rb
katello-3.17.3 app/lib/actions/katello/activation_key/create.rb
katello-3.18.1.1 app/lib/actions/katello/activation_key/create.rb
katello-3.17.2 app/lib/actions/katello/activation_key/create.rb
katello-3.18.1 app/lib/actions/katello/activation_key/create.rb
katello-3.18.0 app/lib/actions/katello/activation_key/create.rb
katello-3.17.1 app/lib/actions/katello/activation_key/create.rb
katello-3.16.2 app/lib/actions/katello/activation_key/create.rb
katello-3.18.0.rc2.1 app/lib/actions/katello/activation_key/create.rb
katello-3.18.0.rc2 app/lib/actions/katello/activation_key/create.rb
katello-3.17.0 app/lib/actions/katello/activation_key/create.rb
katello-3.18.0.rc1 app/lib/actions/katello/activation_key/create.rb
katello-3.17.0.rc2.2 app/lib/actions/katello/activation_key/create.rb
katello-3.17.0.rc2.1 app/lib/actions/katello/activation_key/create.rb
katello-3.16.1.2 app/lib/actions/katello/activation_key/create.rb