-
Notifications
You must be signed in to change notification settings - Fork 121
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
should actions leak deprecation warnings? #1460
Comments
Yeah, I agree these shouldn't end up in the actions output. Hopefully there's a straight-forward way to make these warnings only go to the debug log. We'll aim to look into this at some point soon. |
Odd, these shouldn't end up being output, because the default filter ignores I tested this with this little charm: import ops
import ops.main
class ActionwarningCharm(ops.CharmBase):
def __init__(self, framework: ops.Framework):
super().__init__(framework)
framework.observe(self.on.go_action, self._on_go)
def _on_go(self, event):
event.log("Running...")
event.set_results({"result": "done"})
if __name__ == "__main__":
ops.main.main(ActionwarningCharm) And when running the action, I don't get the warning. It is being produced: if I put @PietroPasotti would any of the code be setting It seems like the correct fix is to to set the filters appropriately, but that's not going to help if something is changing them. If that isn't going to work, then we might have to use a custom |
huh no the charm is vanilla, no strange envvars set |
I don't get this with machine (Juju 3.6) or K8s (Juju 3.5.2). I also tried with the grafana[-k8s] charm (from Charmhub) and also don't get it:
Although maybe that's not built with a recent enough ops or has some other workaround... |
Ah, but latest/edge does:
|
I can reproduce with my simple charm above when doing The issue is the stack level. When using
When using `from ops import main ... main(MyCharm) the stack is:
We use a We could definitely adjust the warning filters to handle this - matching the message, for example. However, we do want the warning to be generated when people are running tests. We could blame code lower down the stack, but that's less clear to developers who need to update their code. I feel like relying on the warnings-go-to-stdout behaviour combined with the way that action output is sent is probably the real problem here, and we should switch over to the alternative (that we'd already developed anyway). |
In my view,
juju actions
are the public facade of the charm. The user-facing API.A user doesn't necessarily want to see things such as internal deprecation warnings or other logs as part of the action output, or they might think something went wrong when running the action.
I'm not sure if this is a juju or an ops concern, but this user experience should be improved:
What do you think is the way forward on this? Silence all stdout when running an action? This warning will show up in the juju debug-log anyway, which is the only place I'd expect to see it.
The text was updated successfully, but these errors were encountered: