Skip to content

Can't Fully Remove Reports #2892

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

Closed
MrDragon opened this issue Feb 14, 2019 · 5 comments
Closed

Can't Fully Remove Reports #2892

MrDragon opened this issue Feb 14, 2019 · 5 comments
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@MrDragon
Copy link

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?

@ojmorris12
Copy link

ojmorris12 commented Apr 19, 2019

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

@mrrua
Copy link

mrrua commented May 14, 2019

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

@DanSheps DanSheps added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application type: feature Introduction of new functionality to the application and removed type: bug A confirmed report of unexpected behavior in the application labels May 31, 2019
@tyler-8
Copy link
Contributor

tyler-8 commented 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.

@keliansb
Copy link

keliansb commented 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.

@steinbachio
Copy link

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

7 participants