Project

General

Profile

Actions

Bug #25286

open

available_networks call fails on resources where it is not defined

Added by Martin Bacovsky over 6 years ago. Updated about 6 years ago.

Status:
New
Priority:
Normal
Category:
API
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

In API we allow to list available resources for a compute resource.
When such call is not defined for particular resource it usually returns something like this:

"error": {"message":"ERF42-7329 [Foreman::Exception]: Not implemented for Libvirt"}

For networks I'm getting the following on libvirt:

# curl -u admin:changeme "-HContent-Type: application/json" -XGET http://localhost:3000/api/v2/compute_resources/1/available_networks
{
  "error": {"message":"wrong number of arguments (given 1, expected 0)"}
}

The reason is the available_networks is called from a controller with a parameter while the generic method to which it fall-backs has no arguments.

Corresponding backtrace from the server:

14:19:38 rails.1   | 2018-10-23T14:19:38 [W|app|c98e7] Action failed
14:19:38 rails.1   |  | ArgumentError: wrong number of arguments (given 1, expected 0)
14:19:38 rails.1   |  | /home/vagrant/foreman/app/models/compute_resource.rb:258:in `available_networks'
14:19:38 rails.1   |  | /home/vagrant/foreman/app/controllers/api/v2/compute_resources_controller.rb:121:in `available_networks'
14:19:38 rails.1   |  | /home/vagrant/.rvm/gems/ruby-2.5.1/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
14:19:38 rails.1   |  | /home/vagrant/.rvm/gems/ruby-2.5.1/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'

Expected result: It fails with "Not implemented for Libvirt" or better gets implemented ;).

Actions #1

Updated by Lukas Zapletal about 6 years ago

  • Triaged changed from No to Yes
Actions #2

Updated by Aditi Puntambekar about 6 years ago

  • Assignee set to Aditi Puntambekar
Actions

Also available in: Atom PDF