-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
Empty string inserting into Postgres blackouts
table (should be NULL)
#1543
Comments
If you can't reproduce the issue then it's not likely I'll be able to do it from the information you provided. For a start you don't say how you generated the blackout period. Which would be a pretty useful thing to know. ie. CLI, API, web UI? You say you conducted tests, but don't say what those tests were or what you did. So I'm not sure what you expect me to do. |
I was creating the blackouts via the webui. I'm not really asking for anything - just mentioning that empty strings were being inserted into the database when they should have been NULLs. I can work on trying to reproduce the issue. Based on my snippet above I can create a PR, too, if that would help. |
Did you click into the resource and/or event field of the "create blackout" dialog box but not input anything? |
It looks like it's happening after I edit a blackout.
Side note:
|
Thanks for investigating further and providing additional info. This definitely sounds like a bug. |
Issue Summary
I've been testing blackouts and I found that sometimes the blackout condition wasn't being met so a notification was being generated when it shouldn't have.
Looking through the
is_blackout_period
method it looks like the SELECT statement is expecting certain columns to be NULL.I inspected the
blackouts
table in the database and found that the columns were empty strings vs NULL:e.g.
which explains why the SELECT statement isn't being matched.
Environment
OS: Centos 7.9
API version: 8.5.0
Deployment: self-hosted
For self-hosted, WSGI environment: nginx/uwsgi
Database: Postgres 10.4
Server config:
Auth enabled? Yes
Auth provider? LDAP
Customer views? Yes
web UI version: 8.5.0
CLI version: 8.5.0
To Reproduce
I was unable to reproduce this issue. I thought it had to do with me either copying or updating existing blackouts but further testing didn't result in the empty strings being inserted.
Expected behavior
Screenshots
Additional context
I think modifying the INSERT statement in the
create_blackout
method to evaluate an empty string as a NULL may be an appropriate "safety-check".e.g.
NOTE: Please provide as much information about your issue as possible.
Failure to provide basic details about your specific environment make
it impossible to know if an issue has already been fixed, can delay a
response and may result in your issue being closed without a resolution.
The text was updated successfully, but these errors were encountered: