Skip to content

Commit

Permalink
feat: expose function for provider->version map (#136)
Browse files Browse the repository at this point in the history
Signed-off-by: Weston Steimel <[email protected]>
  • Loading branch information
westonsteimel authored Mar 28, 2023
1 parent 2d2768c commit dba31ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/vunnel/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if TYPE_CHECKING:
from vunnel import provider

_providers = {
_providers: dict[str, type[provider.Provider]] = {
alpine.Provider.name(): alpine.Provider,
amazon.Provider.name(): amazon.Provider,
centos.Provider.name(): centos.Provider,
Expand All @@ -49,6 +49,10 @@ def names() -> list[str]:
return sorted(_providers.keys())


def versions() -> dict[str, int]:
return {n: p.version() for (n, p) in _providers.items()}


def register(name: str, cls: type[provider.Provider]) -> None:
if name in _providers and _providers[name] != cls:
raise KeyError(f"provider {name!r} is already registered to another provider class: {_providers[name]!r}")
Expand Down

0 comments on commit dba31ab

Please sign in to comment.