- hosts: all
  name: Autoconverted job legacy-mistral-devstack-dsvm-non-apache from old job gate-mistral-devstack-dsvm-non-apache-ubuntu-xenial-nv
  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-infra/devstack-gate
              dest: devstack-gate
          EOF
          /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
              git://git.openstack.org \
              openstack-infra/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

          if [ "mistral" = "python-mistralclient" ] ; then
              # This puts the repo in PROJECTS
              export DEVSTACK_PROJECT_FROM_GIT="python-mistralclient"
          else
              export PROJECTS="openstack/python-mistralclient $PROJECTS"
          fi

          export ENABLED_SERVICES=heat,h-api,h-api-cfn,h-api-cw,h-eng,tempest
          export PROJECTS="openstack/heat $PROJECTS"
          export PROJECTS="openstack/mistral $PROJECTS"
          export PROJECTS="openstack/mistral-dashboard $PROJECTS"
          export DEVSTACK_LOCAL_CONFIG="enable_plugin mistral https://git.openstack.org/openstack/mistral"
          export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin heat git://git.openstack.org/openstack/heat"

          if [ "-non-apache" == "-non-apache" ]; then
            export DEVSTACK_LOCAL_CONFIG+=$'\n'"MISTRAL_USE_MOD_WSGI=False"
          fi

          if [ "-non-apache" == "-kombu" ]; then
            export DEVSTACK_LOCAL_CONFIG+=$'\n'"MISTRAL_RPC_IMPLEMENTATION=kombu"
          fi

          function post_test_hook {
              cd /opt/stack/new/mistral/functionaltests
              ./post_test_hook.sh
          }
          export -f post_test_hook

          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 }}'