mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 14:50:02 -07:00
Add support for state=latest to flatpak module (#8221)
Fixes #6563 by extending the allowed values of the `state` parameter to include `latest`. To do this, the `update_flat()` function is introduced which borrows the majority of its implementation from both the existing `install_flat()` and `remove_flat()` functions. The documentation and examples have been expanded describing what to expect when using `state=latest`.
This commit is contained in:
parent
8f98ba9119
commit
0735656319
3 changed files with 328 additions and 12 deletions
|
@ -52,6 +52,38 @@
|
|||
- removal_result is not changed
|
||||
msg: "Removing an absent flatpak shall mark module execution as not changed"
|
||||
|
||||
# state=latest on absent flatpak
|
||||
|
||||
- name: Test state=latest of absent flatpak (check mode)
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
register: latest_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify state=latest of absent flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- latest_result is changed
|
||||
msg: "state=latest an absent flatpak shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of state=latest of absent flatpak (check mode)
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
register: double_latest_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify non-existent idempotency of state=latest of absent flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- double_latest_result is changed
|
||||
msg: |
|
||||
state=latest an absent flatpak 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)
|
||||
|
@ -101,6 +133,40 @@
|
|||
- url_removal_result is not changed
|
||||
msg: "Removing an absent flatpak shall mark module execution as not changed"
|
||||
|
||||
# state=latest with url on absent flatpak
|
||||
|
||||
- name: Test state=latest of absent flatpak with url (check mode)
|
||||
flatpak:
|
||||
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
register: url_latest_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify state=latest of absent flatpak with url test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- url_latest_result is changed
|
||||
msg: "state=latest an absent flatpak from URL shall mark module execution as changed"
|
||||
|
||||
- name: Test non-existent idempotency of state=latest of absent flatpak with url (check mode)
|
||||
flatpak:
|
||||
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
register: double_url_latest_result
|
||||
check_mode: true
|
||||
|
||||
- name: >
|
||||
Verify non-existent idempotency of additionof state=latest flatpak with url test
|
||||
result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- double_url_latest_result is changed
|
||||
msg: |
|
||||
state=latest an absent flatpak from URL a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
|
||||
# - Tests with present flatpak -------------------------------------------------
|
||||
|
||||
# state=present on present flatpak
|
||||
|
@ -149,6 +215,22 @@
|
|||
Removing a present flatpak a second time shall still mark module execution
|
||||
as changed in check mode
|
||||
|
||||
# state=latest on present flatpak
|
||||
|
||||
- name: Test state=latest of present flatpak (check mode)
|
||||
flatpak:
|
||||
name: com.dummy.App2
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
register: latest_present_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify latest test result of present flatpak (check mode)
|
||||
assert:
|
||||
that:
|
||||
- latest_present_result is changed
|
||||
msg: "state=latest an present flatpak shall mark module execution as changed"
|
||||
|
||||
# state=present with url on present flatpak
|
||||
|
||||
- name: Test addition with url of present flatpak (check mode)
|
||||
|
@ -195,3 +277,19 @@
|
|||
that:
|
||||
- double_url_removal_present_result is changed
|
||||
msg: Removing an absent flatpak a second time shall still mark module execution as changed
|
||||
|
||||
# state=latest with url on present flatpak
|
||||
|
||||
- name: Test state=latest with url of present flatpak (check mode)
|
||||
flatpak:
|
||||
name: http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
register: url_latest_present_result
|
||||
check_mode: true
|
||||
|
||||
- name: Verify state=latest with url of present flatpak test result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- url_latest_present_result is changed
|
||||
msg: "state=latest a present flatpak from URL shall mark module execution as changed"
|
||||
|
|
|
@ -65,6 +65,45 @@
|
|||
- double_removal_result is not changed
|
||||
msg: "state=absent shall not do anything when flatpak is not present"
|
||||
|
||||
# state=latest
|
||||
|
||||
- name: Test state=latest - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
remote: dummy-remote
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: latest_result
|
||||
|
||||
- name: Verify state=latest test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- latest_result is changed
|
||||
msg: "state=latest shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of state=latest - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
remote: dummy-remote
|
||||
state: present
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: double_latest_result
|
||||
|
||||
- name: Verify idempotency of state=latest test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- double_latest_result is not changed
|
||||
msg: "state=latest shall not do anything when flatpak is already present"
|
||||
|
||||
- name: Cleanup after state=present test - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
state: absent
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
|
||||
# state=present with url as name
|
||||
|
||||
- name: Test addition with url - {{ method }}
|
||||
|
@ -152,6 +191,45 @@
|
|||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
|
||||
# state=latest with url as name
|
||||
|
||||
- name: Test state=latest with url - {{ method }}
|
||||
flatpak:
|
||||
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: url_latest_result
|
||||
|
||||
- name: Verify state=latest test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- url_latest_result is changed
|
||||
msg: "state=present with url as name shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of state=latest with url - {{ method }}
|
||||
flatpak:
|
||||
name: http://127.0.0.1:8000/repo/com.dummy.App1.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: double_url_latest_result
|
||||
|
||||
- name: Verify idempotency of state=latest with url test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- double_url_latest_result is not changed
|
||||
msg: "state=present with url as name shall not do anything when flatpak is already present"
|
||||
|
||||
- name: Cleanup after state=present with url test - {{ method }}
|
||||
flatpak:
|
||||
name: com.dummy.App1
|
||||
state: absent
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
|
||||
# state=present with list of packages
|
||||
|
||||
- name: Test addition with list - {{ method }}
|
||||
|
@ -287,3 +365,84 @@
|
|||
that:
|
||||
- double_removal_result is not changed
|
||||
msg: "state=absent shall not do anything when flatpak is not present"
|
||||
|
||||
# state=latest with list of packages
|
||||
|
||||
- name: Test state=latest with list - {{ method }}
|
||||
flatpak:
|
||||
name:
|
||||
- com.dummy.App1
|
||||
- http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: latest_result
|
||||
|
||||
- name: Verify state=latest with list test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- latest_result is changed
|
||||
msg: "state=present shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of state=latest with list - {{ method }}
|
||||
flatpak:
|
||||
name:
|
||||
- com.dummy.App1
|
||||
- http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: double_latest_result
|
||||
|
||||
- name: Verify idempotency of state=latest with list test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- double_latest_result is not changed
|
||||
msg: "state=present shall not do anything when flatpak is already present"
|
||||
|
||||
- name: Test state=latest with list partially installed - {{ method }}
|
||||
flatpak:
|
||||
name:
|
||||
- com.dummy.App1
|
||||
- http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
|
||||
- com.dummy.App3
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: latest_result
|
||||
|
||||
- name: Verify state=latest with list partially installed test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- latest_result is changed
|
||||
msg: "state=present shall add flatpak when absent"
|
||||
|
||||
- name: Test idempotency of state=latest with list partially installed - {{ method }}
|
||||
flatpak:
|
||||
name:
|
||||
- com.dummy.App1
|
||||
- http://127.0.0.1:8000/repo/com.dummy.App2.flatpakref
|
||||
- com.dummy.App3
|
||||
remote: dummy-remote
|
||||
state: latest
|
||||
method: "{{ method }}"
|
||||
no_dependencies: true
|
||||
register: double_latest_result
|
||||
|
||||
- name: Verify idempotency of state=latest with list partially installed test result - {{ method }}
|
||||
assert:
|
||||
that:
|
||||
- double_latest_result is not changed
|
||||
msg: "state=present shall not do anything when flatpak is already present"
|
||||
|
||||
- name: Cleanup after state=present with list test - {{ method }}
|
||||
flatpak:
|
||||
name:
|
||||
- com.dummy.App1
|
||||
- com.dummy.App2
|
||||
- com.dummy.App3
|
||||
state: absent
|
||||
method: "{{ method }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue