1
0
Fork 0

added modspec as an helper function.

it has the typedefinition that allows the developer to get the required parameters for ansible modules more easily
Dieser Commit ist enthalten in:
Sebastian Tobie 2023-04-23 09:08:44 +02:00
Ursprung a2174af565
Commit 652b7e961d
1 geänderte Dateien mit 18 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -102,3 +102,21 @@ def systemdbool(b: Union[bool, str]) -> str:
elif b is False: elif b is False:
return "no" return "no"
return b return b
def modspec(
argument_spec: Dict[str, Dict[str, Any]],
mutually_exclusive: Sequence[Tuple[str, ...]] = (),
required_together: Sequence[Tuple[str, ...]] = (),
required_one_of: Sequence[Tuple[str, ...]] = (),
required_if: Sequence[Union[Tuple[str, Any, Tuple[str, ...]], Tuple[str, Any, Tuple[str, ...], bool]]] = (),
required_by: Dict[str, Union[str, Tuple[str, ...]]] = {},
) -> Dict[str, Any]:
return dict(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive,
required_together=required_together,
required_one_of=required_one_of,
required_if=required_if,
required_by=required_by,
)