File: complex_args.yml

package info (click to toggle)
python-mitogen 0.3.36-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,708 kB
  • sloc: python: 24,457; sh: 198; makefile: 74; perl: 19; ansic: 18
file content (58 lines) | stat: -rw-r--r-- 2,170 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# checks complex ansible_python_interpreter values as well as jinja in the ansible_python_interpreter value
---

- name: integration/interpreter_discovery/complex_args.yml
  hosts: test-targets
  gather_facts: true
  environment:
      http_proxy: "{{ lookup('env', 'http_proxy') | default(omit) }}"
      https_proxy: "{{ lookup('env', 'https_proxy') | default(omit) }}"
      no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
  tasks:
    # Ansible releases after June 2024 quote ansible_python_interpreter
    # https://github.com/ansible/ansible/pull/83365
    - meta: end_play
      when:
        - not is_mitogen
        - ansible_version_major_minor_patch is version('2.17.1', '>=', strict=True)

    - name: create temp file to source
      file:
        path: /tmp/fake
        state: touch

    # TODO: this works in Mac 10.15 because sh defaults to bash
    # but due to Mac SIP we can't write to /bin so we can't change
    # /bin/sh to point to /bin/bash
    # Mac 10.15 is failing python interpreter discovery tests from ansible 2.8.8
    # because Mac doesn't make default python /usr/bin/python anymore
    # so for now, can't use `source` since it's a bash builtin
    # - name: set python using sourced file
    #   set_fact:
    #     special_python: source /tmp/fake && python
    - name: set python using sourced file
      set_fact:
        special_python: "source /tmp/fake || true && {{ ansible_facts.python.executable }}"

    - name: run get_url with specially-sourced python
      uri:
        # Plain http for wider Ansible & Python version compatibility
        url: http://www.gstatic.com/generate_204
        status_code: [204]
      vars:
        ansible_python_interpreter: "{{ special_python }}"

    - name: run get_url with specially-sourced python including jinja
      uri:
        # Plain http for wider Ansible & Python version compatibility
        url: http://www.gstatic.com/generate_204
        status_code: [204]
      vars:
        ansible_python_interpreter: >
          {% if "1" == "1" %}
            {{ special_python }}
          {% else %}
            python
          {% endif %}
  tags:
    - complex_args