cmds.secrets.lib.DistroContext: Batch file listing code
The compile phase of a secrets deploy makes one SSH round-trip per package to list the package files. On a host with nine packages, that is nine round-trips. Make match_files() pass the whole name list to pkg_paths() in one call: the distro backends already accept a list and issue a single file-listing command. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.2 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8b31d7a091
commit
65e55a1119
1 changed files with 5 additions and 4 deletions
|
|
@ -33,11 +33,12 @@ class DistroContext(FilesContext):
|
|||
self.__distro = distro
|
||||
|
||||
async def match_files(self, pkg_names: Collection[str], pattern: str) -> list[str]:
|
||||
# -- One query for the whole name list: the distro backends
|
||||
# accept a list and issue a single file-listing command
|
||||
ret: list[str] = []
|
||||
for pkg_name in pkg_names:
|
||||
for path in await self.__distro.pkg_paths(pkg_name):
|
||||
if re.match(pattern, path):
|
||||
ret.append(path)
|
||||
for path in await self.__distro.pkg_paths(list(pkg_names)):
|
||||
if re.match(pattern, path):
|
||||
ret.append(path)
|
||||
return ret
|
||||
|
||||
async def list_template_files(self, pkg_names: Collection[str]) -> list[str]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue