From 8f0f75f1a8a6764d52be25d2d2e89866b25502b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 3 Sep 2024 16:52:04 +0200 Subject: [PATCH] zpool: better error message if zpool has no assigned devices --- lib/types/zpool.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/types/zpool.nix b/lib/types/zpool.nix index 0510b94..df391f2 100644 --- a/lib/types/zpool.nix +++ b/lib/types/zpool.nix @@ -148,6 +148,10 @@ in in '' readarray -t zfs_devices < <(cat "$disko_devices_dir"/zfs_${config.name}) + if [ ''${#zfs_devices[@]} -eq 0 ]; then + echo "no devices found for zpool ${config.name}. Did you misspell the pool name?" >&2 + exit 1 + fi # Try importing the pool without mounting anything if it exists. # This allows us to set mounpoints. if zpool import -N -f '${config.name}' || zpool list '${config.name}'; then