Sha256: dde39b14b3502a5dd39cf383653b3ce5b1f6c7d325f6654f694c2426df1b3ac3
Contents?: true
Size: 1.89 KB
Versions: 2
Compression:
Stored size: 1.89 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 if host.content_host plan_self(:pool_ids => pool_ids(host)) host.content_host.destroy! 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 pool_ids(host) host.content_host.pools.map { |p| p["id"] } rescue RestClient::Gone Rails.logger.warn("Host #{host.name} (#{host.subscription_facet.uuid}) removed from candlepin.") [] end def finalize 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
katello-3.1.0.1 | app/lib/actions/katello/host/destroy.rb |
katello-3.1.0 | app/lib/actions/katello/host/destroy.rb |