[Fleet] Fix creation of POLICY_CHANGE action during 7.9 => 7.10 migration#81041
Conversation
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
52d4dea to
8f197e8
Compare
| const adminUser = await outputService.getAdminUser(soClient, false); | ||
| const outputId = await outputService.getDefaultOutputId(soClient); | ||
| // If admin user (fleet_enroll) and output id exist Agents are correctly setup | ||
| return adminUser !== null && outputId !== null; |
There was a problem hiding this comment.
this condition seems to differ from the original, where we just check for truthiness. is there a specific need to change to check for null instead?
There was a problem hiding this comment.
no there is no specific need I check for null to fix a type issue otherwise is not returning a boolean here, but I could replace it by
!!adminUser && !!outputId
| throw new Error('Policy not found'); | ||
| } | ||
|
|
||
| await ensureAgentActionPolicyChangeExists(soClient); |
There was a problem hiding this comment.
IMO it's a bit strange to have this function called in this order, in the middle of the logic for ensuring default packages for default policy. what do you think of moving it to L68, before the start of this logic, but after the rest of the ensure() methods?
There was a problem hiding this comment.
we probably want to have it after the package installation so the config contains the package I should probably move it L111
💚 Build SucceededMetrics [docs]distributable file count
History
To update your PR or re-run it, just comment with: |
Summary
Resolve https://github.com/elastic/beats/issues/21904
In 7.10 we introduced an Agent action
POLICY_CHANGEper policy instead of dynamically creating that action during the agent checkin.But that action is not created for Policy previous to 7.10 until a change is made to the policy, this fix it by checkin in the ingest manager setup call if all the policy have a
POLICY_CHANGEaction.How to reproduce the bug?
POLICY_CHANGEaction.