]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
Fix #1186: do not run non installed commands
authorEmmanuel Kasper <e.kasper@proxmox.com>
Fri, 28 Oct 2016 08:56:40 +0000 (10:56 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Oct 2016 09:54:01 +0000 (11:54 +0200)
Conditionnally add commands which are not:
*  Debian packages whith priority Essential or Important,
* a dependency of pve-manager

PVE/Report.pm

index 89714b875449f4ee5797911423b9425f8888c05e..0d0eaa8aa98f5301a23e25161adf3113ea5a3126 100644 (file)
@@ -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') });