Sha256: c2c8e7ff5a6685cee328385a36261bc15062f810daf0260c4db416a42493d377

Contents?: true

Size: 1.27 KB

Versions: 35

Compression:

Stored size: 1.27 KB

Contents

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

        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

35 entries across 35 versions & 1 rubygems

Version Path
katello-3.12.3 app/lib/actions/katello/host/destroy.rb
katello-3.12.2 app/lib/actions/katello/host/destroy.rb
katello-3.13.0.rc1 app/lib/actions/katello/host/destroy.rb
katello-3.12.1 app/lib/actions/katello/host/destroy.rb
katello-3.11.2 app/lib/actions/katello/host/destroy.rb
katello-3.10.2 app/lib/actions/katello/host/destroy.rb
katello-3.12.0 app/lib/actions/katello/host/destroy.rb
katello-3.12.0.rc2 app/lib/actions/katello/host/destroy.rb
katello-3.10.1.1 app/lib/actions/katello/host/destroy.rb
katello-3.12.0.rc1 app/lib/actions/katello/host/destroy.rb
katello-3.10.1 app/lib/actions/katello/host/destroy.rb
katello-3.11.1 app/lib/actions/katello/host/destroy.rb
katello-3.11.0 app/lib/actions/katello/host/destroy.rb
katello-3.11.0.rc2 app/lib/actions/katello/host/destroy.rb
katello-3.11.0.rc1 app/lib/actions/katello/host/destroy.rb
katello-3.10.0 app/lib/actions/katello/host/destroy.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/host/destroy.rb
katello-3.9.1 app/lib/actions/katello/host/destroy.rb
katello-3.10.0.rc1 app/lib/actions/katello/host/destroy.rb
katello-3.9.0 app/lib/actions/katello/host/destroy.rb