Debian Codegraph @

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

raw symbols SCIP
1 ---
2 - name: Get Thermal Metrics information.
3 ansible.builtin.uri:
4 url:
5 "https://{{ hostname }}{{ api_chassis }}/ThermalSubsystem/ThermalMetrics"
6 validate_certs: "{{ validate_certs }}"
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: response_thermal_metrics
15 no_log: true
16
17 - name: Set Thermal Metrics facts
18 ansible.builtin.set_fact:
19 api_thermal_metrics: "{{ response_thermal_metrics.json |
20 ansible.utils.remove_keys(target=['@odata.context', '@odata.type',
21 '@odata.id', '@odata.etag', 'DataSourceUri',
22 '[email protected]']) }}"
23 when: response_thermal_metrics is defined
24
25 - name: Assert thermal metrics
26 ansible.builtin.assert:
27 that:
28 - "((api_thermal_metrics | length == 0) and
29 (thermal_metrics | length == 0))"
30 fail_msg: "The response from the role does not match"
31 success_msg: "The response from the role matches"
32 when: api_thermal_metrics| length == 0
33
34 - name: Check whether output differs
35 ansible.builtin.set_fact:
36 result_diff: "{{ thermal_metrics |
37 symmetric_difference(api_thermal_metrics) }}"
38 when: thermal_result.status == 200 and api_thermal_metrics | length > 0
39
40 - name: Assert the differences in List
41 ansible.builtin.assert:
42 fail_msg: "The response from the role does not match"
43 success_msg: "The response from the role matches"
44 that:
45 - (result_diff | length) == 0
46 when: thermal_result.status == 200 and api_thermal_metrics | length > 0