Project

General

Profile

Bug #15186

API /products/:product/repositories fails with undefined method

Added by Zach Huntington-Meath over 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
API
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1337164
Description of problem:
API call to /products/:product/repositories fails with undefined method. See below that the product info API call includes repositories. But then the call afterwards to list the repositories fails:

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/products/27 | jq .repositories
[ {
"id": 48,
"name": "Red Hat Satellite 6.1 for RHEL 7 Server RPMs x86_64"
}, {
"id": 47,
"name": "Red Hat Satellite 6.1 for RHEL 6 Server RPMs x86_64"
}
]

[crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/products/27/repositories | jq . {
"errors": [
"undefined method `[]' for nil:NilClass"
],
"displayMessage": "undefined method `[]' for nil:NilClass"
}

Backtrace:
2016-05-18 12:11:24 [app] [I] Started GET "/katello/api/v2/products/27/repositories" for 127.0.0.1 at 2016-05-18 12:11:24 +0000
2016-05-18 12:11:24 [app] [I] Processing by Katello::Api::V2::ProductsController#repositories as */*
2016-05-18 12:11:24 [app] [I] Parameters: {"per_page"=>9999, "api_version"=>"v2", "id"=>"27", "product"=>{}}
2016-05-18 12:11:24 [app] [I] Authorized user hoici(hoici )
2016-05-18 12:11:24 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.24/app/views/katello/api/v2/products/repositories.json.rabl (11.0ms)
2016-05-18 12:11:24 [app] [E] NoMethodError: undefined method `[]' for nil:NilClass | (eval):1:in `block in eval_source' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:152:in `call' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:152:in `node' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:114:in `block in compile_settings' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:113:in `each' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:113:in `compile_settings' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:58:in `block in to_hash' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:248:in `cache_results' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/builder.rb:49:in `to_hash' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:86:in `to_hash' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:101:in `to_dumpable' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:110:in `to_json' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:48:in `block in render' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:382:in `cache_results' | /opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.11.6/lib/rabl/engine.rb:47:in `render' | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.24/app/views/katello/api/v2/products/repositories.json.rabl:3:in `_22936ff6e64e54fa96d9d4b38da665a1' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/template.rb:145:in `block in render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/notifications.rb:161:in `instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/template.rb:339:in `instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/template.rb:143:in `render' | /opt/theforeman/tfm/root/usr/share/gems/gems/deface-1.0.2/lib/deface/action_view_extensions.rb:41:in `render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/notifications.rb:159:in `block in instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/notifications.rb:159:in `instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/template_renderer.rb:54:in `block in render_template' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/template_renderer.rb:53:in `render_template' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/template_renderer.rb:17:in `render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/renderer.rb:46:in `render_template' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/renderer/renderer.rb:27:in `render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/rendering.rb:99:in `_render_template' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/streaming.rb:217:in `_render_template' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionview-4.1.5/lib/action_view/rendering.rb:82:in `render_to_body' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/rendering.rb:32:in `render_to_body' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/renderers.rb:32:in `render_to_body' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/abstract_controller/rendering.rb:25:in `render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/rendering.rb:16:in `render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/actionpack-4.1.5/lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/core_ext/benchmark.rb:12:in `block in ms' | /opt/rh/rh-ruby22/root/usr/share/ruby/benchmark.rb:303:in `realtime'
...

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. API call to /products/:product/repositories
2.
3.

Actual results:
Failure

Expected results:
Success

Additional info:

Associated revisions

Revision aad44630 (diff)
Added by Zach Huntington-Meath over 2 years ago

Fixes #15186 - Repository end points route properly (#6077)

Added documentation for new routes to apipie docs.

Fixed id issues.

History

#1 Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/6069 added

#2 Updated by The Foreman Bot over 2 years ago

  • Pull request https://github.com/Katello/katello/pull/6077 added

#3 Updated by Eric Helms over 2 years ago

  • Legacy Backlogs Release (now unused) set to 143

#4 Updated by Zach Huntington-Meath over 2 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF