Sha256: 8dee7430449cffd2b3a5785bab65b4c63b59065ea0ace2ba96eec273789d8c06
Contents?: true
Size: 1.33 KB
Versions: 159
Compression:
Stored size: 1.33 KB
Contents
module Actions module Katello module Host class Destroy < Actions::EntryAction middleware.use ::Actions::Middleware::RemoteAction def queue ::Katello::HOST_TASKS_QUEUE end def plan(host, options = {}) action_subject(host) # normalize options before passing through to run phase organization_destroy = options.fetch(:organization_destroy, false) unregistering = options.fetch(:unregistering, false) plan_self(:hostname => host.name, :host_id => host.id, :unregistering => unregistering, :organization_destroy => organization_destroy) end def run host = ::Host.find(input[:host_id]) ::Katello::RegistrationManager.unregister_host(host, :unregistering => input[:unregistering], :organization_destroy => input[:organization_destroy]) rescue ActiveRecord::RecordNotFound Rails.logger.warn("Attempted to delete host %s in action, but host is already gone. Continuing." % input[:host_id]) end def humanized_name if input.try(:[], :hostname) _("Destroy Content Host %s") % input[:hostname] else _("Destroy Content Host") end end end end end end
Version data entries
159 entries across 159 versions & 1 rubygems