File: python_path.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 (154 lines) | stat: -rw-r--r-- 4,659 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# related: issue #511, #536
# Each case is followed by mitogen_via= case to test hostvars method.


# If ansible_python_interpreter isn't set, Ansible 2.8+ tries to connect and
# detect the interpreter. If that fails (e.g. connection timeout)
# - Ansible 2.8 - 9 (ansible-core 2.8 - 2.16) assumes "/usr/bin/python"
# - Ansible 10+ (ansible-core 2.17+) marks the target unreachable
- name: integration/transport_config/python_path.yml
  hosts: tc-python-path-unset
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - meta: end_play
    when:
      - ansible_version_major_minor is version('2.17', '>=', strict=True)
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["{{out.discovered_interpreter}}"]
  tags:
    - mitogen_only

- name: tc-python-path-hostvar via tc-python-path-unset
  hosts: tc-python-path-hostvar
  vars: {mitogen_via: tc-python-path-unset}
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - meta: end_play
    when:
      - ansible_version_major_minor is version('2.17', '>=', strict=True)
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["{{out.discovered_interpreter}}"]
  - assert_equal:
      left: out.result[1].kwargs.python_path
      right: ["/hostvar/path/to/python"]
  tags:
    - mitogen_only


# Non-localhost with explicit ansible_python_interpreter
- hosts: tc-python-path-hostvar
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: [/hostvar/path/to/python]
  tags:
    - mitogen_only

- name: tc-python-path-unset via tc-python-path-hostvar
  hosts: tc-python-path-unset
  vars: {mitogen_via: tc-python-path-hostvar}
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - meta: end_play
    when:
      - ansible_version_major_minor is version('2.17', '>=', strict=True)
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["/hostvar/path/to/python"]
  - assert_equal:
      left: out.result[1].kwargs.python_path
      right: ["{{out.discovered_interpreter}}"]
  tags:
    - mitogen_only


# Implicit localhost gets ansible_python_interpreter=virtualenv interpreter
- hosts: localhost
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["{{ansible_playbook_python}}"]
  tags:
    - mitogen_only

- name: tc-python-path-unset via localhost
  hosts: tc-python-path-unset
  vars: {mitogen_via: localhost}
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - meta: end_play
    when:
      - ansible_version_major_minor is version('2.17', '>=', strict=True)
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["{{ansible_playbook_python}}"]
  - assert_equal:
      left: out.result[1].kwargs.python_path
      right: ["{{out.discovered_interpreter}}"]
  tags:
    - mitogen_only


# explicit local connections get the same treatment as everything else.
- hosts: tc-python-path-local-unset
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["{{out.discovered_interpreter}}"]
  tags:
    - mitogen_only


- name: localhost via tc-python-path-local-unset
  hosts: localhost
  vars: {mitogen_via: tc-python-path-local-unset}
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["{{out.discovered_interpreter}}"]
  - assert_equal:
      left: out.result[1].kwargs.python_path
      right: ["{{ansible_playbook_python}}"]
  tags:
    - mitogen_only


# explicit local connection with explicit interpreter
- hosts: tc-python-path-local-explicit
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["/a/b/c"]
  tags:
    - mitogen_only

- name: localhost via tc-python-path-local-explicit
  hosts: localhost
  vars: {mitogen_via: tc-python-path-local-explicit}
  tasks:
  - include_tasks: ../_mitogen_only.yml
  - {mitogen_get_stack: {}, register: out}
  - assert_equal:
      left: out.result[0].kwargs.python_path
      right: ["/a/b/c"]
  - assert_equal:
      left: out.result[1].kwargs.python_path
      right: ["{{ansible_playbook_python}}"]
  tags:
    - mitogen_only