Reports from the future

reports
puppet

#1

Problem:
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?


#2

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:

Report.where(host_id: [$ids]).destroy_all

#3

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)


#4

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!