-
Notifications
You must be signed in to change notification settings - Fork 15
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
Handle software updates discovery errors #2532
Conversation
…ftware_updates_discovery_health goes unknown
f930a0d
to
0307ce6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nelsonkopliku ,
I find the change overly complex.
Why not simply dispatch the command and returning the error?
In fact, the dispatch error case looks a bit over defensive. Our system won't send this command to any host that is not already registered.
I mean, if in the unknown
state, if we receive host_not_registered
(I don't know when), who cares, we still need to return the original error. At the end, we just want to know if there was an error or not. We don't use the specifics anywhere. I mean, what use has this dispatching error
(that why the way, you don't send with the same format for the correct flow of it fails)?
Logger.error( | ||
"An error occurred during software updates discovery for host #{host_id}: #{inspect(error)}" | ||
) | ||
|
||
{:error, error} | ||
dispatch_completion_command_on_discovery_error(host_id, discovery_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand a thing 😅
Wasn't as simple as putting the the dispatch with the unknown
state in the else
side?
commanded().dispatch(
CompleteSoftwareUpdatesDiscovery.new!(%{
host_id: host_id,
health: SoftwareUpdatesHealth.unknown()
})
)
error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's where I started from, honestly.
I wanted to avoid dispatching a CompleteSoftwareUpdatesDiscovery
command with unknown
when the failure was not a discovery failure, but an error in dispatching CompleteSoftwareUpdatesDiscovery
after a successful discovery, as mentioned in the description.
I'd be fine also with that dispatch in the else side 🙈
@arbulu89 thanks for the review, I applied the simplified version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
PD: This will conflict with my other PR:#2531
But we can fix the conflicts afterwards
Description
This PR handles software updates discovery errors by dispatching an
unknown
health.Cleaned a bit up error propagation.
How was this tested?
Automated tests.