blob: 1e1c1a7469235f9348939dcd9b9d3de0c21123d3 [file] [log] [blame]
Martin Kopecf62dbc12019-12-12 00:20:41 +00001- when: init_saved_state
2 block:
3 - name: Run tempest cleanup init-saved-state
4 become: yes
5 become_user: tempest
Martin Kopeca8578802020-04-07 08:19:14 +00006 command: tox -evenv-tempest -- tempest cleanup --init-saved-state --debug
Martin Kopecf62dbc12019-12-12 00:20:41 +00007 args:
8 chdir: "{{ devstack_base_dir }}/tempest"
9
10 - name: Cat saved_state.json
11 command: cat "{{ devstack_base_dir }}/tempest/saved_state.json"
12
13- when: dry_run
14 block:
Martin Kopec05c35eb2020-08-12 09:17:35 +000015 - import_tasks: dry_run.yaml
Martin Kopecf62dbc12019-12-12 00:20:41 +000016
17 - name: Cat dry_run.json
18 command: cat "{{ devstack_base_dir }}/tempest/dry_run.json"
19
Martin Kopec05c35eb2020-08-12 09:17:35 +000020- when:
21 - not dry_run
22 - not init_saved_state
23 block:
24 - name: Run tempest cleanup
25 become: yes
26 become_user: tempest
27 command: tox -evenv-tempest -- tempest cleanup --debug
28 args:
29 chdir: "{{ devstack_base_dir }}/tempest"
Martin Kopec1a9c40d2024-05-09 13:30:43 +020030 when:
31 - not run_tempest_cleanup_prefix
32 - run_tempest_cleanup_resource_list is not defined or not run_tempest_cleanup_resource_list
Luigi Dino Tamagnone9052dfc2023-04-09 15:24:45 +000033
34 - name: Run tempest cleanup with tempest prefix
35 become: yes
36 become_user: tempest
37 command: tox -evenv-tempest -- tempest cleanup --debug --prefix tempest
38 args:
39 chdir: "{{ devstack_base_dir }}/tempest"
40 when: run_tempest_cleanup_prefix
Martin Kopec05c35eb2020-08-12 09:17:35 +000041
Martin Kopec1a9c40d2024-05-09 13:30:43 +020042 - name: Cat resource_list.json
43 command: cat "{{ devstack_base_dir }}/tempest/resource_list.json"
44 when: run_tempest_cleanup_resource_list
45
46 - name: Run tempest cleanup with tempest resource list
47 become: yes
48 become_user: tempest
49 command: tox -evenv-tempest -- tempest cleanup --debug --resource-list
50 args:
51 chdir: "{{ devstack_base_dir }}/tempest"
52 when: run_tempest_cleanup_resource_list
53
Martin Kopec05c35eb2020-08-12 09:17:35 +000054- when:
55 - run_tempest_fail_if_leaked_resources
56 - not init_saved_state
57 block:
58 # let's run dry run again, if haven't already, to check no leftover
59 # resources were left behind after the cleanup in the previous task
60 - import_tasks: dry_run.yaml
61 when: not dry_run
62
63 - name: Fail if any resources are leaked
64 become: yes
65 become_user: tempest
66 shell: |
67 python3 roles/tempest-cleanup/tasks/dry_run_checker.py --file {{ devstack_base_dir }}/tempest/dry_run.json --is-empty
68 args:
69 chdir: "{{ devstack_base_dir }}/tempest"