Yesterday a colleague found 4 servers which had a date one year in the future. The date was set back, but now I recognized we have reports of the systems in Foreman also one year in the future which are disturbing in the reports overview. Now I want to delete them, but is there a better way than doing it directly in the database?
I don’t think there is currently a way of doing it, but you might want to look at the
Report.expire method that could be slightly tweaked to expire future instead of past reports (specifically, by flipping the
created_at < condition to
created_at > and passing a negative timerange).
Since it’s just 4 hosts, it may be simpler to directly delete their reports from the foreman console like so:
if you updating your db, you can just change the reported_at column for
those reports (which their ID you can find via the search by date in the ui)
The content of the reports did not change and a new report will be created in half an hour so I did not care for keeping them. Thats why I simply used tbrisker’s solution. Thank you!