Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenario44: Cts fix deleting object in OBS bucket #91

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
74 changes: 74 additions & 0 deletions playbooks/scenario44_simple_cts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---

# Scenario 44: CTS
#
- name: Scenario 44 - basic cts functions
hosts: localhost
vars:
prefix: scenario44-
tasks:
- set_fact:
prefix: "{{ (prefix + ( lookup('env', 'TASK_EXECUTOR_JOB_ID') | default(99999999 | random | to_uuid | hash('md5'), true) ) )[0:24] }}"

- set_fact:
bucket_name: "{{ (prefix + '-cts-apimon') }}"

- block:
# There is only one CTS tracker (system), delete it first
- name: Delete CTS system tracker
script: "delete_cts_tracker.py"
args:
executable: python3
ignore_errors: true

- name: Check if CTS system tracker still exists
command: "/usr/bin/openstack cts tracker show system"
register: rc
ignore_errors: true

- name: Create OBS bucket
script: "create_container.py {{ bucket_name }}"
args:
executable: python3
register: rc_obs
when: rc.failed is true

# Enable CTS system tracker, only if it does not exits and OBS creation succeeded
- name: Enable CTS system tracker
script: "create_cts_tracker.py {{ bucket_name }}"
args:
executable: python3
register: rc_create
when: rc.failed is true and rc_obs.failed is false

# Update tracker, only if createion succeeded
- name: Update CTS system tracker
script: "update_cts_tracker.py {{ bucket_name }}"
args:
executable: python3
when: rc_create.failed is false

always:
- block:
- name: Delete CTS system tracker
script: "delete_cts_tracker.py"
args:
executable: python3

- name: Get all object from OBS bucket
command: "/usr/bin/openstack obs object list -f value {{ bucket_name }}"
register: obj_list

- name: Delete objects in OBS bucket
script: "delete_object.py {{ bucket_name}} {{ item }}"
args:
executable: python3
with_items:
- "{{ obj_list.stdout_lines }}"

- name: Delete OBS container
script: "delete_container.py {{ bucket_name}} "
args:
executable: python3

ignore_errors: true