-
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
Software updates event handler #2515
Conversation
17a46e6
to
11b386d
Compare
11b386d
to
ee4c44b
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.
Good job!
I dropped some cosmetic related comments mostly.
PD: I commented on the option of handling some errors in the discovery. It is true that it would just be boilerplate code.
I was just wondering how we will notify the user when a discovery fails, because until now, we just print some messages in the logs.
I guess this discussion goes beyond of this PR. Would it make sense to have a discussion about it?
) do | ||
Discovery.discover_host_software_updates(host_id, fully_qualified_domain_name) | ||
|
||
:ok |
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 find this always :ok
return not really safe or robust.
I would personally check what the discovery returns, and based on that return some error.
We can implement the error
function later on, even if it does a simple :skip
.
This would give the look that we are dealing with the error (even though initially is doing nothing).
Maybe in the future, we could have some retry strategy, or broadcast some message to the frontend, or anything like that.
I find it a elegant solution at least.
PD: The error function
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.
Anyway, as we are not going to do anything with the failure by now, I'm okey to leaving as it is.
Maybe just putting a comment like The error is not being handled, as there is not any strategy for it
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 agree, some more robust error handling might be beneficial.
I just wanted to get the flow and iterate on errors as per the needs
lib/trento/infrastructure/commanded/event_handlers/software_updates_discovery_event_handler.ex
Outdated
Show resolved
Hide resolved
...to/infrastructure/commanded/event_handlers/software_updates_discovery_event_handler_test.exs
Outdated
Show resolved
Hide resolved
93bd658
to
d239d48
Compare
51e9e33
to
a8397ab
Compare
…rent environments
Description
This PR introduces a
SoftwareUpdatesDiscoveryEventHandler
reacting toSoftwareUpdatesDiscoveryRequested
events, getting information from SUMA and dispatching back in the system aCompleteSoftwareUpdatesDiscovery
possibly resulting in a host's health change.What's next:
DiscoverSoftwareUpdates
command so thatSoftwareUpdatesDiscoveryRequested
+ event listener is triggered (currently we'd only have a completion event without an initiation event)/hosts/:id/software_updates
How was this tested?
Automated tests.