mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-16 13:51:09 +00:00
[PR #11748/972bed66 backport][stable-12] flatpak: add from_url parameter, deprecate URLs in name (#11814)
flatpak: add from_url parameter, deprecate URLs in name (#11748)
* flatpak: add from_url parameter, deprecate URLs in name
Adds a new `from_url` parameter for installing flatpaks from a
.flatpakref URL, using `flatpak install --from <url>`. The `name`
parameter then carries the reverse DNS application ID, enabling
reliable idempotency checks.
Passing URLs directly in `name` is now deprecated and will be
removed in community.general 14.0.0.
Fixes #4000
* flatpak: add changelog fragment for PR #11748
* flatpak: remove deprecation, adjust docs tone
* flatpak: add integration tests for from_url parameter
---------
(cherry picked from commit 972bed66f4)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,40 @@
|
||||
state=latest an absent flatpak a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
|
||||
# state=present with from_url on absent flatpak
|
||||
|
||||
- name: Test addition of absent flatpak with from_url (check mode)
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
no_dependencies: true
|
||||
register: from_url_addition_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify addition of absent flatpak with from_url test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- from_url_addition_result is changed
|
||||
msg: "Adding an absent flatpak with from_url shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of addition of absent flatpak with from_url (check mode)
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
no_dependencies: true
|
||||
register: double_from_url_addition_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify non-existent idempotency of addition of absent flatpak with from_url test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- double_from_url_addition_result is changed
|
||||
msg: |
|
||||
Adding an absent flatpak with from_url a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
|
||||
# state=present with url on absent flatpak
|
||||
|
||||
- name: Test addition of absent flatpak with url (check mode)
|
||||
@@ -231,6 +265,23 @@
|
||||
- latest_present_result is changed
|
||||
msg: "state=latest an present flatpak shall mark module execution as changed"
|
||||
|
||||
# state=present with from_url on present flatpak
|
||||
|
||||
- name: Test addition with from_url of present flatpak (check mode)
|
||||
flatpak:
|
||||
name: com.dummy.App2
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
|
||||
state: present
|
||||
no_dependencies: true
|
||||
register: from_url_addition_present_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify addition with from_url of present flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- from_url_addition_present_result is not changed
|
||||
msg: "Adding a present flatpak with from_url shall mark module execution as not changed"
|
||||
|
||||
# state=present with url on present flatpak
|
||||
|
||||
- name: Test addition with url of present flatpak (check mode)
|
||||
|
||||
@@ -230,6 +230,97 @@
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
|
||||
# state=present with from_url
|
||||
|
||||
- name: Test addition with from_url - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: from_url_addition_result
|
||||
|
||||
- name: Verify addition with from_url test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- from_url_addition_result is changed
|
||||
msg: "state=present with from_url shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of addition with from_url - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: double_from_url_addition_result
|
||||
|
||||
- name: Verify idempotency of addition with from_url test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- double_from_url_addition_result is not changed
|
||||
msg: "state=present with from_url shall not do anything when flatpak is already present"
|
||||
|
||||
- name: Cleanup after state=present with from_url test - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
state: absent
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
|
||||
# from_url validation failures
|
||||
|
||||
- name: Test from_url with URL in name fails - {{ method }}
|
||||
flatpak:
|
||||
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
register: from_url_url_name_result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Verify from_url with URL in name fails - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- from_url_url_name_result is failed
|
||||
- from_url_url_name_result is not changed
|
||||
msg: "from_url and URL in name shall fail"
|
||||
|
||||
- name: Test from_url with multiple names fails - {{ method }}
|
||||
flatpak:
|
||||
name:
|
||||
- com.dummy.App1
|
||||
- com.dummy.App2
|
||||
from_url: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
register: from_url_multi_name_result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Verify from_url with multiple names fails - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- from_url_multi_name_result is failed
|
||||
- from_url_multi_name_result is not changed
|
||||
msg: "from_url with multiple names shall fail"
|
||||
|
||||
- name: Test from_url with non-http URL fails - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
from_url: file:///tmp/flatpak/repo/com.dummy.App1.flatpakref
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
register: from_url_non_http_result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Verify from_url with non-http URL fails - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- from_url_non_http_result is failed
|
||||
- from_url_non_http_result is not changed
|
||||
msg: "from_url with non-http URL shall fail"
|
||||
|
||||
# state=present with list of packages
|
||||
|
||||
- name: Test addition with list - {{ method }}
|
||||
|
||||
Reference in New Issue
Block a user