Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 1 | - when: init_saved_state |
| 2 | block: |
| 3 | - name: Run tempest cleanup init-saved-state |
| 4 | become: yes |
| 5 | become_user: tempest |
Martin Kopec | a857880 | 2020-04-07 08:19:14 +0000 | [diff] [blame] | 6 | command: tox -evenv-tempest -- tempest cleanup --init-saved-state --debug |
Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 7 | 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 Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 15 | - import_tasks: dry_run.yaml |
Martin Kopec | f62dbc1 | 2019-12-12 00:20:41 +0000 | [diff] [blame] | 16 | |
| 17 | - name: Cat dry_run.json |
| 18 | command: cat "{{ devstack_base_dir }}/tempest/dry_run.json" |
| 19 | |
Martin Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 20 | - 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 Kopec | 1a9c40d | 2024-05-09 13:30:43 +0200 | [diff] [blame] | 30 | 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 Tamagnone | 9052dfc | 2023-04-09 15:24:45 +0000 | [diff] [blame] | 33 | |
| 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 Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 41 | |
Martin Kopec | 1a9c40d | 2024-05-09 13:30:43 +0200 | [diff] [blame] | 42 | - 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 Kopec | 05c35eb | 2020-08-12 09:17:35 +0000 | [diff] [blame] | 54 | - 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" |