Ok, this is to finish off all the auto-discover devices that might just use IP.
When addHost is called, if it's an IP that's passed then it's checked against the ip_exists() function, if that returns true then either something has gone wrong or the IP does exist in the DB and the addHost function will not continue.
This means adding a device by hostname will continue to work as normal just in case people have an odd requirement to point multiple names at the same device.
Added function to check if ip already exists and updated addHost to u…
Added fallback to false if it is not an IP
I have two questions:
None of the other code within that does at the moment so that's just following on from what we do now - however: #1250
That's just a matter of personal choice, if we're setting a standard in place for it then let me know and I'll update the code.
Probably a good idea to have a think about #1250 separately - if we went overboard, people would probably complain about the spam. :-)
I don't think we could really make a standard other than making things as simple as they can be - in this case I think it detracts a little from the clarity of the code, but not really a big deal either way.
Changed to return during function processing
You asked the question about logging that info, I've just followed the rest of addHost and printed to the browser. Feel free to comment on the issue to use eventlog in addHost on how you want it to work so someone can put it togther.
I've updated the code to just return mid flow now.