Can't Fully Remove Reports #2378

Closed
opened 2025-12-29 17:25:30 +01:00 by adam · 5 comments
Owner

Originally created by @MrDragon on GitHub (Feb 14, 2019).

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"

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?

Originally created by @MrDragon on GitHub (Feb 14, 2019). ### 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 <!-- What did you expect to happen? --> ### 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" <!-- What happened instead? --> ### 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?
adam added the status: acceptedtype: feature labels 2025-12-29 17:25:30 +01:00
adam closed this issue 2025-12-29 17:25:30 +01:00
Author
Owner

@ojmorris12 commented on GitHub (Apr 19, 2019):

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

@ojmorris12 commented on GitHub (Apr 19, 2019): Also hitting this issue. Would like to be able to clean up the reports from the "Reports" box on the homepage.
Author
Owner

@mrrua commented on GitHub (May 14, 2019):

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

@mrrua commented on GitHub (May 14, 2019): Tertiary confirmation. Ran into this recently, and with report renames the issue is ever present on the Netbox landing page.
Author
Owner

@tyler-8 commented on GitHub (Jun 14, 2019):

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.

@tyler-8 commented on GitHub (Jun 14, 2019): 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.
Author
Owner

@keliansb commented on GitHub (Aug 20, 2019):

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.

@keliansb commented on GitHub (Aug 20, 2019): 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.
Author
Owner

@steinbachio commented on GitHub (Sep 5, 2019):

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.

@steinbachio commented on GitHub (Sep 5, 2019): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2378