clan_lib: deprecate is_writeable_key

This commit is contained in:
Johannes Kirschbauer
2025-09-21 16:37:50 +02:00
parent 381c190ba2
commit 9a03644a80
3 changed files with 5 additions and 7 deletions

View File

@@ -24,10 +24,6 @@ from clan_lib.persist.static_data import (
from .util import ( from .util import (
path_match, path_match,
# calc_patches,
# delete_by_path,
# determine_writeability,
# set_value_by_path,
) )

View File

@@ -362,7 +362,7 @@ def find_duplicates(string_list: list[str]) -> list[str]:
return [item for item, freq in count.items() if freq > 1] return [item for item, freq in count.items() if freq > 1]
def is_writeable_key( def is_writeable_path(
key: PathTuple, key: PathTuple,
writeables: WriteabilityResult, writeables: WriteabilityResult,
) -> bool: ) -> bool:
@@ -386,7 +386,7 @@ def is_writeable_key(
def validate_writeability(path: PathTuple, writeables: WriteabilityResult) -> None: def validate_writeability(path: PathTuple, writeables: WriteabilityResult) -> None:
"""Validate that a path is writeable.""" """Validate that a path is writeable."""
if not is_writeable_key(path, writeables): if not is_writeable_path(path, writeables):
msg = f"Path '{path_to_string(path)}' is readonly. - It seems its value is statically defined in nix." msg = f"Path '{path_to_string(path)}' is readonly. - It seems its value is statically defined in nix."
raise ClanError(msg) raise ClanError(msg)

View File

@@ -209,7 +209,9 @@ def is_writeable_key(
key: str, key: str,
writeables: dict[str, set[str]], writeables: dict[str, set[str]],
) -> bool: ) -> bool:
"""Recursively check if a key is writeable. """@deprecated use 'static_data.is_writeable_path' instead.
Recursively check if a key is writeable.
key "machines.machine1.deploy.targetHost" is specified but writeability is only defined for "machines" key "machines.machine1.deploy.targetHost" is specified but writeability is only defined for "machines"
We pop the last key and check if the parent key is writeable/non-writeable. We pop the last key and check if the parent key is writeable/non-writeable.
""" """