Sha256: 2581f399cc061c24d48a1d958d3f803d518d20be2155a0f49cbad64e59adb727

Contents?: true

Size: 1.33 KB

Versions: 12

Compression:

Stored size: 1.33 KB

Contents

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

        def plan(host, options = {})
          skip_candlepin = options.fetch(:skip_candlepin, false)
          unregistering = options.fetch(:unregistering, false)

          action_subject(host)

          concurrence do
            if !skip_candlepin && host.subscription_facet.try(:uuid)
              plan_action(Candlepin::Consumer::Destroy, uuid: host.subscription_facet.uuid)
            end
            plan_action(Pulp::Consumer::Destroy, uuid: host.content_facet.uuid) if host.content_facet.try(:uuid)
          end

          host.subscription_facet.try(:destroy!)

          if unregistering
            if host.content_facet
              host.content_facet.uuid = nil
              host.content_facet.save!
            end

            host.get_status(::Katello::ErrataStatus).destroy
            host.get_status(::Katello::SubscriptionStatus).destroy
            host.installed_packages.destroy_all
          else
            host.content_facet.try(:destroy!)
            unless host.destroy
              fail host.errors.full_messages.join('; ')
            end
          end
        end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
katello-3.3.0.1 app/lib/actions/katello/host/destroy.rb
katello-3.3.0 app/lib/actions/katello/host/destroy.rb
katello-3.3.0.rc2 app/lib/actions/katello/host/destroy.rb
katello-3.3.0.rc1.1 app/lib/actions/katello/host/destroy.rb
katello-3.3.0.rc1 app/lib/actions/katello/host/destroy.rb
katello-3.2.1.1 app/lib/actions/katello/host/destroy.rb
katello-3.2.1 app/lib/actions/katello/host/destroy.rb
katello-3.2.0 app/lib/actions/katello/host/destroy.rb
katello-3.2.0.rc3 app/lib/actions/katello/host/destroy.rb
katello-3.2.0.rc2 app/lib/actions/katello/host/destroy.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/host/destroy.rb
katello-3.2.0.rc1 app/lib/actions/katello/host/destroy.rb