-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not list agentless agents and restrict agents by Task entity on Actor Taskdropdown #603
base: main
Are you sure you want to change the base?
Conversation
After a successful ESX inventory task, an agent is created on GLPI. Into glpi-project/glpi-agent#832 I discussed with @g-bougard about this behavior (the reasons and possible workarounds that could be implemented on the GLPI-Agent is discussed there). He said that it's an inherited behavior from FusionInventory Agent and I should open an issue on GLPI-Inventory plugin. From GLPI server point-of-view, doesn't seems to be a way for it to determine that it's an agentless inventory instead of a inventory of a real machine and for this reason it seems to create an agent. I don't see any problem with it at all, but when creating tasks, those agentless agents are shown into the dropdown of task actors, but they doesn't have any capability to run those tasks. Into the ``glpi.agents`` DB, the only way I could find to differentiate those agentless agents are using the ``version`` and ``use_module_*`` columns. Since the ``version`` column of these agents are NULL, we can use it to hide those agentless agents as task actors. Other possible solutions for this is using the ``use_module_*`` column, which would allows us to be much more specific about the filter and features that an agent is capable of. We could improve the method ``isAgentCanDo`` to also fetch the value of those columns and only return ``true`` if the module is enabled (current behavior) and also if it's installed on the agent. The ``getAgentsCanDo`` also returns information about the agents and maybe could be used to replace this SQL query, and the ``use_module_*`` values are also available into the returned array object that could be checked.
@g-bougard can you confirm that the agent created in GLPI for assets that have had an inventory via a remote agent, comes back with a I don't know if it's a good idea to use this where clause (could return false positives). Perhaps there should be a dedicated flag in the agents? |
Actually, I would say this is only true for ESX inventory. And I can say this is not true for inventory generated via RemoteInventory task. And indeed, this is probably and error to not include that VERSION data in ESX inventory. So IMHO, I think it's a bad idea to rely on a missing "version" field to filter out that dropdown as this is not on purpose semantically. Checking a task module is enabled for the currently edited task is probably a better way of doing. I just hope this couldn't involve unexpected side-effects. |
Thanks for your reply @g-bougard In the meantime, we're going to think about getting more relevant information from GLPI (so that we can filter the list of agents from the plugin). As things stand (and for the proposed solution), relying solely on the ‘null’ version value doesn't seem to be a wise choice. using the use_module_* column seems more coherent. Best regards |
Only show an Actor if it's supports the selected task.
Hello @stonebuzz and @g-bougard, |
Now if the agent doesn't belong to the task entity it's not shown on dropdown. To keep the current behavior (show all agents independent of the entity it belongs) users must create tasks on the Root entity.
Hello guys, |
After a successful ESX inventory task, an agent is created on GLPI. Into glpi-project/glpi-agent#832 I discussed with @g-bougard about this behavior (the reasons and possible workarounds that could be implemented on the GLPI-Agent is discussed there). He said that it's an inherited behavior from FusionInventory Agent and I should open an issue on GLPI-Inventory plugin. From GLPI server point-of-view, doesn't seems to be a way for it to determine that it's an agentless inventory instead of a inventory of a real machine and for this reason it seems to create an agent. I don't see any problem with it at all, but when creating tasks, those agentless agents are shown into the dropdown of task actors, but they doesn't have any capability to run those tasks. Into the
glpi_agents
DB, the only way I could find to differentiate those agentless agents are using theversion
anduse_module_*
columns. Since theversion
column of these agents are NULL, we can use it to hide those agentless agents as task actors. Other possible solutions for this is using theuse_module_*
column, which would allows us to be much more specific about the filter and features that an agent is capable of. We could improve the methodisAgentCanDo
to also fetch the value of those columns and only returntrue
if the module is enabled (current behavior) and also if it's installed on the agent. ThegetAgentsCanDo
also returns information about the agents and maybe could be used to replace this SQL query, and theuse_module_*
values are also available into the returned array object that could be checked.With this fix applied, only two agents are returned:
Even when there's three agents available (ESXi is an agentless agent):
Maybe we could hide non-version Agents from Administration > Inventory > Agents too.
Checklist before requesting a review
Please delete options that are not relevant.
Description
Screenshots (if appropriate):