fix: suppress legacy warnings in machine JSON paths
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# ruff: noqa: BLE001, S110, B008
|
||||
import logging
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from typing import TypedDict
|
||||
|
||||
@@ -143,10 +144,19 @@ def _schema_json(payload: dict) -> None:
|
||||
|
||||
|
||||
def _machine_config(config: Path):
|
||||
try:
|
||||
return load_config(config)
|
||||
except ConfigError:
|
||||
raise _MachineSchemaError("invalid_configuration") from None
|
||||
# Legacy resource keys remain accepted, but their deprecation warning is not part of
|
||||
# the JSON machine contract. Keep this filter scoped to this call so human commands
|
||||
# (and unrelated warnings/errors) retain their existing behavior.
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings(
|
||||
"ignore",
|
||||
message=r"^DEPRECATION: legacy workspace resource keys are deprecated;",
|
||||
category=FutureWarning,
|
||||
)
|
||||
try:
|
||||
return load_config(config)
|
||||
except ConfigError:
|
||||
raise _MachineSchemaError("invalid_configuration") from None
|
||||
|
||||
|
||||
def _physical_or_error(cfg):
|
||||
|
||||
Reference in New Issue
Block a user