Migrate environment workflow for agentless CSPM setup to /api/fleet/managed_integrations - #7423
Conversation
Replace the deprecated two-step flow (POST agent_policies + POST package_policies with supports_agentless) with a single POST to /api/fleet/managed_integrations. Add delete_managed_integration for cleanup, detected in purge_integrations by agnt_policy_id == pkg_policy_id. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| # When agnt_policy_id == pkg_policy_id the entry was created via the managed_integrations | ||
| # API (a single combined resource). Deleting the managed integration cleans up both the | ||
| # agent policy and package policy automatically. | ||
| if policy.agnt_policy_id == policy.pkg_policy_id: |
There was a problem hiding this comment.
Comparing IDs is fragile, future policy type that stores the same ID in both fields would be routed to the wrong deletion path.
I would suggest adding an explicit is_managed: bool = False field to PolicyState?
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6.0.1 incorrectly groups loguru (third-party) with local-only modules. 6.1.0 correctly separates them into distinct import sections. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without this, isort can't distinguish loguru (third-party) from local modules (fleet_api, configuration_fleet, etc.) in CI's isolated env where loguru isn't installed. Explicit -p flags make both environments agree on the import grouping. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The pre-commit isort hook runs in an isolated env without loguru installed, so it can't distinguish loguru (third-party) from local modules and applies different ordering than local isort. Rather than changing the project-wide isort config, mark the new files with # isort: skip_file so both environments leave them untouched. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 17 minutes 8 seconds in the queue, including 16 minutes 39 seconds running CI. Required conditions to merge
ReasonPull request #7423 has been dequeued GitHub refused to merge the pull request. Pull Request is in the merge queue. This is usually enforced by a branch protection or ruleset rule. HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
Summary
POST /api/fleet/agent_policieswithsupports_agentless: true+POST /api/fleet/package_policies) with a singlePOST /api/fleet/managed_integrationscalltests/fleet_api/managed_integration_api.pywithcreate_managed_integrationanddelete_managed_integrationhelperspurge_integrations.pyto callDELETE /api/fleet/managed_integrations/{id}(which handles full cleanup) when the policy was created via the new APIContext:
/api/fleet/agent_policiesand/api/fleet/package_policiesare being deprecated for agentless integrations in 9.5 GA in favor of/api/fleet/managed_integrations. A feature flag to disallow the old path is being monitored and will be enabled in a future release. See Slack thread for context.Test plan
install_agentless_integrations.pyagainst a serverless project and verify CSPM AWS/Azure/GCP integrations are created successfully via the new endpointpurge_integrations.pyand verify the managed integrations are deleted cleanly🤖 Generated with Claude Code