-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Restore ability for scripts to be able to log_success without generating a message #16307
Comments
Could you please assign it to me? |
@candlerb I'm a little unclear on the reproduction. Are you using a legacy report, or a custom script? Report methods use the signature log_success(obj=None, message=None) whereas Script methods use the signature log_success(message, obj=None) |
A new custom script, using the Script signature you gave. If I understand correctly, Scripts are now supposed to subsume the functionality originally in reports (and the fact you refer to reports as "legacy" seems to confirm this). However, I was unable to invoke Script.log_success() in a way which was able to increment the "success" counter without logging a message, as reports are/were able to do. As I wrote earlier, I tried:
but all of these log an empty message - so if you have 2,000 successes you get 2,000 log messages, making it very hard to wade through to the errors (and of course slowing things down). |
Ok, thanks. NetBox v4.0 retains backward compatibility for legacy Reports too so I just wasn't clear which form of the method we're looking at. |
NetBox version
v4.0.3
Feature type
Change to existing functionality
Proposed functionality
Make
log_success(None, None)
and/orlog_success("", None)
increment the success counter without generating a log messageUse case
Reports in Netbox <= v3.7 were able to do this:
This would increment the success counter for the report without generating any message: e.g.
However, in Netbox 4.0, when upgrading a Report to a Script, you need to change it to:
All of these log a message: a dash in the first case, or the string "None" in the second and third. (The third log line has no URL).
Either way, if you have thousands of successful checks, this generates thousands of log lines to wade through.
I note from the documentation of v3.7 that omitting the message for
log_success()
in Reports was explicitly permitted, and defaulted toNone
:Maybe also
log_success()
with no arguments should be allowed, since the object identity isn't actually being used if no message is being recorded. It would be equivalent tolog_success(None, None)
Possibly relates to #8984, although I think that this feature request is orthogonal.
Database changes
None
External dependencies
None
The text was updated successfully, but these errors were encountered: