Sha256: 33779b0e583129b9d2d7675235695b656f721858542a9dcf2287540115d1b482
Contents?: true
Size: 1.78 KB
Versions: 11
Compression:
Stored size: 1.78 KB
Contents
module Actions module Katello module Host class Destroy < Actions::EntryAction middleware.use ::Actions::Middleware::RemoteAction def plan(host, options = {}) organization_destroy = options.fetch(:organization_destroy, false) unregistering = options.fetch(:unregistering, false) action_subject(host) concurrence do if !organization_destroy && 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 unregister(host) elsif organization_destroy host.content_facet.try(:destroy!) destroy_host_artifacts(host) else host.content_facet.try(:destroy!) unless host.destroy fail host.errors.full_messages.join('; ') end end end def unregister(host) if host.content_facet host.content_facet.bound_repositories = [] host.content_facet.applicable_errata = [] host.content_facet.uuid = nil host.content_facet.save! end destroy_host_artifacts(host) end def destroy_host_artifacts(host) host.get_status(::Katello::ErrataStatus).destroy host.get_status(::Katello::SubscriptionStatus).destroy host.get_status(::Katello::TraceStatus).destroy host.installed_packages.destroy_all end def humanized_name _("Destroy Content Host") end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems