diff options
author | Sloane Hertel <19572925+s-hertel@users.noreply.github.com> | 2022-09-29 19:55:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-29 16:55:51 -0700 |
commit | 45abd5b685104d4fa0d5a6501456b5a5372dfeef (patch) | |
tree | 7fdf7d6a5b98ef5f38669e122205cbebaaa50d37 /test | |
parent | 551ddebeab451c1f158e4ef8b656d60ff57689be (diff) | |
download | ansible-45abd5b685104d4fa0d5a6501456b5a5372dfeef.tar.gz |
[2.13] apt - fix failure when package is not installed and only_upgrade=True (#78791)
* apt - fix failure when package is not installed and only_upgrade=True (#78781)
* apt - fix module failure when package is not installed and only_upgrade is True
* changelog
(cherry picked from commit 4b45b4b09d9257006f7b23237293c8c1a04521d8)
* apt - fix module short-circuiting when a package is not installed and only_upgrade is True
(cherry picked from commit 14f46845f9e74aac26aa54004c88a414926afc6a)
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/apt/tasks/repo.yml | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/test/integration/targets/apt/tasks/repo.yml b/test/integration/targets/apt/tasks/repo.yml index e4e39aa357..d4cce78a1b 100644 --- a/test/integration/targets/apt/tasks/repo.yml +++ b/test/integration/targets/apt/tasks/repo.yml @@ -54,7 +54,7 @@ # https://github.com/ansible/ansible/issues/30638 - block: - - name: Fail to install foo=1.0.1 since foo is not installed and only_upgrade is set + - name: Don't install foo=1.0.1 since foo is not installed and only_upgrade is set apt: name: foo=1.0.1 state: present @@ -67,30 +67,36 @@ assert: that: - "apt_result is not changed" - - "apt_result is failed" + - "apt_result is success" - apt: name: foo=1.0.0 allow_unauthenticated: yes - - name: Upgrade foo to 1.0.1 + - name: Upgrade foo to 1.0.1 but don't upgrade foobar since it is not installed apt: - name: foo=1.0.1 + name: foobar=1.0.1,foo=1.0.1 state: present only_upgrade: yes allow_unauthenticated: yes register: apt_result - name: Check install with dpkg - shell: dpkg-query -l foo + shell: "dpkg-query -l {{ item }}" register: dpkg_result + ignore_errors: yes + loop: + - foobar + - foo - name: Check if install was successful assert: that: - "apt_result is success" - - "dpkg_result is success" - - "'1.0.1' in dpkg_result.stdout" + - "dpkg_result.results[0] is failure" + - "'1.0.1' not in dpkg_result.results[0].stdout" + - "dpkg_result.results[1] is success" + - "'1.0.1' in dpkg_result.results[1].stdout" always: - name: Clean up apt: |