-
Notifications
You must be signed in to change notification settings - Fork 122
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
Clarity around add_status
, collect_app_status
and collect_unit_status
regarding ErrorStatus
and UnknownStatus
#1356
Comments
I think so. My guess is that this was simply missed when collect-status was added, so it simply included all statuses and how they would be ranked, without considering that it's not actually possible to set
If manual intervention is required, then Issues that may solve themselves (like a service outside of Juju being down) are less clear at the moment. Charmers don't like using |
Makes sense. I'll aim to open a PR for this at some point.
I'm wondering why There's a certain irony in the fact that you can't set your own status to error, so if you try to do so peacefully, you'll raise and exception and end up in an error state the old fashioned way. That is, setting your own state to error is forbidden, but if you try to do so, you will end up in that state.
I guess just waiting/sleeping wouldn't be advisable here, but it makes me wonder if |
Yes. I don't think it's the most intuitive name, but that's the intention - there was a discussion at the Madrid sprint about this, because there was some confusion previously, but we should be consistent now.
Yes :).
That's the intention of the Juju-native/first-class defer. However, it's not yet clear whether there really is a use-case for that or not. |
While improving the type checking and documentation of the status types that can be set by charms (#1354), we noticed an incongruity in how
error
andunknown
status are treated. While they will both raise errors if used to set the unit or app status (andErrorStatus
andUnknownStatus
document this), the documentation aroundadd_status
doesn't clearly reflect this.@tonyandrewmeyer in #1354 (review)
We could just add a bit more documentation here, but it seems peculiar that calling
add_status(ErrorStatus('message')
doesn't raise an immediate error -- instead it's guaranteed to raise an error at status collection time, as the status is internally set to the highest priority status (anderror
is the highest priority). Of course the semantics are different, and perhaps you could use this as a sort of deferring of the exception till after other handlers have had a chance to do something, but it feels off.It seems a bit more legitimate to call
add_status(UnknownStatus('message'))
, since another event callback could add a higher priority status (unknown
is the lowest priority), and no error would be raised, but still seems like a strange pattern.Looking at the 150+ charms, I can find
add_status
being called a reasonable amount with the settable status types (ActiveStatus
,BlockedStatus
,MaintenanceStatus
,WaitingStatus
), but never withErrorStatus
orUnknownStatus
.Perhaps this is a good opportunity to make it an error to call
add_status
withErrorStatus
orUnknownStatus
?Having said that, the inability to set
ErrorStatus
makes me wonder what the current best practice is for a charm to give up and require manual intervention, and if documentation could be improved there?The text was updated successfully, but these errors were encountered: