Debian Codegraph @

ansible_collections/dellemc/openmanage/roles/idrac_gather_facts/tests/asserts/license_assert.yml

raw symbols SCIP
1 - name: Get license information.
2 ansible.builtin.uri:
3 url: "https://{{ hostname }}/redfish/v1/LicenseService/Licenses/{{ license_data.Id }}"
4 validate_certs: "{{ validate_certs }}"
5 ca_path: "{{ ca_path | default(omit) }}"
6 method: "{{ idrac_gather_facts_uri_method }}"
7 user: "{{ username }}"
8 password: "{{ password }}"
9 headers: "{{ idrac_gather_facts_uri_headers }}"
10 body_format: "{{ idrac_gather_facts_uri_body_format }}"
11 status_code: "{{ idrac_gather_facts_uri_status_code }}"
12 return_content: "{{ idrac_gather_facts_uri_return_content }}"
13 register: license_result
14 no_log: false
15
16 - name: Set license facts
17 ansible.builtin.set_fact:
18 api_response: "{{ license_result.json | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type']) }}"
19
20 - name: Set the keys diff
21 ansible.builtin.set_fact:
22 diff_keys: "{{ license_data.keys() | list | symmetric_difference((api_response.keys() | list)) }}"
23
24 - name: Set a diff of dict
25 ansible.builtin.set_fact:
26 diff_data: "{{ diff_data | combine({item: license_data[item]}) }}"
27 loop: "{{ license_data.keys() }}"
28 when:
29 - diff_keys | length == 0
30 - license_data[item] != api_response[item]
31 - item not in exclude_keys
32
33 - name: Assert the difference in Keys
34 ansible.builtin.assert:
35 that:
36 - "{{ (diff_keys | length) == 0 }}"
37 - "{{ (diff_data | length) == 0 }}"
38 fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"
39 success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }} Diff Data : {{ diff_data }}"