- hosts: all
  name: Autoconverted job legacy-periodic-tempest-dsvm-networking-midonet-aio-v2-full-ocata
    from old job periodic-tempest-dsvm-networking-midonet-aio-v2-full-ubuntu-xenial-ocata
  tasks:

    - name: Ensure legacy workspace directory
      file:
        path: '{{ ansible_user_dir }}/workspace'
        state: directory

    - shell:
        cmd: |
          set -e
          set -x
          cat > clonemap.yaml << EOF
          clonemap:
            - name: openstack/devstack-gate
              dest: devstack-gate
          EOF
          /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
              https://opendev.org \
              openstack/devstack-gate
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: |
          set -e
          set -x
          export PYTHONUNBUFFERED=true
          export DEVSTACK_GATE_NEUTRON=1
          export DEVSTACK_GATE_TEMPEST=1
          export BRANCH_OVERRIDE=stable/ocata
          if [ "$BRANCH_OVERRIDE" != "default" ] ; then
              export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
          fi
          export DEVSTACK_GATE_TOPOLOGY=aio

          # Because we are testing a non standard project, add
          # our project repository. This makes zuul do the right
          # reference magic for testing changes.
          export PROJECTS="openstack/networking-midonet $PROJECTS"
          export PROJECTS="openstack/neutron-dynamic-routing $PROJECTS"
          export PROJECTS="openstack/networking-l2gw $PROJECTS"
          export PROJECTS="x/tap-as-a-service $PROJECTS"

          function gate_hook {
               bash -xe $BASE/new/networking-midonet/devstack/ci/gate_hook.sh v2-full
          }
          export -f gate_hook
          export DEVSTACK_GATE_SETTINGS=/opt/stack/new/networking-midonet/devstack/devstackgaterc

          cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
          ./safe-devstack-vm-gate-wrap.sh
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'