-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
fix(AlertsReports): making log retention "None" option valid #27554
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,7 +320,7 @@ class ReportSchedulePutSchema(Schema): | |
log_retention = fields.Integer( | ||
metadata={"description": log_retention_description, "example": 90}, | ||
required=False, | ||
validate=[Range(min=1, error=_("Value must be greater than 0"))], | ||
validate=[Range(min=0, error=_("Value must be 0 or greater"))], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does a log retention of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current behavior is such that the "None" option is a display for the value 0, but 0 isn't accepted on the backend. The schema is expecting for log_retention to be an integer value indicating the # of days the logs will be retained. I've preserved the initial logic that the None value is stored as 0, but enabled 0 to be an acceptable value. The log_retention is then passed to the log_prune function which removes any logs with a date less than the current date - log retention (0) days. |
||
) | ||
grace_period = fields.Integer( | ||
metadata={"description": grace_period_description, "example": 60 * 60 * 4}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's double check if this can actually go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default log_retention value is specified as a number, and the dropdown options include only integers.
Additionally, there backend validation schema only allows integers. There shouldn't be a situation which calls for
typeof !== 'number'