Reuse existing tempest workspace

If the tempest role is re-run against a host it will fail attempting to
re-initialize over an existing workspace. Update the changed_when and
failed_when conditions to allow reusing an existing workspace. Also
provide the path to the workspace rather than working from within the
tempest directory to avoid stderr and stdout being written to logs.

Change-Id: Ie88cb72b0d7cd3ef07ab269f2580485a7eeae3c6
This commit is contained in:
Jimmy McCrory 2016-11-08 11:50:44 -08:00
parent e74ddcadf4
commit 3f54816df6

View File

@ -76,12 +76,19 @@
- name: Initialise tempest workspace
shell: |
. {{ tempest_venv_bin }}/activate
tempest init workspace
if [ ! -d {{ tempest_venv_bin | dirname }}/workspace ]
then
. {{ tempest_venv_bin }}/activate
tempest init {{ tempest_venv_bin | dirname }}/workspace
exit 3
fi
args:
chdir: "{{ tempest_venv_bin | dirname }}"
executable: /bin/bash
changed_when: false
register: tempest_init_workspace
changed_when: tempest_init_workspace.rc == 3
failed_when:
- tempest_init_workspace.rc != 0
- tempest_init_workspace.rc != 3
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint