snap: add revision parameter (#11984)

* feat(snap): add ``revision`` parameter

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

* feat(snap): add changelog fragment for PR 11984

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-04 07:28:06 +12:00
committed by GitHub
parent c4fc0ff4e1
commit 2aa6fc2cf7
5 changed files with 107 additions and 14 deletions

View File

@@ -19,5 +19,7 @@
ansible.builtin.include_tasks: test_dangerous.yml
- name: Include test_3dash
ansible.builtin.include_tasks: test_3dash.yml
- name: Include test_revision
ansible.builtin.include_tasks: test_revision.yml
- name: Include test_empty_list
ansible.builtin.include_tasks: test_empty_list.yml

View File

@@ -0,0 +1,60 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Make sure package is not installed (uhttpd)
community.general.snap:
name: uhttpd
state: absent
- name: Install package at specific revision (uhttpd rev 15)
community.general.snap:
name: uhttpd
state: present
revision: 15
register: install_revision
- name: Install same revision again - idempotency (uhttpd rev 15)
community.general.snap:
name: uhttpd
state: present
revision: 15
register: install_revision_again
- name: Assert revision install behavior
assert:
that:
- install_revision is changed
- install_revision_again is not changed
- name: Install different revision (uhttpd rev 45)
community.general.snap:
name: uhttpd
state: present
revision: 45
register: install_different_revision
- name: Assert switching to a different revision triggers change
assert:
that:
- install_different_revision is changed
- name: Remove package (uhttpd)
community.general.snap:
name: uhttpd
state: absent
- name: Verify channel and revision are mutually exclusive
community.general.snap:
name: uhttpd
state: present
channel: latest/stable
revision: 15
register: install_channel_and_revision
ignore_errors: true
- name: Assert channel and revision are mutually exclusive
assert:
that:
- install_channel_and_revision is failed