Debian Codegraph @

test/integration/targets/apt/tasks/upgrade.yml

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 - block:
2 - name: Disable ubuntu repos so system packages are not upgraded and do not change testing env
3 command: mv /etc/apt/sources.list /etc/apt/sources.list.backup
4
5 - name: install foo-1.0.0
6 apt:
7 name: foo=1.0.0
8 state: present
9 allow_unauthenticated: yes
10
11 - name: check foo version
12 shell: dpkg -s foo | grep Version | awk '{print $2}'
13 register: foo_version
14
15 - name: ensure the correct version of foo has been installed
16 assert:
17 that:
18 - "'1.0.0' in foo_version.stdout"
19
20 - name: "(upgrade type: {{upgrade_type}}) upgrade packages to latest version, force_apt_get: {{force_apt_get}}"
21 apt:
22 upgrade: "{{ upgrade_type }}"
23 force_apt_get: "{{ force_apt_get }}"
24 force: yes
25 register: upgrade_result
26
27 - name: check foo version
28 shell: dpkg -s foo | grep Version | awk '{print $2}'
29 register: foo_version
30
31 - name: check that warning is not given when force_apt_get set
32 assert:
33 that:
34 - upgrade_result.warnings | default([]) | length == 0
35 when:
36 - force_apt_get
37
38 - name: check that old version upgraded correctly
39 assert:
40 that:
41 - "'1.0.0' not in foo_version.stdout"
42 - "foo_version.changed"
43
44 - name: "(upgrade type: {{upgrade_type}}) upgrade packages to latest version (Idempotant)"
45 apt:
46 upgrade: "{{ upgrade_type }}"
47 force_apt_get: "{{ force_apt_get }}"
48 force: yes
49 register: second_upgrade_result
50
51 - name: check that nothing has changed (Idempotant)
52 assert:
53 that:
54 - "second_upgrade_result.changed == false"
55
56 always:
57 - name: Clean up
58 apt:
59 pkg: foo,foobar
60 state: absent
61 autoclean: yes
62
63 - name: Restore ubuntu repos
64 command: mv /etc/apt/sources.list.backup /etc/apt/sources.list