Debian Codegraph @

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

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