-
Notifications
You must be signed in to change notification settings - Fork 203
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
icinga hostgroup object_name interpretet as integer causes postgres error #2821
Comments
Hi @cschra, using numbers as hostgroup names is a very, very bad choice. That's similar to configuring your servers with numeric host names and wondering, why your network packets go elsewhere. If I could have imagined people doing this, there would have been a check in place preventing this from the beginning. Right now I have no chance to roll this back, as there seem to be setups doing exactly this. Your fix isn't wrong, it can be applied, and it fixes this issue with PostgreSQL. Just: there might be other tricky/hidden bugs, that might bite you. The most problematic part are array keys, as PHP automatically converts string array keys to integers, when they look like such. Of course this is silly, and PHP core developers would implement it differently today. But as of this writing, it is as it is. Code parts where this could became a problem are lookup/cache tables, membership checks and similar. I'm not saying that there are such bugs, but there have been related ones, and there might be others. We'll fix this, but please do yourself a favour and use alphanumeric Hostnames. If your names are IDs from an external system: prefix them with some character. Best, |
Hi @Thomas-Gelf, thanks for your fast reply. As this still produces errors, shall I open a PR for the change, so that at least this error is fixed? |
Not trying to blame you, nobody defined that it should be forbidden. The same way, nobody hinders you from using numeric hostnames. It's just... not the best choice, and you must live with "funny" consequences like this one: A PR against the current master (or v1.11.0, as it doesn't differ) would be great! Your patch doesn't fit my current version of that file. Thanks, |
Expected Behavior
Hostgroups can have simple numbers as object_name and matching can also done with integers.
Current Behavior
Activitylog detail tab and some other pages are not displayed. Instead a stacktrace is shown.
Possible Solution
My temporary solution is to check for integer value and convert it to string -> this is a bit ugly but does the job.
director/library/Director/Objects/IcingaObjectGroups.php:186
Steps to Reproduce (for bugs)
icingacli director hostgroup create "5" --json "{"display_name":"Test"}"
pull an element in via director import run (in my case via sql query)
This element in my case has a type 5 which will be matched to the hostgroup
when trying to sync/roll out the following stacktrace is shown:
Your Environment
icinga2 --version
): r2.14.0-1maybe related to #2297
The text was updated successfully, but these errors were encountered: