Skip to content

Commit 41bf1ef

Browse files
[9.0] [Fleet] skip output validation when create/update package policy (elastic#216438) (elastic#216497)
# Backport This will backport the following commits from `main` to `9.0`: - [[Fleet] skip output validation when create/update package policy (elastic#216438)](elastic#216438) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-03-31T15:07:23Z","message":"[Fleet] skip output validation when create/update package policy (elastic#216438)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/198107\n\nSkip output validation on bump agent policy, it's unnecessary after the\npackage policy create/update logic already does the validation with the\ncorrect integration output.\n\nTo verify:\n- Create an agent policy with a remote ES output as data output\n- Add fleet server integration - expect error as the default remote ES\noutput can't be used with fleet server\n- Change integration output to the ES output - expect creation\nsuccessful\n- Edit fleet server integration (keep ES output) - expect update\nsuccessful\n\n<img width=\"1685\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/42a0365c-1f00-42b6-b685-7797e9c916de\"\n/>\n<img width=\"1714\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/af22cea1-d8b3-4d44-a24d-78dff49eeaaa\"\n/>\n<img width=\"1699\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/aafc7e5c-b9e6-47b8-9001-16e08cf06205\"\n/>\n<img width=\"1704\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/e6e7ef47-918a-423f-a54c-11836362d495\"\n/>\n<img width=\"1712\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/128ef119-2178-4971-9e0f-bb773c2f774a\"\n/>\n<img width=\"1707\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cd49716d-aa38-42ff-9329-3d97f08f9e7e\"\n/>\n\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"7adc1821d83fa9ed913de1b6624adfc1b7640003","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v9.1.0"],"title":"[Fleet] skip output validation when create/update package policy","number":216438,"url":"https://github.com/elastic/kibana/pull/216438","mergeCommit":{"message":"[Fleet] skip output validation when create/update package policy (elastic#216438)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/198107\n\nSkip output validation on bump agent policy, it's unnecessary after the\npackage policy create/update logic already does the validation with the\ncorrect integration output.\n\nTo verify:\n- Create an agent policy with a remote ES output as data output\n- Add fleet server integration - expect error as the default remote ES\noutput can't be used with fleet server\n- Change integration output to the ES output - expect creation\nsuccessful\n- Edit fleet server integration (keep ES output) - expect update\nsuccessful\n\n<img width=\"1685\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/42a0365c-1f00-42b6-b685-7797e9c916de\"\n/>\n<img width=\"1714\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/af22cea1-d8b3-4d44-a24d-78dff49eeaaa\"\n/>\n<img width=\"1699\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/aafc7e5c-b9e6-47b8-9001-16e08cf06205\"\n/>\n<img width=\"1704\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/e6e7ef47-918a-423f-a54c-11836362d495\"\n/>\n<img width=\"1712\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/128ef119-2178-4971-9e0f-bb773c2f774a\"\n/>\n<img width=\"1707\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cd49716d-aa38-42ff-9329-3d97f08f9e7e\"\n/>\n\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"7adc1821d83fa9ed913de1b6624adfc1b7640003"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216438","number":216438,"mergeCommit":{"message":"[Fleet] skip output validation when create/update package policy (elastic#216438)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/198107\n\nSkip output validation on bump agent policy, it's unnecessary after the\npackage policy create/update logic already does the validation with the\ncorrect integration output.\n\nTo verify:\n- Create an agent policy with a remote ES output as data output\n- Add fleet server integration - expect error as the default remote ES\noutput can't be used with fleet server\n- Change integration output to the ES output - expect creation\nsuccessful\n- Edit fleet server integration (keep ES output) - expect update\nsuccessful\n\n<img width=\"1685\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/42a0365c-1f00-42b6-b685-7797e9c916de\"\n/>\n<img width=\"1714\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/af22cea1-d8b3-4d44-a24d-78dff49eeaaa\"\n/>\n<img width=\"1699\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/aafc7e5c-b9e6-47b8-9001-16e08cf06205\"\n/>\n<img width=\"1704\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/e6e7ef47-918a-423f-a54c-11836362d495\"\n/>\n<img width=\"1712\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/128ef119-2178-4971-9e0f-bb773c2f774a\"\n/>\n<img width=\"1707\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/cd49716d-aa38-42ff-9329-3d97f08f9e7e\"\n/>\n\n\n### Checklist\n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"7adc1821d83fa9ed913de1b6624adfc1b7640003"}}]}] BACKPORT--> Co-authored-by: Julia Bardi <[email protected]>
1 parent 9e9f9ac commit 41bf1ef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

x-pack/platform/plugins/shared/fleet/server/services/agent_policy.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,13 +906,18 @@ class AgentPolicyService {
906906
soClient: SavedObjectsClientContract,
907907
esClient: ElasticsearchClient,
908908
id: string,
909-
options?: { user?: AuthenticatedUser; removeProtection?: boolean; asyncDeploy?: boolean }
909+
options?: {
910+
user?: AuthenticatedUser;
911+
removeProtection?: boolean;
912+
asyncDeploy?: boolean;
913+
skipValidation?: boolean;
914+
}
910915
): Promise<void> {
911916
return withSpan('bump_agent_policy_revision', async () => {
912917
await this._update(soClient, esClient, id, {}, options?.user, {
913918
bumpRevision: true,
914919
removeProtection: options?.removeProtection ?? false,
915-
skipValidation: false,
920+
skipValidation: options?.skipValidation ?? true,
916921
returnUpdatedPolicy: false,
917922
asyncDeploy: options?.asyncDeploy,
918923
});

0 commit comments

Comments
 (0)