From 9a03644a803c36d4a0cef5655548b139bd08f7c9 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Sun, 21 Sep 2025 16:37:50 +0200 Subject: [PATCH] clan_lib: deprecate is_writeable_key --- pkgs/clan-cli/clan_lib/persist/inventory_store.py | 4 ---- pkgs/clan-cli/clan_lib/persist/static_data.py | 4 ++-- pkgs/clan-cli/clan_lib/persist/util.py | 4 +++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/persist/inventory_store.py b/pkgs/clan-cli/clan_lib/persist/inventory_store.py index 94e5339f2..29edf39a8 100644 --- a/pkgs/clan-cli/clan_lib/persist/inventory_store.py +++ b/pkgs/clan-cli/clan_lib/persist/inventory_store.py @@ -24,10 +24,6 @@ from clan_lib.persist.static_data import ( from .util import ( path_match, - # calc_patches, - # delete_by_path, - # determine_writeability, - # set_value_by_path, ) diff --git a/pkgs/clan-cli/clan_lib/persist/static_data.py b/pkgs/clan-cli/clan_lib/persist/static_data.py index 9a02d6aca..c345b5272 100644 --- a/pkgs/clan-cli/clan_lib/persist/static_data.py +++ b/pkgs/clan-cli/clan_lib/persist/static_data.py @@ -362,7 +362,7 @@ def find_duplicates(string_list: list[str]) -> list[str]: return [item for item, freq in count.items() if freq > 1] -def is_writeable_key( +def is_writeable_path( key: PathTuple, writeables: WriteabilityResult, ) -> bool: @@ -386,7 +386,7 @@ def is_writeable_key( def validate_writeability(path: PathTuple, writeables: WriteabilityResult) -> None: """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." raise ClanError(msg) diff --git a/pkgs/clan-cli/clan_lib/persist/util.py b/pkgs/clan-cli/clan_lib/persist/util.py index 0c8cc93e0..6a3e263f2 100644 --- a/pkgs/clan-cli/clan_lib/persist/util.py +++ b/pkgs/clan-cli/clan_lib/persist/util.py @@ -209,7 +209,9 @@ def is_writeable_key( key: str, writeables: dict[str, set[str]], ) -> 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" We pop the last key and check if the parent key is writeable/non-writeable. """