tobiko/roles/tobiko-cleanup/tasks/main.yaml
Eduardo Olivares 109802be5f Create only one Sec Group per fixture
This patch includes some changes wrt StatelessSecurityGroupFixture:
- a task that cleans up the security groups generated with this fixture
  is added to the tobiko-cleanup role
- when TOBIKO_PREVENT_CREATE env variable is set, the security groups
  are not created (they should have been created before)
- the lockutils.synchronized decorator is used to avoid that two
  security groups with the same name are created concurrently
- neutron.get_security_group(self.name) did not work because that method
  does not work with the security group name; it is replaced by
  neutron.list_security_groups(name=self.name) instead

Change-Id: I3ab84e138049a27db017630b32d81d290aa5f6cd
2023-04-21 13:17:31 +00:00

45 lines
1.3 KiB
YAML

---
- name: "cleanup Loadbalancers created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack loadbalancer list -f value -c 'name' | \
grep "^tobiko\." | \
xargs -r openstack loadbalancer delete --cascade --wait
ignore_errors: yes
- name: "cleanup Heat stacks created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack stack list -f value -c 'Stack Name' | \
grep "^tobiko\." | \
xargs -r timeout 180 openstack stack delete -y --wait
register: result
retries: 5
delay: 5
until: result.rc == 0
ignore_errors: yes
- name: "cleanup subnet pools created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack subnet pool list -f value -c 'Name' | \
grep "^tobiko\." | \
xargs -r openstack subnet pool delete
ignore_errors: yes
- name: "cleanup Security Groups created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack security group list -f value -c 'Name' | \
grep "^tobiko\." | \
xargs -r openstack security group delete
ignore_errors: yes
- name: "cleanup Glance images created by Tobiko tests"
shell: |
source {{ stackrc_file }}
openstack image list -f value -c 'Name' | \
grep "^tobiko\." | \
xargs -r openstack image delete
ignore_errors: yes