Project

General

Profile

Bug #25717

Bootdisk provision_method not available in API (docs)

Added by Bernhard Suttner 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

In the apipie documentation, the provision_method bootdisk doesn't exist - therefore hammer cli can't deploy with bootdisk.

I added some logging entries. The registries/foreman/plugin.rb#provision_method is called AFTER models/host/managed.rb#provison_method. Means, the bootdisk plugin "registers" as a plugin but at this time, the apipie already got the available provison_methods from host/managed.rb

See:
----
2018-12-17T22:11:33 [W|app|] Creating scope :path_of. Overwriting existing method Taxonomy.path_of.
2018-12-17T22:11:39 [W|app|] Creating scope :path_of. Overwriting existing method Hostgroup.path_of.
2018-12-17T22:11:39 [W|app|] Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
2018-12-17T22:11:41 [W|app|] Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
2018-12-17T22:11:41 [E|app|] YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY return registered: {} -- registered_provision_methods
2018-12-17T22:11:41 [E|app|] YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY return registered: {} -- registered_provision_methods

2018-12-17T22:11:43 [W|app|] Scoped order is ignored, it's forced to be batch order.

2018-12-17T22:11:45 [E|app|] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with bootdisk -- provision_method
---

I changed the provision_method in registries/foreman/plugin.rb and added the following line:
Host::Managed.provision_methods.keys

Unfortunately, this doesn't work as expected. The bootdisk plugin is still missing:
2018-12-17T22:11:45 [E|app|] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with bootdisk -- provision_method
2018-12-17T22:11:45 [E|app|] YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY return registered: {} -- registered_provision_methods


Related issues

Related to Foreman - Bug #22557: provision_method in host create API should list possible values in param typeClosed2018-02-12
Related to Katello - Bug #17208: Unable to filter Errata's applicable content hosts by environment using corresponding env dropdownClosed2016-11-03
Related to Hammer CLI - Bug #26099: Unable to build VM with bootdisk option using hammer-cli-foremanResolved
Blocks Katello - Bug #25820: Use string in `add_controller_action_scope`Closed
Blocks OpenSCAP - Bug #25821: Use string in `add_controller_action_scope`Closed
Blocks Foreman - Refactor #25822: Ensure api controllers are not loaded until plugins are registered Ready For Testing

Associated revisions

Revision 8e8800df (diff)
Added by Ivan Necas 5 months ago

Fixes #25717 - use string in `add_controller_action_scope`

Using class causes preliminary evaluation of api docs, so that plugin
updates are not visible in docs.

History

#1 Updated by Lukas Zapletal 5 months ago

  • Related to Bug #22557: provision_method in host create API should list possible values in param type added

#2 Updated by Lukas Zapletal 5 months ago

  • Triaged changed from No to Yes
  • Priority changed from High to Normal
  • Category set to API
  • Subject changed from provision_method bootdisk not available in apidoc to Bootdisk provision_method not available in API (docs)

#3 Updated by Ivan Necas 5 months ago

  • Related to Bug #17208: Unable to filter Errata's applicable content hosts by environment using corresponding env dropdown added

#4 Updated by Ivan Necas 5 months ago

The issue is with add_controller_action_scope method in plugin api (https://github.com/theforeman/foreman/blob/c69f8b647841a30de1fbbf6620a00c4274c6eb30/app/registries/foreman/plugin.rb#L469), that expects controller class, so that the controller is loaded sooner than the provision_method is added from the plugin.

The solution should:

1. fix foreman to use string instead of the class name when registering the scope
2. fix plugins that use this api to pass string instead of class name

Additionally, to prevent this happening, we should invest time to ensure we don't load controllers sooner than in `to_prepare` phase, when all the plugins should be already registered.

#5 Updated by Ivan Necas 5 months ago

  • Target version set to 1.21.0

It would be still good to get this fix into 1.21, so that the plugins can be still fixed in this release

#6 Updated by The Foreman Bot 5 months ago

  • Assignee set to Ivan Necas
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6399 added

#7 Updated by Ivan Necas 5 months ago

  • Blocks Bug #25820: Use string in `add_controller_action_scope` added

#8 Updated by Ivan Necas 5 months ago

  • Blocks Bug #25821: Use string in `add_controller_action_scope` added

#9 Updated by Ivan Necas 5 months ago

  • Blocks Refactor #25822: Ensure api controllers are not loaded until plugins are registered added

#10 Updated by Tomer Brisker 5 months ago

  • Fixed in Releases 1.21.0 added

#11 Updated by Ivan Necas 5 months ago

  • Status changed from Ready For Testing to Closed

#12 Updated by Bernhard Suttner 4 months ago

To fix the issue, you need to additionally apply
https://github.com/Katello/katello/pull/7917
https://github.com/theforeman/foreman_openscap/pull/368

Afterwards run:
foreman-rake apipie:cache

#13 Updated by Lukas Zapletal 30 days ago

  • Related to Bug #26099: Unable to build VM with bootdisk option using hammer-cli-foreman added

Also available in: Atom PDF