1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-06 08:17:11 +00:00

snap: enforce hold when installing at a specific revision (#12097)

* snap: enforce hold when installing at a specific revision

When `revision` is specified, run `snap refresh --hold` after install/refresh
to actually pin the snap and prevent automatic updates from overriding it.
Detects hold-mismatch idempotently via the Notes column of `snap list`.

Fixes #12088

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(changelog): add fragment for snap hold fix (#12097)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(snap): remove incorrect manual-refresh assertion from hold test

snap refresh --hold only blocks the snapd auto-refresh daemon; a manual
snap refresh bypasses the hold. Remove the block that ran snap refresh
manually and asserted the revision was unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* snap: add bare-refresh hold test and docs warning for manual refresh bypass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexei Znamensky 2026-05-26 01:34:48 +12:00 committed by GitHub
parent 1bf5e6e69a
commit 850ef03fe7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 75 additions and 6 deletions

View file

@ -47,6 +47,8 @@ def snap_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
options=cmd_runner_fmt.as_list(),
info=cmd_runner_fmt.as_fixed("info"),
revision=cmd_runner_fmt.as_opt_val("--revision"),
hold=cmd_runner_fmt.as_bool("--hold"),
unhold=cmd_runner_fmt.as_bool("--unhold"),
dangerous=cmd_runner_fmt.as_bool("--dangerous"),
devmode=cmd_runner_fmt.as_bool("--devmode"),
version=cmd_runner_fmt.as_fixed("version"),