mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-06-10 10:36:16 +00:00
The `older_openshift_fail.yml` test playbook fails with Python 3.7 because the old `kubernetes.client.apis.admissionregistration_api` module uses the new `async` keyword as a function parameter name. From: https://docs.python.org/3/whatsnew/3.7.html Backwards incompatible syntax changes: `async` and `await` are now reserved keywords. In this case, we get a `SyntaxError` exception instead of the expected `Failed to import the required Python library (openshift >= 0.7.2)`.
109 lines
2.4 KiB
YAML
109 lines
2.4 KiB
YAML
---
|
|
- include_tasks: setup_remote_tmp_dir.yml
|
|
|
|
- set_fact:
|
|
virtualenv: "{{ remote_tmp_dir }}/virtualenv"
|
|
virtualenv_command: "{{ ansible_python_interpreter }} -m virtualenv"
|
|
|
|
- set_fact:
|
|
virtualenv_interpreter: "{{ virtualenv }}/bin/python"
|
|
|
|
- pip:
|
|
name: virtualenv
|
|
|
|
# Test graceful failure for missing kubernetes-validate
|
|
|
|
- pip:
|
|
name:
|
|
- openshift>=0.9.2
|
|
- coverage
|
|
virtualenv: "{{ virtualenv }}"
|
|
virtualenv_command: "{{ virtualenv_command }}"
|
|
virtualenv_site_packages: no
|
|
|
|
- include_tasks: validate_not_installed.yml
|
|
vars:
|
|
ansible_python_interpreter: "{{ virtualenv_interpreter }}"
|
|
|
|
- file:
|
|
path: "{{ virtualenv }}"
|
|
state: absent
|
|
no_log: yes
|
|
|
|
# Test validate with kubernetes-validate
|
|
|
|
- pip:
|
|
name:
|
|
- kubernetes-validate==1.12.0
|
|
- openshift>=0.9.2
|
|
- coverage
|
|
virtualenv: "{{ virtualenv }}"
|
|
virtualenv_command: "{{ virtualenv_command }}"
|
|
virtualenv_site_packages: no
|
|
|
|
- include_tasks: validate_installed.yml
|
|
vars:
|
|
ansible_python_interpreter: "{{ virtualenv_interpreter }}"
|
|
playbook_namespace: ansible-test-k8s-validate
|
|
|
|
- file:
|
|
path: "{{ virtualenv }}"
|
|
state: absent
|
|
no_log: yes
|
|
|
|
# Test new config getter (kubernetes==12.0.0)
|
|
|
|
- pip:
|
|
name:
|
|
- kubernetes==12.0.0
|
|
- openshift>=0.9.2
|
|
- coverage
|
|
virtualenv: "{{ virtualenv }}"
|
|
virtualenv_command: "{{ virtualenv_command }}"
|
|
virtualenv_site_packages: no
|
|
|
|
- include_tasks: new_config_getter.yml
|
|
vars:
|
|
ansible_python_interpreter: "{{ virtualenv_interpreter }}"
|
|
playbook_namespace: ansible-test-k8s-config-getter
|
|
|
|
- file:
|
|
path: "{{ virtualenv }}"
|
|
state: absent
|
|
no_log: yes
|
|
|
|
# Test graceful failure for older versions of openshift
|
|
- name: Get the Python version
|
|
setup:
|
|
filter: ansible_python_version
|
|
|
|
- when: ansible_python_version is version('3.7', '<')
|
|
block:
|
|
- pip:
|
|
name:
|
|
- openshift==0.6.0
|
|
- kubernetes==6.0.0
|
|
- coverage
|
|
virtualenv: "{{ virtualenv }}"
|
|
virtualenv_command: "{{ virtualenv_command }}"
|
|
virtualenv_site_packages: no
|
|
|
|
- include_tasks: older_openshift_fail.yml
|
|
vars:
|
|
ansible_python_interpreter: "{{ virtualenv_interpreter }}"
|
|
playbook_namespace: ansible-test-k8s-older-openshift
|
|
|
|
|
|
- file:
|
|
path: "{{ virtualenv }}"
|
|
state: absent
|
|
no_log: yes
|
|
|
|
# Test openshift
|
|
|
|
- debug:
|
|
var: k8s_openshift
|
|
|
|
- include: openshift.yml
|
|
when: k8s_openshift | bool
|