Add "supported_extensions" method to MechanismDriver

This method returns the supported plugin extensions, given a
set of them. Each mechanism driver will be able to implement each
own filtering method.

By default, the method will return the same set of extensions
without any filtering.

Related-Bug: #1888829

Change-Id: I6fd62f6f393b635e6710020adab736a09a142556
This commit is contained in:
Rodolfo Alonso Hernandez 2020-07-27 18:06:35 +00:00
parent a49c07c2f9
commit b4e33e5e7a
2 changed files with 22 additions and 0 deletions

View File

@ -455,6 +455,21 @@ class MechanismDriver(object, metaclass=abc.ABCMeta):
"""
return []
def supported_extensions(self, extensions):
"""Return the mechanism driver supported extensions
By default this method will return the same provided set, without any
filtering. In case any particular mechanism driver needs to filter out
any specific extension or supports only a reduced set of extensions,
this method should be override.
:param extensions: set of extensions supported by the instance that
created this mechanism driver.
:returns: a set of the extensions currently supported by this
mechanism driver
"""
return extensions
class _TypeDriverBase(object, metaclass=abc.ABCMeta):

View File

@ -0,0 +1,7 @@
---
features:
- |
Add ``supported_extensions`` method to ``MechanismDriver``. This method
provides an standard API to implement, per mechanism driver, a way to
filter the supported extensions. By default, this method will return the
same set of extensions passed.