-
Notifications
You must be signed in to change notification settings - Fork 146
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
WIP: fix empty version when loading upgrade action from disk #4184
WIP: fix empty version when loading upgrade action from disk #4184
Conversation
TL;DR: YAML isn't JSON. Ok, let me explain that: When using JSON it's possible to have a It works for the fleet defined JSON That's why we're loosing data like the Some possible solutions:
Regardless of the solution: we also need some good set of tests to ensure this mix and match of types that an action can be do not loose data when persisting them to disk and reading them back. Mainly if we add new fields or action types. It's exactly what our current tests are missing, to assert the specific fields for each action type. Right now, for me, I'd like to avoid future problems, what requires a solution allowing the model of the actions be altered or new actions be created without requiring to change any marshal/unmarshal code. What makes me side with 1) and accept the burden of the refactor. However I haven't accessed how far all the actions spread in the agent's code, so I cannot guess the amount of work it'd require. |
Consistently using JSON everywhere seems like the correct approach to eliminate compatibility errors. I am unsure why we use YAML to store actions on disk. Perhaps @michel-laterman knows or can give us guidance on the best approach since he was involved in the original implementation. The one complication to changing the format is that actions are persisted on disk, which means if we change the format we have to treat this as a data migration. I don't think there are a lot of actions persisted in general, in fact I'm not sure the most important one in upgrades even gets persisted. That said we should avoid throwing away actions that otherwise would have been processed. I can think of a couple of ways to deal with this, but am open to suggestion on which approach we should take. |
@cmacknz I think yaml was used to be consistent with the format of the other files the elastic-agent wrote to disk. |
3dd8f7b
to
1313ded
Compare
…-state-empty-version
It's needed so we can set the encrypted store vault's path
…lastic-agent into 3912-fix-state-empty-version
Quality Gate passedThe SonarQube Quality Gate passed, but some issues were introduced. 4 New issues |
This pull request is now in conflicts. Could you fix it? 🙏
|
closed in favour of #4441 |
What does this PR do?
Why is it important?
Checklist
./changelog/fragments
using the changelog toolAuthor's Checklist
How to test this PR locally
Related issues
error parsing version ""
if agent restarts before the upgrade starts #3912Use cases
Screenshots
Logs
Questions to ask yourself