summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/okd/molecule/default/roles/openshift_adm_groups/tasks/python-ldap-not-installed.yml
blob: a79af51c2c7a33267a87165bf699d20108577802 (plain)
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
- 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