cli machines update: run deploy directly if deploying single machine

This commit is contained in:
lassulus
2024-11-12 16:04:59 +01:00
parent 2c66b36931
commit ebfc8ecfd0
2 changed files with 6 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ T = TypeVar("T")
class MachineGroup:
def __init__(self, machines: list[Machine]) -> None:
self.machines = machines
self.group = HostGroup([m.target_host for m in machines])
def __repr__(self) -> str:

View File

@@ -120,6 +120,7 @@ def deploy_machine(machines: MachineGroup) -> None:
generate_vars([machine], None, False)
upload_secrets(machine)
path = upload_sources(
machine,
)
@@ -151,7 +152,10 @@ def deploy_machine(machines: MachineGroup) -> None:
if ret.returncode != 0:
ret = host.run(cmd, extra_env=env)
machines.run_function(deploy)
if len(machines.group.hosts) > 1:
machines.run_function(deploy)
else:
deploy(machines.machines[0])
def update(args: argparse.Namespace) -> None: