-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Implement preconditions in packages install state machine #190986
[Fleet] Implement preconditions in packages install state machine #190986
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Pinging @elastic/fleet (Team:Fleet) |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @criamico |
@@ -63,6 +67,10 @@ export async function handleState( | |||
let currentStatus = 'pending'; | |||
let stateResult; | |||
let updatedContext = { ...context }; | |||
|
|||
// execute pre transition function, if available | |||
await executePreTransition(logger, updatedContext, currentState); |
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.
For my understanding, do you have an example behavior of what will fo into that pre-transition function? (trying to understand what is the difference between the preTransation and the actual transition)
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.
My idea was to use it to pass a separate function that verifies if a transition can be executed or not: https://github.com/elastic/kibana/pull/190986/files#diff-b10bba63aaadda84089fe825d4653fa82908e20a3e795c91a2f005169c2d8fffR420-R445
Surely we could also add a check at the beginning of each transition and throw an error in that case, but I think that this approach would be more modular. Let me know what you think :)
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.
It probably can help to separate concerns thanks for the explanation 👍
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.
🚀
Closes #189353
Summary
Small change that implements a precondition function for package install state machine. This is needed for the subsequent work planned in #169147.
Note that this code is added and tested, but it's not currently used and it will actually be used only when #175597 will be implemented.
Checklist