Netbox: Can't Fully Remove Reports

Created on 14 Feb 2019  路  5Comments  路  Source: netbox-community/netbox

Environment

  • Python version: 3.6.7
  • NetBox version: 2.5.5

Postgres: version 10.6
OS: Ubuntu 18.04.1 LTS

Steps to Reproduce

  1. Create/add/run a report
  2. delete a report class from a report .py file
    2.1 alternatively, remove the whole reports/ .py file
  3. restart netbox (just in case)
  4. "Organization" -> "Reports" does not show the missing report (yay!)
    4.1 Homepage, "Reports" box still lists the missing report. Following the link gives a "page not found"
  5. Interestingly enough, if you remove the whole .py report file, restart netbox, stop netbox, add the .py reports back, start netbox, you still have the history of when the reports were last run, it's as if you never removed the reports

Expected Behavior

When I remove a "class" entry or the entire reports file, I would expect the corresponding link off the home page in the "reports" box to disappear, similar to "organization" -> "reports"

Observed Behavior

The link is still there. Following it gives a "page not found"

Suggestions from the peanut gallery / back-seat driver (me):

I can see not automatically deleting the report history/results just because the py file or the class is missing - that could protect me from myself on upgrades / editing reports.
Maybe a button under "Organization" -> "Reports" that does a "report cleanup" and removes reports from the database that don't exist anymore?

accepted feature

Most helpful comment

As a workaround fix you can delete the old/invalid report results in the extras_reportresult database table. I'd only recommend this if you're comfortable with direct database interaction, but that table isn't depended upon by anything else (currently) so deleting them from that table is safe and will clear the front page results up.

All 5 comments

Also hitting this issue. Would like to be able to clean up the reports from the "Reports" box on the homepage.

Tertiary confirmation. Ran into this recently, and with report renames the issue is ever present on the Netbox landing page.

As a workaround fix you can delete the old/invalid report results in the extras_reportresult database table. I'd only recommend this if you're comfortable with direct database interaction, but that table isn't depended upon by anything else (currently) so deleting them from that table is safe and will clear the front page results up.

Hitting same issue as well. Restart of Netbox doesn't work either.
Your workaround works @tyler-8, thank you! (I had to restart Netbox twice for changes to take effect, don't know why)
Here are the commands I executed :

netbox=> SELECT * FROM extras_reportresult;
 id |            report            |            created            | failed |                                         data                                         | user_id
----+------------------------------+-------------------------------+--------+--------------------------------------------------------------------------------------+---------
  1 | duplicate_ips.UniqueIPReport | 2019-08-20 08:51:50.772057+02 | f      | {"test_unique_ip": {"log": [], "info": 0, "failure": 0, "success": 0, "warning": 0}} |
(1 row)
netbox=> DELETE FROM extras_reportresult WHERE extras_reportresult.id = 1;
DELETE 1
netbox=> SELECT * FROM extras_reportresult;
 id | report | created | failed | data | user_id
----+--------+---------+--------+------+---------
(0 rows)

As stated, it is only a workaround. A fix would be appreciated!

Edit: it seems that restarting Netbox doesn't change anything. I guess the table in database is checked periodically for updating the UI, so wait for a while and you shouldn't see reports on the homepage anymore.

You don't see the Changes in the UI, because they are cached in redis.
bash-5.0# python manage.py invalidate all
fixed it for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markve-sa picture markve-sa  路  4Comments

Ali-Yazdani picture Ali-Yazdani  路  3Comments

candlerb picture candlerb  路  3Comments

VictorJ76 picture VictorJ76  路  3Comments

aarjbdea picture aarjbdea  路  3Comments