glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
212 stars 51 forks source link

Not an ARRAY reference at /usr/share/glpi-agent/lib/GLPI/Agent/SOAP/VMware/Host.pm line 387. #691

Closed wucherpfennig closed 1 week ago

wucherpfennig commented 2 weeks ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

The agent crashes if trying to scan an ESXI

To reproduce

  1. configure network scan
  2. run it
  3. works fine if ran manually
  4. crashes if ran next day

Expected behavior

should always work

Operating system

Linux

GLPI Agent version

1.9

GLPI version

10.0.15

GLPIInventory plugin or other plugin version

No response

Additional context

any suggestions would be helpfull. the scan runs well initially but crashes on the next day / run

maybe connected to #506

Jun 12 10:55:54 XXX glpi-agent[16007]: [info] Starting ESX02 network scan task job...
Jun 12 10:55:54 XXX glpi-agent[16007]: [info] Running ESX02 task...
Jun 12 10:55:55 XXX glpi-agent[16007]: Execution failure:.
Jun 12 10:55:55 XXX glpi-agent[16007]: Not an ARRAY reference at /usr/share/glpi-agent/lib/GLPI/Agent/SOAP/VMware/Host.pm line 387.
GLPI Agent (1.9-1)
Built by Debian
Source time: 2024-05-28 08:52
g-bougard commented 2 weeks ago

Hi @wucherpfennig

this is definitively not related to #506. But it seems to be an old bug. Can you try to apply the following patch and tell me if this fixes your issue ?

diff --git a/lib/GLPI/Agent/SOAP/VMware/Host.pm b/lib/GLPI/Agent/SOAP/VMware/Host.pm
index 2938ee183..5c97303c8 100644
--- a/lib/GLPI/Agent/SOAP/VMware/Host.pm
+++ b/lib/GLPI/Agent/SOAP/VMware/Host.pm
@@ -385,9 +385,9 @@ sub getVirtualMachines {
         $comment =~ s/\n/
/gm if $comment;

         if (
-            defined($_->[0]{summary}{config}{template})
+            defined($machine->{summary}{config}{template})
             &&
-            $_->[0]{summary}{config}{template} eq 'true'
+            $machine->{summary}{config}{template} eq 'true'
             ) {
             next;
         }
g-bougard commented 1 week ago

Hi @wucherpfennig

can you test next nightly build ?

wucherpfennig commented 5 days ago

Sorry for the late response. We were relocating...

I have installed glpi-agent-1.10-git61ac477a-linux-installer.pl and will updates asap.