From: Emmanuel Kasper Date: Fri, 28 Oct 2016 08:56:40 +0000 (+0200) Subject: Fix #1186: do not run non installed commands X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=51bd9376b24c17d7a6be2f8e4a377c174e38b45e;p=pve-manager-legacy.git Fix #1186: do not run non installed commands Conditionnally add commands which are not: * Debian packages whith priority Essential or Important, * a dependency of pve-manager --- diff --git a/PVE/Report.pm b/PVE/Report.pm index 89714b87..0d0eaa8a 100644 --- a/PVE/Report.pm +++ b/PVE/Report.pm @@ -5,6 +5,8 @@ use warnings; use PVE::pvecfg; use PVE::Tools; +$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin'; + my $report; my @general = ('hostname', 'pveversion --verbose', 'cat /etc/hosts', 'top -b -n 1 | head -n 15', @@ -12,9 +14,16 @@ my @general = ('hostname', 'pveversion --verbose', 'cat /etc/hosts', 'top -b -n my @storage = ('cat /etc/pve/storage.cfg', 'pvesm status', 'cat /etc/fstab', 'mount', 'df --human'); -my @volumes = ('lvs', 'vgs', 'zpool status', 'zfs list'); +my @volumes = ('lvs', 'vgs'); +# command -v is the posix equivalent of 'which' +if (system('command -v zfs > /dev/null 2>&1') == 0) { + push @volumes, 'zpool status', 'zfs list' +} -my @disks = ('lsblk', 'multipath -ll', 'multipath -v3'); +my @disks = ('lsblk'); +if (system('command -v multipath > /dev/null 2>&1') == 0) { + push @disks, 'multipath -ll', 'multipath -v3' +} my @machines = ('qm list', sub { dir2text('/etc/pve/qemu-server/', '\d.*conf') });