- hosts: all
  tasks:
    - name: Run Litmus
      shell:
        cmd: |
          set -e
          function trap_exit_sig() {
            {{ ansible_user_dir }}/workspace/puppet-openstack-integration/copy_logs.sh
          }
          trap trap_exit_sig EXIT
          export CEPH_VERSION={{ ceph }}
          if [ "{{ puppet_gem_version }}" != "latest" ]; then
            export PUPPET_GEM_VERSION='~> {{ puppet_gem_version }}'
          fi
          mkdir .bundled_gems
          export GEM_HOME=`pwd`/.bundled_gems
          export GEM_BIN_DIR=$GEM_HOME/bin
          ruby <<EOF
          cmd = 'gem install bundler --no-document --verbose --no-user-install --bindir=${GEM_BIN_DIR}'
          cmd += ' -v 2.2.11'
          system(cmd)
          EOF
          $GEM_BIN_DIR/bundle install --without system_tests --retry 3
          export RSPEC_DEBUG=true
          $GEM_BIN_DIR/bundle exec rake litmus:acceptance:localhost
        chdir: '{{ ansible_user_dir }}/workspace'
        executable: /bin/bash
      become: yes
      environment: '{{ zuul | zuul_legacy_vars }}'

- hosts: all
  tasks:
    - name: Run Litmus
      shell:
        cmd: |
          set -e
          function trap_exit_sig() {
            {{ ansible_user_dir }}/workspace/puppet-openstack-integration/copy_logs.sh

            # NOTE(tobias-urdin): Litmus does not execute spec_clean rake task after a run.
            $GEM_BIN_DIR/bundle exec rake spec_clean
          }
          trap trap_exit_sig EXIT
          export CEPH_VERSION={{ ceph }}
          if [ "{{ puppet_gem_version }}" != "latest" ]; then
            export PUPPET_GEM_VERSION='~> {{ puppet_gem_version }}'
          fi
          mkdir .bundled_gems
          export GEM_HOME=`pwd`/.bundled_gems
          export GEM_BIN_DIR=$GEM_HOME/bin
          ruby <<EOF
          cmd = 'gem install bundler --no-document --verbose --no-user-install --bindir=${GEM_BIN_DIR}'
          cmd += ' -v 2.2.11'
          system(cmd)
          EOF
          $GEM_BIN_DIR/bundle install --without system_tests --retry 3
          export RSPEC_DEBUG=true
          $GEM_BIN_DIR/bundle exec rake litmus:acceptance:localhost
        chdir: '{{ ansible_user_dir }}/workspace'
        executable: /bin/bash
      become: yes
      environment: '{{ zuul | zuul_legacy_vars }}'

Make sure fixtures directory is cleared up
litmus: Make sure fixtures directory is cleared up

This is follow up of 3bb7ae978a5db7ae203470a84192f880d23943b5 .

We have seen several failures in the task to upload log files, and this
has been caused by circular symbolic links in spec/fixtures directory.
This change ensures the fixtures directory is cleared after gathering
logs into the logs directory, so that the directory is removed before
the upload task is executed.

Change-Id: I82cdc759ea03c2ad0c2537ec8951dc8a1f1c64ba
