[Q&A] Additional content replacing parts of the original content #809
-
Documentation & bug reporting acknowledgmentYes, I read it Describe your problemHello, I want to replace a part of the inventory when we run |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello @dbeniamine you have to use additional-content option. It permits to load a XML or a json file depending on the inventory format. GLPI 10 expects json format and I'll focus on this case. In json format, you will be able to merge datas where in XML you had to replace all the datas. If a data is still set in the before-merge generated inventory, the data from the json should simply override the discovered data. Let's play with an example. If I generate a partial inventory for my own computer, the bios section looks like:
Now I can use the following content as json
To change the bios date:
If you want to change all the section, you have to set a new value for all known values. To erase a value, set it to an empty string if this is a string. Have you another case where this principle is not working as you wish ? |
Beta Was this translation helpful? Give feedback.
-
Hello @g-bougard , Thanks for your quick answer, I am trying to replace the By default I have something like "remote_mgmt" : [
{
"id": "someid",
"type": "rustdesk"
}
] If I add an "remote_mgmt" : [
{
"id": "someid/?password=somerandompassword",
"type": "rustdesk"
}
] I end up with : "remote_mgmt" : [
{
"id": "someid",
"type": "rustdesk"
},
{
"id": "someid/?password=somerandompassword",
"type": "rustdesk"
}
] While I would like to obtain : "remote_mgmt" : [
{
"id": "someid/?password=somerandompassword",
"type": "rustdesk"
}
] |
Beta Was this translation helpful? Give feedback.
Another approach could be simply to disable the rustdesk discovery in the glpi-agent settings thus the only
remote_mgmt
entry would be the one in theadditional-content
file .Actually
glpi-agent --json --no-category=remote_mgmt --addition-content=myfile.json
seems to be doing the job, so in the end, addingno-category=remote_mgmt
to my/etc/glpi-agent/conf.d/00-install.cf
does exactly what I want