Remove reference to --jinjaturtle auto/on/off (it's a boolean arg). Fix alma python
All checks were successful
All checks were successful
This commit is contained in:
parent
e72044b610
commit
85345083a3
10 changed files with 76 additions and 37 deletions
|
|
@ -418,7 +418,7 @@ def _prepare_ansible_context(
|
|||
out_dir: str,
|
||||
*,
|
||||
fqdn: Optional[str],
|
||||
jinjaturtle: str,
|
||||
jinjaturtle: Optional[bool],
|
||||
) -> AnsibleManifestContext:
|
||||
site_mode = fqdn is not None and fqdn != ""
|
||||
jt_exe, jt_enabled = resolve_jinjaturtle_mode(jinjaturtle)
|
||||
|
|
@ -2400,7 +2400,7 @@ class AnsibleManifestRenderer:
|
|||
out_dir: str,
|
||||
*,
|
||||
fqdn: Optional[str] = None,
|
||||
jinjaturtle: str = "auto",
|
||||
jinjaturtle: Optional[bool] = None,
|
||||
no_common_roles: bool = False,
|
||||
) -> None:
|
||||
self.bundle_dir = bundle_dir
|
||||
|
|
@ -2499,7 +2499,7 @@ def manifest_from_bundle_dir(
|
|||
out_dir: str,
|
||||
*,
|
||||
fqdn: Optional[str] = None,
|
||||
jinjaturtle: str = "auto",
|
||||
jinjaturtle: Optional[bool] = None,
|
||||
no_common_roles: bool = False,
|
||||
) -> None:
|
||||
AnsibleManifestRenderer(
|
||||
|
|
|
|||
|
|
@ -481,12 +481,12 @@ def _add_common_manifest_args(p: argparse.ArgumentParser) -> None:
|
|||
)
|
||||
|
||||
|
||||
def _jt_mode(args: argparse.Namespace) -> str:
|
||||
def _jt_mode(args: argparse.Namespace) -> Optional[bool]:
|
||||
if getattr(args, "jinjaturtle", False):
|
||||
return "on"
|
||||
return True
|
||||
if getattr(args, "no_jinjaturtle", False):
|
||||
return "off"
|
||||
return "auto"
|
||||
return False
|
||||
return None
|
||||
|
||||
|
||||
def _add_config_args(p: argparse.ArgumentParser) -> None:
|
||||
|
|
|
|||
|
|
@ -43,24 +43,26 @@ SUPPORTED_SUFFIXES = {
|
|||
} | SYSTEMD_SUFFIXES
|
||||
|
||||
|
||||
def resolve_jinjaturtle_mode(jinjaturtle: str) -> Tuple[Optional[str], bool]:
|
||||
"""Resolve Enroll's common JinjaTurtle mode flag.
|
||||
def resolve_jinjaturtle_mode(
|
||||
jinjaturtle: Optional[bool] = None,
|
||||
) -> Tuple[Optional[str], bool]:
|
||||
"""Resolve Enroll's common JinjaTurtle flag.
|
||||
|
||||
Renderers accept the same values:
|
||||
- ``auto``: use JinjaTurtle when present on PATH
|
||||
- ``on``: require it and fail if it is absent
|
||||
- ``off``: never use it
|
||||
``None`` means the default behaviour: use JinjaTurtle when its executable
|
||||
is present on PATH. ``True`` corresponds to ``--jinjaturtle`` and requires
|
||||
the executable. ``False`` corresponds to ``--no-jinjaturtle`` and disables
|
||||
the integration.
|
||||
"""
|
||||
jt_exe = find_jinjaturtle_cmd()
|
||||
if jinjaturtle not in {"auto", "on", "off"}:
|
||||
raise ValueError("jinjaturtle must be one of: auto, on, off")
|
||||
if jinjaturtle == "on":
|
||||
if jinjaturtle is True:
|
||||
if not jt_exe:
|
||||
raise RuntimeError("jinjaturtle requested but not found on PATH")
|
||||
return jt_exe, True
|
||||
if jinjaturtle == "auto":
|
||||
if jinjaturtle is False:
|
||||
return jt_exe, False
|
||||
if jinjaturtle is None:
|
||||
return jt_exe, jt_exe is not None
|
||||
return jt_exe, False
|
||||
raise TypeError("jinjaturtle must be None, True, or False")
|
||||
|
||||
|
||||
def _merge_mappings_overwrite(
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ def manifest(
|
|||
out: str,
|
||||
*,
|
||||
fqdn: Optional[str] = None,
|
||||
jinjaturtle: str = "auto", # auto|on|off
|
||||
jinjaturtle: Optional[bool] = None,
|
||||
sops_fingerprints: Optional[List[str]] = None,
|
||||
no_common_roles: bool = False,
|
||||
) -> Optional[str]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue