glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
240 stars 60 forks source link

--additional-content option for software is replacing actual content instead of merging it #589

Closed acdmail closed 8 months ago

acdmail commented 8 months ago

Bug reporting acknowledgment

Yes, I read it

Professional support

None

Describe the bug

hi, I am facing the issue with --additional-content option of GLPI agent instead of merging the software provided with --additional-content option the agent is replacing it. So I have glpi agent 1.7.1 if I am running it just to perform the inventory I am getting following results in GLPI: image

If I am running the agent adding --additional-content file as below I am getting the following: ./glpi-agent --additional-content=invscripts.json

image

the content of invscripts.json is as below: { "content": { "softwares": [ { "arch": "x86_64", "comments": "test", "filesize": "20093", "from": "source", "install_date": "2024-01-24", "name": "test-soft", "publisher": "test", "system_category": "OtherSoftware", "version": "1.7.1" } ] }}

So it seems that instead of merging --additional-content file content with other software inventory, it is only sending --additional-content file content

I am running GLPI 10.0.11 and glpi-inventory-plugin 1.3.4 together with GLPI agent 1.7.1

To reproduce

  1. Run the glpi-agent to perform he inventory and see the results in GLPI, all the software installed on server should be available in GLPI
  2. Rerun the glpi-agent with --additional-content option and the file containing some entries for softwares
  3. Check the results in GLPI

Expected behavior

I expect to see all the software in the GLPI inventory, the one which is installed + the one added through --additional-content so basically merged inventory

Operating system

Linux

GLPI Agent version

1.7

GLPI version

10.0.11

GLPIInventory plugin or FusionInventory for GLPI plugin version

GLPI Inventory v1.3.4

Additional context

This was working perfectly well with GLPI agent 1.5, GLPI 10.0.6 and FusionInventory plugin, but in XML format

g-bougard commented 8 months ago

Hi @acdmail

thank you for this report !

And yes, I missed to implement the same way as used before in XML format to merge lists. This is fixed now and next nightly build will support this case.