1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
from __future__ import annotations
from typing import Type
from pytest_mh import MultihostConfig, MultihostDomain, MultihostHost, MultihostRole
__all__ = [
"ShadowMultihostConfig",
"ShadowMultihostDomain",
]
class ShadowMultihostConfig(MultihostConfig):
@property
def id_to_domain_class(self) -> dict[str, Type[MultihostDomain]]:
"""
All domains are mapped to :class:`ShadowMultihostDomain`.
:rtype: Class name.
"""
return {"*": ShadowMultihostDomain}
class ShadowMultihostDomain(MultihostDomain[ShadowMultihostConfig]):
@property
def role_to_host_class(self) -> dict[str, Type[MultihostHost]]:
"""
Map roles to classes:
* shadow to ShadowHost
:rtype: Class name.
"""
from .hosts.shadow import ShadowHost
return {
"shadow": ShadowHost,
}
@property
def role_to_role_class(self) -> dict[str, Type[MultihostRole]]:
"""
Map roles to classes:
* shadow to Shadow
:rtype: Class name.
"""
from .roles.shadow import Shadow
return {
"shadow": Shadow,
}
|