Diskmanage: replace check for zpool binary with a function and mock it

so the test still works when it's not installed.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner
2021-02-10 11:18:42 +01:00
committed by Thomas Lamprecht
parent 26de022b56
commit 525b4a6ebe
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,12 @@ my $PVS = "/sbin/pvs";
my $LVS = "/sbin/lvs";
my $LSBLK = "/bin/lsblk";
sub check_bin {
my ($path) = @_;
return -x $path;
}
sub verify_blockdev_path {
my ($rel_path) = @_;
@ -201,7 +207,7 @@ sub get_zfs_devices {
my ($lsblk_info) = @_;
my $res = {};
return {} if ! -x $ZPOOL;
return {} if !check_bin($ZPOOL);
# use zpool and parttype uuid,
# because log and cache do not have