Use correct python for -c invocations in tests. (#54577)

* Use correct python for -c invocations in tests.
* Only set releasever when available.
This commit is contained in:
Matt Clay 2019-03-29 01:19:51 -07:00 committed by GitHub
parent af2e5fc761
commit 8d96af2df5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 7 deletions

View file

@ -108,7 +108,7 @@
no_log: True no_log: True
- name: get ARN of calling user - name: get ARN of calling user
command: python -c 'import boto3,json; sts = boto3.client("sts"); print json.dumps(sts.get_caller_identity())' command: "{{ ansible_python_interpreter }} -c 'import boto3, json; sts = boto3.client(\"sts\"); print json.dumps(sts.get_caller_identity())'"
changed_when: False changed_when: False
environment: "{{ aws_environment }}" environment: "{{ aws_environment }}"
register: sts_get_caller_results register: sts_get_caller_results

View file

@ -32,7 +32,7 @@
yaml_none: ~ yaml_none: ~
tasks: tasks:
- name: check jinja version - name: check jinja version
shell: python -c 'import jinja2; print(jinja2.__version__)' command: "{{ ansible_python_interpreter }} -c 'import jinja2; print(jinja2.__version__)'"
register: jinja2_version register: jinja2_version
- name: make sure jinja is the right version - name: make sure jinja is the right version

View file

@ -226,7 +226,7 @@
- name: Run script with shebang omitted - name: Run script with shebang omitted
script: no_shebang.py script: no_shebang.py
args: args:
executable: python executable: "{{ ansible_python_interpreter }}"
register: _shebang_omitted_test register: _shebang_omitted_test
tags: tags:
- noshebang - noshebang

View file

@ -255,7 +255,7 @@
mode = oct(0o777 & ~umask) mode = oct(0o777 & ~umask)
print(str(mode).replace('o', '')) print(str(mode).replace('o', ''))
args: args:
executable: "{{ ansible_facts.python.executable }}" executable: "{{ ansible_python_interpreter }}"
register: user_login_defs_umask register: user_login_defs_umask
- name: validate that user home dir is created - name: validate that user home dir is created

View file

@ -15,7 +15,7 @@
# when: ansible_os_family == "Darwin" # when: ansible_os_family == "Darwin"
- name: Get lxml version - name: Get lxml version
command: python -c 'from lxml import etree; print(".".join(str(v) for v in etree.LXML_VERSION))' command: "{{ ansible_python_interpreter }} -c 'from lxml import etree; print(\".\".join(str(v) for v in etree.LXML_VERSION))'"
register: lxml_version register: lxml_version
- name: Set lxml capabilities as variables - name: Set lxml capabilities as variables

View file

@ -22,13 +22,15 @@
mode: 0755 mode: 0755
- name: get yum releasever - name: get yum releasever
shell: python -c 'import yum; yb = yum.YumBase(); print(yb.conf.yumvar["releasever"])' | tail -n 1 command: "{{ ansible_python_interpreter }} -c 'import yum; yb = yum.YumBase(); print(yb.conf.yumvar[\"releasever\"])'"
register: releasever register: releasever
ignore_errors: yes
- name: Populate directory - name: Populate directory
copy: copy:
content: "{{ releasever.stdout }}\n" content: "{{ releasever.stdout_lines[-1] }}\n"
dest: "/{{ yumroot.stdout }}/etc/yum/vars/releasever" dest: "/{{ yumroot.stdout }}/etc/yum/vars/releasever"
when: releasever is successful
# This will drag in > 200 MB. # This will drag in > 200 MB.
- name: attempt installroot - name: attempt installroot