mirror of
https://github.com/openshift/community.okd.git
synced 2026-03-26 19:03:14 +00:00
* Initialize OpenshiftGroupsSync attributes early The fail_json() method calls close_connection(), but this can fail when the python-ldap library is not installed as close_connection() gets called before the __ldap_connection attribute has been defined. * Use already defined virtualenv_command * Fix tests * Add changelog fragment
43 lines
1.1 KiB
YAML
43 lines
1.1 KiB
YAML
- block:
|
|
- name: Create temp directory
|
|
tempfile:
|
|
state: directory
|
|
register: test_dir
|
|
|
|
- set_fact:
|
|
test_dir: "{{ test_dir.path }}"
|
|
|
|
- set_fact:
|
|
venv: "{{ test_dir }}/virtualenv"
|
|
|
|
- pip:
|
|
name:
|
|
- kubernetes
|
|
virtualenv: "{{ venv }}"
|
|
virtualenv_command: "{{ virtualenv_command }}"
|
|
virtualenv_site_packages: false
|
|
|
|
- name: Load test configurations
|
|
set_fact:
|
|
configs: "{{ lookup('template', 'rfc2307/sync-config.j2') | from_yaml }}"
|
|
|
|
- name: Synchronize Groups without python-ldap
|
|
community.okd.openshift_adm_groups_sync:
|
|
config: "{{ configs.simple }}"
|
|
register: result
|
|
ignore_errors: true
|
|
vars:
|
|
ansible_python_interpreter: "{{ venv }}/bin/python"
|
|
|
|
- name: Check that module failed gracefully
|
|
assert:
|
|
that:
|
|
- '"Failed to import the required Python library (python-ldap)" in result.msg'
|
|
|
|
always:
|
|
- name: Remove temp directory
|
|
file:
|
|
path: "{{ test_dir }}"
|
|
state: absent
|
|
ignore_errors: true
|