Module: Katello::Concerns::Api::V2::HostsBulkActionsControllerExtensions::Overrides
- Defined in:
- app/controllers/katello/concerns/api/v2/hosts_bulk_actions_controller_extensions.rb
Instance Method Summary collapse
Instance Method Details
#assign_organization ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/katello/concerns/api/v2/hosts_bulk_actions_controller_extensions.rb', line 17 def assign_organization registered_host = find_editable_hosts.where.not(organization_id: params[:id]).joins(:subscription_facet).first if registered_host render_error :custom_error, :status => :bad_request, :locals => { :message => _("Unregister host %s before assigning an organization.") % registered_host.name } return end super end |
#bulk_destroy ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/katello/concerns/api/v2/hosts_bulk_actions_controller_extensions.rb', line 9 def bulk_destroy destroyed_count = @hosts.count @hosts.in_batches.each_record do |host| Katello::RegistrationManager.unregister_host(host, :unregistering => false) end process_response(true, { :message => _("Deleted %{host_count} %{hosts}") % { :host_count => destroyed_count, :hosts => 'host'.pluralize(destroyed_count) }}) end |