Sha256: 0954606ad0fc10380f34d3fdc3523c0ed9f4b62692a3a1305ac2cba1d6177c1e

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

module Actions
  module Katello
    module System
      class Destroy < Actions::EntryAction
        middleware.use ::Actions::Middleware::RemoteAction

        def plan(system, options = {})
          pool_ids = system.pools.map { |x| x["id"] }
          skip_candlepin = options.fetch(:skip_candlepin, false)
          skip_pulp = system.hypervisor?
          action_subject(system)

          concurrence do
            plan_action(Candlepin::Consumer::Destroy, uuid: system.uuid) unless skip_candlepin
            plan_action(Pulp::Consumer::Destroy, uuid: system.uuid) unless skip_pulp
          end

          plan_self(:system_id => system.id, :pool_ids => pool_ids)
        end

        def finalize
          system = ::Katello::System.find(input[:system_id])
          system.destroy!
          input[:pool_ids].each do |pool_id|
            pool = ::Katello::Pool.where(:cp_id => pool_id).first
            pool.import_data if pool
          end
        end

        def humanized_name
          _("Destroy Content Host")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-2.4.5 app/lib/actions/katello/system/destroy.rb
katello-2.4.4 app/lib/actions/katello/system/destroy.rb
katello-2.4.3 app/lib/actions/katello/system/destroy.rb
katello-2.4.2 app/lib/actions/katello/system/destroy.rb
katello-2.4.1 app/lib/actions/katello/system/destroy.rb
katello-2.4.0 app/lib/actions/katello/system/destroy.rb
katello-2.4.0.rc3 app/lib/actions/katello/system/destroy.rb