File: config.py

package info (click to toggle)
shadow 1%3A4.19.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 66,808 kB
  • sloc: sh: 44,185; ansic: 34,184; xml: 12,350; exp: 3,691; makefile: 1,655; python: 1,409; perl: 120; sed: 16
file content (53 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (3)
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,
        }