Project

General

Profile

Actions

Bug #32855

closed

API available_networks by cluster no longer working

Added by Markus Bucher almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Compute resources - VMware
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

API-request for available_networks by compute_resource-cluster fails

GET /api/compute_resources/:id/available_clusters/:cluster_id/available_networks

Result with cluster-name fails with no-Route error:

2021-06-23T08:38:32 [I|app|005a11d1] Started GET "/api/compute_resources/1/available_clusters/192.168.80.2/available_networks/" for 192.168.121.1 at 2021-06-23 08:38:32 +0000
2021-06-23T08:38:32 [F|app|005a11d1]   
 005a11d1 | ActionController::RoutingError (No route matches [GET] "/api/compute_resources/1/available_clusters/192.168.80.2/available_networks"):
 005a11d1 |   
 005a11d1 | lib/foreman/middleware/logging_context_request.rb:11:in `call'
 005a11d1 | /home/vagrant/katello/lib/katello/prevent_json_parsing.rb:12:in `call'
2021-06-23T08:38:36 [I|app|005a11d1]   Rendered .vendor/ruby/2.7.0/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (Duration: 3236.8ms | Allocations: 536195)

Result with cluster-id:

2021-06-23T08:30:19 [I|app|528a1e29] Started GET "/api/compute_resources/1/available_clusters/domain-s7/available_networks/" for 192.168.121.1 at 2021-06-23 08:30:19 +0000
2021-06-23T08:30:19 [I|app|528a1e29] Processing by Api::V2::ComputeResourcesController#available_networks as JSON
2021-06-23T08:30:19 [I|app|528a1e29]   Parameters: {"apiv"=>"v2", "id"=>"1", "cluster_id"=>"domain-s7"}
2021-06-23T08:30:19 [D|app|528a1e29] Reading from compute resource cache: networks-domain-s7
2021-06-23T08:30:20 [W|app|528a1e29] Action failed
2021-06-23T08:30:20 [I|app|528a1e29] Backtrace for 'Action failed' error (NoMethodError): undefined method `network' for nil:NilClass
 528a1e29 | /home/vagrant/foreman/.vendor/ruby/2.7.0/gems/fog-vsphere-3.5.0/lib/fog/vsphere/requests/compute/list_networks.rb:21:in `list_networks'
 528a1e29 | /home/vagrant/foreman/.vendor/ruby/2.7.0/gems/fog-vsphere-3.5.0/lib/fog/vsphere/models/compute/networks.rb:10:in `all'
 528a1e29 | /home/vagrant/foreman/app/models/compute_resources/foreman/model/vmware.rb:152:in `block in networks'
 528a1e29 | /home/vagrant/foreman/app/services/compute_resource_cache.rb:68:in `instance_eval'
 528a1e29 | /home/vagrant/foreman/app/services/compute_resource_cache.rb:68:in `get_uncached_value'
 528a1e29 | /home/vagrant/foreman/app/services/compute_resource_cache.rb:22:in `cache'
 528a1e29 | /home/vagrant/foreman/app/models/compute_resources/foreman/model/vmware.rb:151:in `networks'
 528a1e29 | /home/vagrant/foreman/app/models/compute_resources/foreman/model/vmware.rb:173:in `available_networks'
 528a1e29 | /home/vagrant/foreman/app/controllers/api/v2/compute_resources_controller.rb:143:in `available_networks'

Actions #1

Updated by The Foreman Bot almost 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8626 added
Actions #2

Updated by Markus Bucher almost 3 years ago

Using cluster_id domain-s7 also does not work when using the alternative API-URL /api/compute_resources/1/available_networks?cluster_id=domain-s7.

Given that API-URL /api/compute_resources/1/available_networks?cluster_id=192.168.80.2 works, in the attached PR I have only fixed the broken route for in-path cluster_ids that e.g. use '.'.

Actions #3

Updated by The Foreman Bot almost 3 years ago

  • Fixed in Releases 3.0.0 added
Actions #4

Updated by Markus Bucher almost 3 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF