glpi-project / glpi-agent

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

Can't deploy package with 500 Internal Server Error after FusionInventory to GlpiInventory plugin migration #578

Closed JonioDiPonio closed 5 months ago

JonioDiPonio commented 5 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

I am currently doing some test to upgrade our v9.5.11 glpi to v10.0.11 with glpiinventory instead of fusioninventory, the test upgrade when good but when installing glpiinventory instead of fusioninventory, I had to change the server mirror but it doesn't work, my glpi-agent (v1.7.1) can't access it.

[Wed Jan 10 10:11:35 2024][info] running task Deploy
[Wed Jan 10 10:11:35 2024][debug2] [http client] Not using compression
[Wed Jan 10 10:11:35 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory?action=getConfig&machineid=PCD-314-0000980-2024-01-09-11-13-01&task[Deploy]=3.0
[Wed Jan 10 10:11:35 2024][debug2] Looking for Win32_LogicalDisk class WMI objects
[Wed Jan 10 10:11:36 2024][debug] Free space on C:\Program Files\GLPI-Agent\var\https..__glpi.[domain].com_marketplace_glpiinventory\deploy: 395527
[Wed Jan 10 10:11:36 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getJobs&machineid=PCD-314-0000980-2024-01-09-11-13-01&version=3.0
[Wed Jan 10 10:11:36 2024][debug2] Deploy job 659e5d7755649 in the list
[Wed Jan 10 10:11:36 2024][debug2] Processing job 659e5d7755649 from the list
[Wed Jan 10 10:11:36 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&currentStep=checking&msg=starting&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job&uuid=659e5d7755649
[Wed Jan 10 10:11:36 2024][debug2] Checking job 659e5d7755649...
[Wed Jan 10 10:11:36 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&msg=all%20checks%20are%20ok&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job&uuid=659e5d7755649&status=ok&currentStep=checking
[Wed Jan 10 10:11:36 2024][debug2] usercheck before: no user interaction requested
[Wed Jan 10 10:11:36 2024][debug2] Downloading for job 659e5d7755649...
[Wed Jan 10 10:11:36 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&currentStep=downloading&msg=downloading%20files&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job&uuid=659e5d7755649
[Wed Jan 10 10:11:36 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&sha512=42c1185349fd5a7531727385be6700a77c0a1e831b146dfcefba437ac074be1bafa4318cfd89fb3165b02bc8672856bad7b0d3b6c524bb7927e6e39ae79728ef&currentStep=downloading&msg=fetching%20LOdeploy.bat&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=file&uuid=659e5d7755649
[Wed Jan 10 10:11:36 2024][debug] File part URL: https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file=/7/7b/7b22d13d80ebf7af54b18e977c906a8cc31043ed6f6c3bfd653dd02bf895fac88f7e174e40bf3a7db8550f443f1b9a16c8be5b0c2bbf01d0f5f896d8af44623f
[Wed Jan 10 10:11:36 2024][error] [http client] communication error: 500 Internal Server Error
[Wed Jan 10 10:11:36 2024][error] Source or mirror is not a valid URL:  https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file=

But in the mirror config the URL is good, I think since i changes from plugins/fusioninventory to marketplace/glpiinventory image

I also change the path file since it was configured with fusioninventory but no, still the same error. image

In the agent config i have set the ssl-fingerprint that i was given before with the no-ssl-check = 1. The certificate is a valid wildcard.

As a test i tried with a completely clean install of glpi and the deploy went good but it was HTTP, there was no https since it was a clean install.

To reproduce

  1. Switch from fusioninventory to glpiinventory (i don't think the upgrade version of glpi is the problem)
  2. Change the old fusion config with the new glpiinventory one (mirrors, files, directory)
  3. Try to deploy a package with the glpi-agent

Expected behavior

No error and my packages deployed :))

Operating system

Windows

GLPI Agent version

1.7

GLPI version

10.0.11

GLPIInventory plugin or FusionInventory for GLPI plugin version

No response

Additional context

I can't find issues about the source or mirror in here and the only one i found on the glpi-inventory-plugin page didn't helped me this one.

g-bougard commented 5 months ago

Hi @JonioDiPonio You're saying the mirror config the URL is good but I can see a /d at the end of the url. Is this the complete url or the beginning of /deploy ? In that last case, can you give more on that url ? To me, it seems something is failing on server-side when the agent tries to download the file part. I see in the log this url:

https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file=/7/7b/7b22d13d80ebf7af54b18e977c906a8cc31043ed6f6c3bfd653dd02bf895fac88f7e174e40bf3a7db8550f443f1b9a16c8be5b0c2bbf01d0f5f896d8af44623f

I don't see there the /d I can see in the mirror config url. And strangely, I see a & after action=getFilePart which is probably wrong. Is this an error due to a copy/paste of the log to the GH web form or is this really what you're seeing in the log ? Also, it seems your mirror domain is exactly the same than the glpi server. In that case, you really don't need to set a mirror url if you're just using the same place.

JonioDiPonio commented 5 months ago

Hello @g-bougard, The full URL configured is https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file= I have no idea why is there &#38 in the URL, I just checked with another computer with fusioninventory on the actual prod server and there is no &#38 and the same task works OK (the server uses a mirror)

[debug] File part URL: https://glpi.[domain].com/plugins/fusioninventory/b/deploy/?action=getFilePart&file=/7/7b/7b22d13d80ebf7af54b18e977c906a8cc31043ed6f6c3bfd653dd02bf895fac88f7e174e40bf3a7db8550f443f1b9a16c8be5b0c2bbf01d0f5f896d8af44623f

I just tried to delete the mirror and i don't get the 500 internal server error, neither this error

[debug] File part URL: https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file=/d/d7/d790e3c846178eb101d502fe8d2b73900a0f7b2709930d0a17e50d3227422050f34c57a8234c60c19f72b85d9db9afad0a8ac7ecf365313d2944c702e888a35a

But i still got the same one about the source or mirror (even if I deleted it)

[error] Source or mirror is not a valid URL:  https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file=

I can't find a documentation about glpiinventory mirrors nor a guide to upgrade from fusioninventory.

g-bougard commented 5 months ago

Hi @JonioDiPonio

just to be clear, are you really using/needing a mirror ? I mean if the same GLPI is handling Deploy tasks and serves file parts, just don't set it as the url is still known.

Also, have you set "Base URL for agent" in any entity "Assets" tab ? Here, the same, if the site target is indeed the same glpi target, just remove it to leave the default be used. As far I know, mirrors were only used in advanced configuration where GLPI is on a distant site and file part are synchronized on a local site to avoid using low speed or not efficient network links.

After checking that, can you share again an updated log ?

JonioDiPonio commented 5 months ago

Ok i understand the mirror now, i didn't built the actual glpi with fusioninventory so i thought it was necessary but no i guess.

I removed the mirror and the "Base URL for agent" and it worked, and i can deploy the packages that were imported from fusioninventory files to glpiinventory files.

[Thu Jan 11 10:11:23 2024][debug] new thread 66 to handle task Deploy
[Thu Jan 11 10:11:23 2024][info] running task Deploy
[Thu Jan 11 10:11:23 2024][debug2] [http client] Not using compression
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory?action=getConfig&task[Deploy]=3.0&machineid=PCD-314-0000980-2024-01-09-11-13-01
[Thu Jan 11 10:11:23 2024][debug2] Looking for Win32_LogicalDisk class WMI objects
[Thu Jan 11 10:11:23 2024][debug] Free space on C:\Program Files\GLPI-Agent\var\https..__glpi.[domain].com_marketplace_glpiinventory\deploy: 390975
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getJobs&machineid=PCD-314-0000980-2024-01-09-11-13-01&version=3.0
[Thu Jan 11 10:11:23 2024][debug2] Deploy job 659fb08449179 in the list
[Thu Jan 11 10:11:23 2024][debug2] Processing job 659fb08449179 from the list
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&msg=starting&currentStep=checking&uuid=659fb08449179&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job
[Thu Jan 11 10:11:23 2024][debug2] Checking job 659fb08449179...
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&msg=all%20checks%20are%20ok&currentStep=checking&uuid=659fb08449179&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job&status=ok
[Thu Jan 11 10:11:23 2024][debug2] usercheck before: no user interaction requested
[Thu Jan 11 10:11:23 2024][debug2] Downloading for job 659fb08449179...
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&msg=downloading%20files&currentStep=downloading&uuid=659fb08449179&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&msg=fetching%20LOdeploy.bat&sha512=567d6d14e4cfb008df76a3a5dff50aaef6d688edcfdac216edd88f388d40bcfb0dd44cd936757e219d898a75bdc0b77f1eb47b1bbacaf8079e1bd342d56e89e0&currentStep=downloading&uuid=659fb08449179&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=file
[Thu Jan 11 10:11:23 2024][debug] File part URL: https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=getFilePart&file=/d/d7/d790e3c846178eb101d502fe8d2b73900a0f7b2709930d0a17e50d3227422050f34c57a8234c60c19f72b85d9db9afad0a8ac7ecf365313d2944c702e888a35a
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&sha512=567d6d14e4cfb008df76a3a5dff50aaef6d688edcfdac216edd88f388d40bcfb0dd44cd936757e219d898a75bdc0b77f1eb47b1bbacaf8079e1bd342d56e89e0&part=file&status=ok&msg=LOdeploy.bat%20downloaded&currentStep=downloading&machineid=PCD-314-0000980-2024-01-09-11-13-01&uuid=659fb08449179
[Thu Jan 11 10:11:23 2024][debug2] https://glpi.[domain].com/marketplace/glpiinventory/b/deploy/?action=setStatus&msg=success&currentStep=downloading&uuid=659fb08449179&machineid=PCD-314-0000980-2024-01-09-11-13-01&part=job&status=ok
[Thu Jan 11 10:11:23 2024][debug2] usercheck after_download: no user interaction requested
[Thu Jan 11 10:11:23 2024][debug2] Preparation for job 659fb08449179...

Thanks, i didn't know that base URL for agent was a part of this issue.

Now i will check deeply if there is more things that i missed when switching from fusioninventory et glpiinventory. (if you have a doc about this somewhere i take it :))))

g-bougard commented 5 months ago

Great to hear this fixes your issue.

Maybe you will be interested by this FAQ article: https://faq.teclib.com/06_administration/inventory/glpiinventory_deploy/