Merge pull request 'ruff-7-misc' (#4939) from ruff-7-misc into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4939
This commit is contained in:
@@ -13,24 +13,24 @@ def check_secrets(machine: Machine, service: None | str = None) -> bool:
|
||||
missing_secret_facts = []
|
||||
missing_public_facts = []
|
||||
services = [service] if service else list(machine.facts_data.keys())
|
||||
for service in services:
|
||||
for secret_fact in machine.facts_data[service]["secret"]:
|
||||
for svc in services:
|
||||
for secret_fact in machine.facts_data[svc]["secret"]:
|
||||
if isinstance(secret_fact, str):
|
||||
secret_name = secret_fact
|
||||
else:
|
||||
secret_name = secret_fact["name"]
|
||||
if not machine.secret_facts_store.exists(service, secret_name):
|
||||
if not machine.secret_facts_store.exists(svc, secret_name):
|
||||
machine.info(
|
||||
f"Secret fact '{secret_fact}' for service '{service}' is missing.",
|
||||
f"Secret fact '{secret_fact}' for service '{svc}' is missing.",
|
||||
)
|
||||
missing_secret_facts.append((service, secret_name))
|
||||
missing_secret_facts.append((svc, secret_name))
|
||||
|
||||
for public_fact in machine.facts_data[service]["public"]:
|
||||
if not machine.public_facts_store.exists(service, public_fact):
|
||||
for public_fact in machine.facts_data[svc]["public"]:
|
||||
if not machine.public_facts_store.exists(svc, public_fact):
|
||||
machine.info(
|
||||
f"Public fact '{public_fact}' for service '{service}' is missing.",
|
||||
f"Public fact '{public_fact}' for service '{svc}' is missing.",
|
||||
)
|
||||
missing_public_facts.append((service, public_fact))
|
||||
missing_public_facts.append((svc, public_fact))
|
||||
|
||||
machine.debug(f"missing_secret_facts: {missing_secret_facts}")
|
||||
machine.debug(f"missing_public_facts: {missing_public_facts}")
|
||||
|
||||
@@ -178,10 +178,10 @@ def _generate_facts_for_machine(
|
||||
else:
|
||||
machine_service_facts = machine.facts_data
|
||||
|
||||
for service in machine_service_facts:
|
||||
for svc in machine_service_facts:
|
||||
machine_updated |= generate_service_facts(
|
||||
machine=machine,
|
||||
service=service,
|
||||
service=svc,
|
||||
regenerate=regenerate,
|
||||
secret_facts_store=machine.secret_facts_store,
|
||||
public_facts_store=machine.public_facts_store,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import require_flake
|
||||
from clan_lib.network.network import networks_from_flake
|
||||
|
||||
@@ -54,7 +55,7 @@ def list_command(args: argparse.Namespace) -> None:
|
||||
try:
|
||||
is_running = network.is_running()
|
||||
running_status = "Yes" if is_running else "No"
|
||||
except Exception:
|
||||
except ClanError:
|
||||
running_status = "Error"
|
||||
|
||||
print(
|
||||
|
||||
@@ -83,7 +83,7 @@ class KeyType(enum.Enum):
|
||||
|
||||
except FileNotFoundError:
|
||||
return
|
||||
except Exception as ex:
|
||||
except OSError as ex:
|
||||
log.warning(f"Could not read age keys from {key_path}", exc_info=ex)
|
||||
|
||||
if keys := os.environ.get("SOPS_AGE_KEY"):
|
||||
|
||||
@@ -52,12 +52,12 @@ def list_state_folders(machine: Machine, service: None | str = None) -> None:
|
||||
description=f"The service: {service} needs to be configured for the machine.",
|
||||
)
|
||||
|
||||
for service in state:
|
||||
if not service:
|
||||
for svc in state:
|
||||
if not svc:
|
||||
continue
|
||||
|
||||
print(f"· service: {service}")
|
||||
service_cfg = state.get(service)
|
||||
print(f"· service: {svc}")
|
||||
service_cfg = state.get(svc)
|
||||
|
||||
if not service_cfg:
|
||||
continue # or handle missing config
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import contextlib
|
||||
import socket
|
||||
from collections.abc import Callable
|
||||
|
||||
@@ -34,7 +34,7 @@ def start_virtiofsd(socket_path: Path) -> Iterator[None]:
|
||||
str(store),
|
||||
],
|
||||
)
|
||||
log.debug("$ {}".format(" ".join(virtiofsd)))
|
||||
log.debug("$ %s", " ".join(virtiofsd))
|
||||
with subprocess.Popen(virtiofsd) as proc:
|
||||
try:
|
||||
while not socket_path.exists():
|
||||
|
||||
Reference in New Issue
Block a user