Project

General

Profile

Actions

Feature #865

closed

create method for updating multiple hosts via name instead of id

Added by Corey Osman over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I need a method to update multiple hosts via a name. I altered some code but I don't understand how the find function works with the params.

Need some clarification on whats going on with the following line of code.

   @hosts = Host.find(params[:host_names], :order => "hostgroup_id ASC")

Here is what I put together as a future patch for this feature.


def find_multiple
    if not params[:host_ids].blank?
      @hosts = Host.find(params[:host_ids], :order => "hostgroup_id ASC")
    elsif not params[:host_names].blank?
      @hosts = Host.find(params[:host_names], :order => "hostgroup_id ASC")
    else
      error 'No Hosts selected'
      redirect_to(hosts_path) and return false
    end
  rescue => e
    error "Something went wrong while selecting hosts - #{e}" 
    redirect_to hosts_path
  end

Actions #1

Updated by Corey Osman over 13 years ago

  • Assignee set to Corey Osman
Actions #2

Updated by Ohad Levy over 13 years ago

  • Status changed from New to Ready For Testing
  • % Done changed from 0 to 100
Actions #3

Updated by Ohad Levy over 13 years ago

  • Category set to API
  • Status changed from Ready For Testing to Closed
  • Target version set to 0.3
Actions

Also available in: Atom PDF