File: issue_152__local_action_wrong_interpreter.yml

package info (click to toggle)
python-mitogen 0.3.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,456 kB
  • sloc: python: 22,134; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (39 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# issue #152 (b): local connections were not receiving
# ansible_python_interpreter treatment, breaking virtualenvs. Verify this is
# fixed by writing out a wrapper script that sets an environment variable we
# can test for.

- name: regression/issue_152__local_action_wrong_interpreter.yml
  hosts: test-targets[0]
  connection: local
  tasks:
    - name: Create /tmp/issue_152_interpreter.sh
      vars:
        ansible_python_interpreter: "{{ ansible_playbook_python }}"
      copy:
        dest: /tmp/issue_152_interpreter.sh
        mode: u+x
        content: |
          #!/bin/bash
          export CUSTOM_INTERPRETER=1
          exec python "$@"

    - custom_python_detect_environment:
      vars:
        ansible_python_interpreter: /tmp/issue_152_interpreter.sh
      register: out

    - assert:
        that:
          - out.env.CUSTOM_INTERPRETER == "1"
        fail_msg: |
          out={{ out }}

    - name: Cleanup /tmp/issue_152_interpreter.sh
      vars:
        ansible_python_interpreter: "{{ ansible_playbook_python }}"
      file:
        path: /tmp/issue_152_interpreter.sh
        state: absent
  tags:
    - issue_152