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
- 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
environment: "{{ aws_environment }}"
register: sts_get_caller_results

View file

@ -32,7 +32,7 @@
yaml_none: ~
tasks:
- 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
- name: make sure jinja is the right version

View file

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

View file

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

View file

@ -15,7 +15,7 @@
# when: ansible_os_family == "Darwin"
- 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
- name: Set lxml capabilities as variables

View file

@ -22,13 +22,15 @@
mode: 0755
- 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
ignore_errors: yes
- name: Populate directory
copy:
content: "{{ releasever.stdout }}\n"
content: "{{ releasever.stdout_lines[-1] }}\n"
dest: "/{{ yumroot.stdout }}/etc/yum/vars/releasever"
when: releasever is successful
# This will drag in > 200 MB.
- name: attempt installroot