Skip to content

[API] Patch policies: Install new version when app is closed - #49021

Merged
rachaelshaw merged 12 commits into
docs-v4.91.0from
marko/39962-rest-api-docs
Jul 22, 2026
Merged

[API] Patch policies: Install new version when app is closed#49021
rachaelshaw merged 12 commits into
docs-v4.91.0from
marko/39962-rest-api-docs

Conversation

@marko-lisica

@marko-lisica marko-lisica commented Jul 9, 2026

Copy link
Copy Markdown
Member

Documents the proposed only_when_closed field on patch policies and
the install_skipped activity/result field, for design review ahead of
implementation.
@marko-lisica
marko-lisica requested a review from rachaelshaw as a code owner July 9, 2026 13:05
@marko-lisica
marko-lisica marked this pull request as draft July 9, 2026 13:09
@marko-lisica marko-lisica changed the title Draft REST API design: patch policy install-when-closed (#39962) [API] Patch policies: Install new version when app is closed Jul 9, 2026
Comment thread docs/Contributing/reference/audit-logs.md Outdated
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • :ai

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a32ce3a9-d71a-4ae2-acbf-976b9f8c0e5d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch marko/39962-rest-api-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread docs/REST API/rest-api.md

@marko-lisica marko-lisica Jul 10, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dev notes

Get software install results endpoint

GET /api/v1/fleet/software/install/:install_uuid/results

  • When patch_when_closed is set for FMA, and pre-install query doesn't return results/fails, the output for FMAs with this option enabled should be different from the regular pre-install query output, so UI can show "skipped" status.

It should return: "Query dind't return result\nThe app was open.", instead of "Query didn't return result or failed\nInstall stopped".

Continuous automation

patch_when_closed / continuous_automations_enabled validation

If patch_when_closed is true on a policy (existing or being set in the same request) and the request explicitly sets continuous_automations_enabled to false, Fleet rejects the request instead of silently overriding it.

Error message:

▎ If "patch_when_closed" is true, "continuous_automations_enabled" can't be set to false.

Applies on both create and update (API), and on fleetctl gitops (YAML). This only blocks an explicit false — omitting continuous_automations_enabled while enabling patch_when_closed still auto-sets it to true.

Update package endpoint

PATCH /api/v1/fleet/software/titles/:id/package

patch_when_closed requires patch

patch_when_closed is only meaningful when patch is true (either in the same request, or already enabled on that title). Reject the request if patch_when_closed is set while patch isn't true.

Error message:

▎ If "patch_when_closed" is set, "patch" must be true.

Applies on update; the same constraint should hold wherever patch_when_closed is accepted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ @marko-lisica you might want to update the naming in the dev note (patch_only_when_closed -> patch_when_closed) to avoid confusion about the parameter name

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. Done ✅

Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/Contributing/reference/audit-logs.md Outdated
Comment thread docs/REST API/rest-api.md
| labels_include_all | array | body | Target hosts that have all labels, specified by label name, in the array. |
| labels_include_any | array | body | Target hosts that have any label, specified by label name, in the array. Only one of either `labels_include_any` or `labels_exclude_any` can be specified. |
| labels_exclude_any | array | body | Target hosts that don't have any label, specified by label name, in the array. |
| automatic_install | boolean | body | Enables or disables "Force install": a policy that triggers a software install only on hosts missing the software (doesn't check version). Set to `false` to remove the policy. |

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marko-lisica TODO: do we want automatic_install for custom packages on PATCH endpoint

@marko-lisica
marko-lisica marked this pull request as ready for review July 17, 2026 11:36
Comment thread docs/REST API/rest-api.md Outdated
@rachaelshaw
rachaelshaw merged commit ffb7239 into docs-v4.91.0 Jul 22, 2026
6 checks passed
@rachaelshaw
rachaelshaw deleted the marko/39962-rest-api-docs branch July 22, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants