Debian Codegraph @

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

raw symbols SCIP
1 - name: Get Power information.
2 ansible.builtin.uri:
3 url: "https://{{ hostname }}{{ api_chassis }}//PowerSubsystem/PowerSupplies/{{ psu_ids[index] }}/Metrics"
4 validate_certs: "{{ validate_certs }}"
5 method: "{{ idrac_gather_facts_uri_method }}"
6 user: "{{ username }}"
7 password: "{{ password }}"
8 headers: "{{ idrac_gather_facts_uri_headers }}"
9 body_format: "{{ idrac_gather_facts_uri_body_format }}"
10 status_code: "{{ idrac_gather_facts_uri_status_code }}"
11 return_content: "{{ idrac_gather_facts_uri_return_content }}"
12 register: response_power_metrics
13 no_log: true
14
15 - name: Set Power Supply Metrics facts
16 ansible.builtin.set_fact:
17 api_power_metrics: "{{ response_power_metrics.json |
18 ansible.utils.remove_keys(target=['@odata.context',
19 '@odata.type', '@odata.id', '@odata.etag', 'DataSourceUri']) }}"
20
21 - name: Set the keys diff
22 ansible.builtin.set_fact:
23 diff_keys: "{{ power_data.keys() | list | symmetric_difference((api_power_metrics.keys() | list)) }}"
24
25 - name: Assert the difference in Keys
26 ansible.builtin.assert:
27 that:
28 - (diff_keys | length) == 0
29 fail_msg: "The response from the role does not match | Diff Keys : {{ diff_keys }}"
30 success_msg: "The response from the role matches | Diff Keys : {{ diff_keys }}"