Coverage for r11k/puppetmodule/__init__.py: 100%
7 statements
« prev ^ index » next coverage.py v7.2.1, created at 2023-03-13 21:48 +0100
« prev ^ index » next coverage.py v7.2.1, created at 2023-03-13 21:48 +0100
1"""
2Datatypes for requested Puppet modules.
4An abstract base class which implements our expected interface is
5available in `r11k.puppetmodule.base`. Every other submodule here
6should be an implementation, providing a source for where to get
7Puppet modules.
9This is what is stored in puppetfile.yaml
11The implementations are in
12- `r11k.puppetmodule.git`
13- `r11k.puppetmodule.forge`
14"""
16from .base import PuppetModule
17from .git import GitPuppetModule
18from .forge import ForgePuppetModule
21def parse_module_dict(d: dict) -> PuppetModule:
22 """
23 Parse dict describing module into module object.
25 Currently, it becomes a `GitPuppetModule` if the `git` key is
26 present, and a `ForgePuppetModule` otherwise.
27 """
28 if 'git' in d:
29 return GitPuppetModule(**d)
30 else:
31 return ForgePuppetModule(**d)