-
Notifications
You must be signed in to change notification settings - Fork 64
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
fqdn fix #535
fqdn fix #535
Conversation
Hi @po1vo indeed, on my system (Fedora 38), Sys::Hostname::hostname() still returns a FQDN. So before to consider your PR, I first need a context explaining why in your case you get a short name. |
One problem I see with your PR is it may imply many changes in the inventory process as you're change can modify the way GLPI::Agent::Tools::Hostname::getHostname() api returns a value. This api is called from many point, for example it is used to compute the agent deviceid. But it is also used to set HARDWARE->NAME in inventory. What funny fact, I can see the api you're proposing is still used to set OPERATING_SYSTEM->FQDN from this module: GLPI::Agent::Task::Inventory::Generic::OS. So can you explain first what is your concern to ask for this change ? |
The problem with |
deviceid must be based on fqdn, in my opinion, so there's no confusion between agents on host1.com and host1.org (for example). |
This is more complicated than that:
The hostname command execution may be part of the process, but this is not the first try. I agree hostname execution can be system-dependent. But if the problem is system-dependent, we probably need a system-dependent solution, not a solution forcing every one to switch to another solution that may have a very large and unwanted side-effect. Most people may don't care, but I don't want to see people starts to complain as we made this big change. This is why I'm asking you to share about the context. In your last comment, you're sharing about your opinion related to the deviceid itself. Does your concern only related to the deviceid so ? |
I've been digging into
So, i decided to compare /proc/sys on two hosts with different
|
Right. We have hosts with the same hostname but different domain name. |
So can we make a try ? I introduced a new option in GLPI-Agent v1.5. Here is what you can see in the Changes file:
By default, it was kept to I need to fix this documentation to talk about this option: https://glpi-agent.readthedocs.io/en/latest/configuration.html |
Anyway, this may be wrong for you if your concern is the agent deviceid, not the asset name. So does the asset name also a concern ? |
I've seen it, all it does is chooses to strip or not to strip the domain part from fqdn. But it still relies on
It is a concern. |
So, what is really your concern, the agent deviceid or the asset name or both ? |
Both.
Exactly.
Yes, asset name. It's seems overcomplicated for such a "simple" task as getting fqdn, but it's up to you. We've been using the proposed patch for over a year with no problems. |
Btw, |
Nothing is perfect. This just means you can set a different domain than the real hostname one... what a possible mess ! :-) This will remain a computer administration problem, not a glpi-agent one. So I'll try to add another |
As I merged #538, you'll be able to use Thank you for the suggestion. |
Sys::Hostname::hostname returns a short name, thus the fix.