[Fleet] skip output validation when create/update package policy (#216438)

## Summary

Closes https://github.com/elastic/kibana/issues/198107

Skip output validation on bump agent policy, it's unnecessary after the
package policy create/update logic already does the validation with the
correct integration output.

To verify:
- Create an agent policy with a remote ES output as data output
- Add fleet server integration - expect error as the default remote ES
output can't be used with fleet server
- Change integration output to the ES output - expect creation
successful
- Edit fleet server integration (keep ES output) - expect update
successful

<img width="1685" alt="image"
src="https://github.com/user-attachments/assets/42a0365c-1f00-42b6-b685-7797e9c916de"
/>
<img width="1714" alt="image"
src="https://github.com/user-attachments/assets/af22cea1-d8b3-4d44-a24d-78dff49eeaaa"
/>
<img width="1699" alt="image"
src="https://github.com/user-attachments/assets/aafc7e5c-b9e6-47b8-9001-16e08cf06205"
/>
<img width="1704" alt="image"
src="https://github.com/user-attachments/assets/e6e7ef47-918a-423f-a54c-11836362d495"
/>
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/128ef119-2178-4971-9e0f-bb773c2f774a"
/>
<img width="1707" alt="image"
src="https://github.com/user-attachments/assets/cd49716d-aa38-42ff-9329-3d97f08f9e7e"
/>


### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Julia Bardi 2025-03-31 17:07:23 +02:00 committed by GitHub
parent e86127ab49
commit 7adc1821d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -913,13 +913,18 @@ class AgentPolicyService {
soClient: SavedObjectsClientContract,
esClient: ElasticsearchClient,
id: string,
options?: { user?: AuthenticatedUser; removeProtection?: boolean; asyncDeploy?: boolean }
options?: {
user?: AuthenticatedUser;
removeProtection?: boolean;
asyncDeploy?: boolean;
skipValidation?: boolean;
}
): Promise<void> {
return withSpan('bump_agent_policy_revision', async () => {
await this._update(soClient, esClient, id, {}, options?.user, {
bumpRevision: true,
removeProtection: options?.removeProtection ?? false,
skipValidation: false,
skipValidation: options?.skipValidation ?? true,
returnUpdatedPolicy: false,
asyncDeploy: options?.asyncDeploy,
});