From 6a6e9c1c2ce1775a496d2f131857d8cd7f24d60f Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Fri, 20 Dec 2024 18:09:34 +0100 Subject: [PATCH] API: Display only local block devices, remote ones should be retrieved from hw-report --- pkgs/clan-cli/clan_cli/api/directory.py | 28 ++++--------------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/api/directory.py b/pkgs/clan-cli/clan_cli/api/directory.py index 6adab0d4b..6749cbb0b 100644 --- a/pkgs/clan-cli/clan_cli/api/directory.py +++ b/pkgs/clan-cli/clan_cli/api/directory.py @@ -118,37 +118,17 @@ def blk_from_dict(data: dict) -> BlkInfo: ) -@dataclass -class BlockDeviceOptions: - hostname: str | None = None - keyfile: str | None = None - - @API.register -def show_block_devices(options: BlockDeviceOptions) -> Blockdevices: +def show_block_devices() -> Blockdevices: """ - Abstract api method to show block devices. + Api method to show local block devices. + It must return a list of block devices. """ - keyfile = options.keyfile - remote = ( - [ - "ssh", - *(["-i", f"{keyfile}"] if keyfile else []), - # Disable strict host key checking - "-o StrictHostKeyChecking=accept-new", - # Disable known hosts file - "-o UserKnownHostsFile=/dev/null", - f"{options.hostname}", - ] - if options.hostname - else [] - ) cmd = nix_shell( - ["nixpkgs#util-linux", *(["nixpkgs#openssh"] if options.hostname else [])], + ["nixpkgs#util-linux"], [ - *remote, "lsblk", "--json", "--output",