Bug #25717
closedBootdisk provision_method not available in API (docs)
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
Updated by Lukas Zapletal about 6 years ago
- Related to Bug #22557: provision_method in host create API should list possible values in param type added
Updated by Lukas Zapletal about 6 years ago
- Subject changed from provision_method bootdisk not available in apidoc to Bootdisk provision_method not available in API (docs)
- Category set to API
- Priority changed from High to Normal
- Triaged changed from No to Yes
Updated by Ivan Necas about 6 years ago
- Related to Bug #17208: Unable to filter Errata's applicable content hosts by environment using corresponding env dropdown added
Updated by Ivan Necas about 6 years 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.
Updated by Ivan Necas about 6 years 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
Updated by The Foreman Bot about 6 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ivan Necas
- Pull request https://github.com/theforeman/foreman/pull/6399 added
Updated by Ivan Necas about 6 years ago
- Blocks Bug #25820: Use string in `add_controller_action_scope` added
Updated by Ivan Necas about 6 years ago
- Blocks Bug #25821: Use string in `add_controller_action_scope` added
Updated by Ivan Necas about 6 years ago
- Blocks Refactor #25822: Ensure api controllers are not loaded until plugins are registered added
Updated by Ivan Necas about 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 8e8800dfb4097473de1466635f23802175be327b.
Updated by Bernhard Suttner about 6 years 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
Updated by Lukas Zapletal almost 6 years ago
- Related to Bug #26099: Unable to build VM with bootdisk option using hammer-cli-foreman added