Project

General

Profile

Actions

Bug #25717

closed

Bootdisk provision_method not available in API (docs)

Added by Bernhard Suttner over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Yes
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 6 (1 open5 closed)

Related to Foreman - Bug #22557: provision_method in host create API should list possible values in param typeClosedTomáš Strachota02/12/2018Actions
Related to Katello - Bug #17208: Unable to filter Errata's applicable content hosts by environment using corresponding env dropdownClosedAndrew Kofink11/03/2016Actions
Related to Hammer CLI - Bug #26099: Unable to build VM with bootdisk option using hammer-cli-foremanResolvedActions
Blocks Katello - Bug #25820: Use string in `add_controller_action_scope`ClosedIvan NecasActions
Blocks OpenSCAP - Bug #25821: Use string in `add_controller_action_scope`ClosedIvan NecasActions
Blocks Foreman - Refactor #25822: Ensure api controllers are not loaded until plugins are registered NewActions
Actions #1

Updated by Lukas Zapletal over 5 years ago

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

Updated by Lukas Zapletal over 5 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
Actions #3

Updated by Ivan Necas over 5 years ago

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

Updated by Ivan Necas over 5 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.

Actions #5

Updated by Ivan Necas over 5 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

Actions #6

Updated by The Foreman Bot over 5 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
Actions #7

Updated by Ivan Necas over 5 years ago

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

Updated by Ivan Necas over 5 years ago

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

Updated by Ivan Necas over 5 years ago

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

Updated by Tomer Brisker over 5 years ago

  • Fixed in Releases 1.21.0 added
Actions #11

Updated by Ivan Necas over 5 years ago

  • Status changed from Ready For Testing to Closed
Actions #12

Updated by Bernhard Suttner over 5 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

Actions #13

Updated by Lukas Zapletal about 5 years ago

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

Also available in: Atom PDF