Bug #17894

apipie cache generation with facets fails due to apipie doc dependencies

Added by Justin Sherrill 3 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Justin Sherrill
Category:API
Target version:-
Difficulty:easy Bugzilla link:
Found in release:1.14.0 Pull request:https://github.com/theforeman/foreman/pull/4150
Story points-
Velocity based estimate-
Release1.14.0Release relationshipAuto

Description

When using the plugin api to hook into the facet framework, apipie doc generation will fail with the traceback below.

this is due to an ordering issue where the facets are loaded, but the api param groups are not. And so the hosts controller apidoc is loaded and thus the facet framework attempts to load their api param group and fails, as the facet api param group has not been loaded.

Associated revisions

Revision 61ccbc34
Added by Justin Sherrill 3 months ago

Fixes #17894 - load needed dependent api param group

when rendering facet api param docs

History

#1 Updated by Justin Sherrill 3 months ago

traceback

param group Katello::Api::V2::HostContentsController#content_facet_attributes not defined
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:152:in `get_param_group'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/apipie_module.rb:18:in `method_missing'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/dsl_definition.rb:338:in `param_group'
/home/vagrant/git/foreman/app/controllers/api/v2/hosts_controller.rb:102:in `block (4 levels) in <class:HostsController>'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:286:in `instance_exec'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:286:in `initialize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:279:in `new'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:279:in `build'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:24:in `block in find'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:23:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:23:in `find'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/param_description.rb:63:in `initialize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/param_description.rb:16:in `new'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/param_description.rb:16:in `from_dsl_data'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:300:in `block in params_ordered'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:297:in `map'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:297:in `params_ordered'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:353:in `prepare_hash_params'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:293:in `initialize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:279:in `new'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:279:in `build'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:24:in `block in find'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:23:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/validator.rb:23:in `find'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/param_description.rb:63:in `initialize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/param_description.rb:16:in `new'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/param_description.rb:16:in `from_dsl_data'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/method_description.rb:48:in `block in initialize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/method_description.rb:47:in `map'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/method_description.rb:47:in `initialize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:92:in `new'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:92:in `block in define_method_description'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:84:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:84:in `define_method_description'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/apipie_module.rb:18:in `method_missing'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/dsl_definition.rb:408:in `method_added'
/home/vagrant/git/foreman/app/controllers/api/v2/hosts_controller.rb:111:in `<class:HostsController>'
/home/vagrant/git/foreman/app/controllers/api/v2/hosts_controller.rb:3:in `<module:V2>'
/home/vagrant/git/foreman/app/controllers/api/v2/hosts_controller.rb:2:in `<module:Api>'
/home/vagrant/git/foreman/app/controllers/api/v2/hosts_controller.rb:1:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:457:in `load'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:457:in `block in load_file'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:647:in `new_constants_in'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:456:in `load_file'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:354:in `require_or_load'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:494:in `load_missing_constant'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:184:in `const_missing'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:276:in `const_get'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:276:in `block in constantize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `inject'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `constantize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.7.1/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:412:in `load_controller_from_file'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:301:in `block in reload_documentation'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:300:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/application.rb:300:in `reload_documentation'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/apipie/apipie_module.rb:18:in `method_missing'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/tasks/apipie.rake:194:in `with_loaded_documentation'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/apipie-rails-0.3.7/lib/tasks/apipie.rake:64:in `block (2 levels) in <top (required)>'
/home/vagrant/.rvm/gems/ruby-2.2.4/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `<main>'

#2 Updated by The Foreman Bot 3 months ago

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

#3 Updated by Anonymous 3 months ago

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

#4 Updated by Dominic Cleal 3 months ago

  • Release changed from 1.14.0 to 1.14.1

Looks related to #13216, not 1.14.0, moving.

#5 Updated by Justin Sherrill 3 months ago

Its actually related to https://github.com/theforeman/foreman/pull/3987

This broke inheritance of facet attributes from a hostgroup and was fixed alongside in https://github.com/Katello/katello/pull/6474

When moving to the plugin framework as part of https://github.com/Katello/katello/pull/6474, it became clear after the merge that this breaks apipie cache generation.

So now we are stuck unable to build our plugin (in nightly and 1.14) until this change gets in, or we revert part of https://github.com/Katello/katello/pull/6474

Could we get this moved back to 1.14.0?

#6 Updated by Dominic Cleal 3 months ago

  • Release changed from 1.14.1 to 1.14.0

Thanks for the info - please include it in the ticket if setting the release.

Also available in: Atom PDF