PGH003: fix

This commit is contained in:
Jörg Thalheim
2025-08-20 21:14:33 +02:00
parent cbf9678534
commit 8f8426de52
29 changed files with 212 additions and 102 deletions

View File

@@ -4,6 +4,7 @@ import os
import re
import shlex
from contextlib import ExitStack
from typing import cast
from clan_cli.facts.generate import generate_facts
from clan_cli.facts.upload import upload_secrets
@@ -138,13 +139,15 @@ def run_machine_update(
"""
with ExitStack() as stack:
_target_host: Host = stack.enter_context(target_host.host_connection()) # type: ignore
_target_host: Host = cast(
Host, stack.enter_context(target_host.host_connection())
)
_build_host: Host
# If no build host is specified, use the target host as the build host.
if build_host is None:
_build_host = _target_host # type: ignore
_build_host = _target_host
else:
_build_host = stack.enter_context(build_host.host_connection()) # type: ignore
_build_host = cast(Host, stack.enter_context(build_host.host_connection()))
# Some operations require root privileges on the target host.
target_host_root = stack.enter_context(_target_host.become_root())