You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be incredibly convenient for development purposes if it were possible to run the esi-leap service without requiring a keystone instance. Unfortunately, the existing implementation is strongly coupled to keystone. Solving this dependency issue is trickier than it needs to be due to some previous design decisions:
esi_leap/api/controllers/v1/utils.py has a bunch of standalone functions that should be instance methods.
offer_get_dict_with_added_info should be part of OffersController.
lease_get_dict_with_added_info should be part of LeasesController
Because these functions are not part of their respective class instance, it is effectively impossible to modify their behavior through configuration at runtime.
Several of the existing controllers make calls directly to the esp_leap.common.keystone module.
The path forward is to replace this strong coupling with dependency injection. In particular, the controller classes should receive an IDP implementation object when they are instantiated, and use that for obtaining necessary metadata. That is, instead of call keystone.get_project_list(), we should have a base IDP interface like this:
Then we should implement a KeystoneIDP class that implements this interface; for normal production use we would pass that into the controllers.
For development use, we would have something like a StaticIDP that would take a project id, name, etc from a section in the esi-leap.conf file.
In addition to make development much more convenient, this also makes testing easier: it is no longer necessary to mock out keystone-related functions; we can instead just pass in a test-specific IDP class that always returns known values.
The text was updated successfully, but these errors were encountered:
It would be incredibly convenient for development purposes if it were possible to run the esi-leap service without requiring a keystone instance. Unfortunately, the existing implementation is strongly coupled to keystone. Solving this dependency issue is trickier than it needs to be due to some previous design decisions:
esi_leap/api/controllers/v1/utils.py
has a bunch of standalone functions that should be instance methods.offer_get_dict_with_added_info
should be part ofOffersController
.lease_get_dict_with_added_info
should be part ofLeasesController
Because these functions are not part of their respective class instance, it is effectively impossible to modify their behavior through configuration at runtime.
Several of the existing controllers make calls directly to the
esp_leap.common.keystone
module.The path forward is to replace this strong coupling with dependency injection. In particular, the controller classes should receive an IDP implementation object when they are instantiated, and use that for obtaining necessary metadata. That is, instead of call
keystone.get_project_list()
, we should have a base IDP interface like this:Then we should implement a
KeystoneIDP
class that implements this interface; for normal production use we would pass that into the controllers.For development use, we would have something like a
StaticIDP
that would take a project id, name, etc from a section in theesi-leap.conf
file.In addition to make development much more convenient, this also makes testing easier: it is no longer necessary to mock out keystone-related functions; we can instead just pass in a test-specific IDP class that always returns known values.
The text was updated successfully, but these errors were encountered: