Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.3.0: Sonar Fix #667

Merged
merged 11 commits into from
May 23, 2024
62 changes: 35 additions & 27 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1836,48 +1836,56 @@ releases:
release_date: '2024-04-30'
9.3.0:
changes:
release_summary: '- The ``ome_session`` module is added to allow you to create and delete the sessions on
OpenManage Enterprise and OpenManage Enterprise Modular.
release_summary: '- The ``ome_session`` module is added to allow you to
create and delete the sessions on OpenManage Enterprise and
OpenManage Enterprise Modular.

- Added support to use session ID for authentication of iDRAC, OpenManage Enterprise and OpenManage
Enterprise Modular modules.
- Added support to use session ID for authentication of iDRAC,
OpenManage Enterprise and OpenManage Enterprise Modular modules.

- Added time_to_wait option in ``idrac_storage_volume`` module.

- Added support for Python 3.12.'
major_changes:
- ome_session - This module allows you to create and delete the sessions on
- ome_session - This module allows you to create and delete the
sessions on OpenManage Enterprise and OpenManage Enterprise Modular.
- Added support to use session ID for authentication of iDRAC,
OpenManage Enterprise and OpenManage Enterprise Modular.
- Added support to use session ID for authentication of iDRAC, OpenManage Enterprise and OpenManage
Enterprise Modular.
minor_changes:
- Added time_to_wait option in ``idrac_storage_volume`` module.
- Added support for Python 3.12.
bugfixes:
- Resolved the issue in ``idrac_virtual_media`` module where the Authorization request header was included
in the request. (https://github.com/dell/dellemc-openmanage-ansible-modules/issues/612)
- Resolved the issue in ``idrac_certificates`` module where subject_alt_name parameter was only accepting
first item in list. (https://github.com/dell/dellemc-openmanage-ansible-modules/issues/584)
- Resolved the issue in ``ome_application_certificate`` module related to a padding error in generated CSR file.
- Resolved the issue in ``idrac_virtual_media`` module where the
Authorization request header was included in the request.
(https://github.com/dell/dellemc-openmanage-ansible-modules/issues/612)
- Resolved the issue in ``idrac_certificates`` module where
subject_alt_name parameter was only accepting first item in list.
(https://github.com/dell/dellemc-openmanage-ansible-modules/issues/584)
- Resolved the issue in ``ome_application_certificate`` module related
to a padding error in generated CSR file.
(https://github.com/dell/dellemc-openmanage-ansible-modules/issues/370)
known_issues:
- idrac_storage_volume - Issue(290766) - The module will report success instead of showing
failure for new virtual creation on the BOSS-N1 controller if a virtual disk is already
present on the same controller.
- idrac_diagnostics - Issue(285322) - This module doesn't support export of diagnostics
file to HTTP and HTTPS share via SOCKS proxy.
- idrac_firmware - Issue(279282) - This module does not support firmware update using
HTTP, HTTPS, and FTP shares with authentication on iDRAC8.
- ome_diagnostics - Issue(279193) - Export of SupportAssist collection logs to the
share location fails on OME version 4.0.0.
- ome_smart_fabric_uplink - Issue(186024) - The module supported by OpenManage
Enterprise Modular, however it does not allow the creation of multiple uplinks
of the same name. If an uplink is created using the same name as an existing
uplink, then the existing uplink is modified.
- idrac_storage_volume - Issue(290766) - The module will report success
instead of showing failure for new virtual creation on the BOSS-N1
controller if a virtual disk is already present on the same
controller.
- idrac_diagnostics - Issue(285322) - This module doesn't support
export of diagnostics file to HTTP and HTTPS share via SOCKS
proxy.
- idrac_firmware - Issue(279282) - This module does not support
firmware update using HTTP, HTTPS, and FTP shares with
authentication on iDRAC8.
- ome_diagnostics - Issue(279193) - Export of SupportAssist
collection logs to the share location fails on OME version 4.0.0.
- ome_smart_fabric_uplink - Issue(186024) - The module supported by
OpenManage Enterprise Modular, however it does not allow the
creation of multiple uplinks of the same name. If an uplink is
created using the same name as an existing uplink, then the existing
uplink is modified.
modules:
- description:
This module allows you to create and delete sessions on OpenManage Enterprise and
OpenManage Enterprise Modular.
This module allows you to create and delete sessions on OpenManage
Enterprise and OpenManage Enterprise Modular.
name: ome_session
namespace: ''
release_date: '2024-05-31'
18 changes: 7 additions & 11 deletions plugins/module_utils/session_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
from ansible.module_utils.urls import open_url
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible_collections.dellemc.openmanage.plugins.module_utils.utils import config_ipv6
from ansible.module_utils.urls import open_url, ConnectionError, SSLValidationError
from ansible.module_utils.six.moves.urllib.error import URLError, HTTPError
from ansible.module_utils.urls import open_url
from abc import ABC, abstractmethod

HEADER_TYPE = "application/json"
Expand Down Expand Up @@ -305,15 +304,12 @@ def invoke_request(self, uri, method, data=None, query_param=None, headers=None,
:return: The response data from the request.
:rtype: OpenURLResponse
"""
try:
url_kwargs = self._args_session(method, api_timeout, headers=headers, url_kwargs=url_kwargs)
if data and dump:
data = json.dumps(data)
url = self._build_url(uri, query_param=query_param)
resp = open_url(url, data=data, **url_kwargs)
resp_data = OpenURLResponse(resp)
except (HTTPError, URLError, SSLValidationError, ConnectionError) as err:
raise err
url_kwargs = self._args_session(method, api_timeout, headers=headers, url_kwargs=url_kwargs)
if data and dump:
data = json.dumps(data)
url = self._build_url(uri, query_param=query_param)
resp = open_url(url, data=data, **url_kwargs)
resp_data = OpenURLResponse(resp)
return resp_data

def _get_omam_ca_env(self):
Expand Down
11 changes: 4 additions & 7 deletions plugins/modules/ome_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,10 @@ def get_session_status(self, session_url, session_id):
int: The status code of the session status response. If an HTTPError occurs, the status
code of the error is returned.
"""
try:
session_status_response = self.instance.invoke_request(SESSION_URL, "GET")
sessions_data = session_status_response.json_data
session_ids = [session_id["@odata.id"].split("'")[1] for session_id in sessions_data["value"]]
session_status = session_id in session_ids
except HTTPError as err:
raise err
session_status_response = self.instance.invoke_request(SESSION_URL, "GET")
sessions_data = session_status_response.json_data
session_ids = [session_id["@odata.id"].split("'")[1] for session_id in sessions_data["value"]]
session_status = session_id in session_ids
return session_status

def create_session(self):
Expand Down
19 changes: 10 additions & 9 deletions roles/idrac_attributes/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ansible.builtin.import_role:
name: idrac_attributes
vars:
hostname: "randomHostname"

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: idrac_attributes)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: password)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: username)

Check warning on line 10 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: validate_certs)
username: "{{ lookup('env', 'IDRAC_USER') }}"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
validate_certs: false
Expand All @@ -18,14 +18,15 @@

- name: Asserting after performing operation with wrong hostname
ansible.builtin.assert:
that:
- '"<urlopen error [Errno -2] Name or service not known>" in idrac_attributes_out.msg'
that: >-
'"<urlopen error [Errno -2] Name or service not known>" in
idrac_attributes_out.msg'

- name: Perform update with wrong username
ansible.builtin.import_role:
name: idrac_attributes
vars:
hostname: "{{ lookup('env', 'IDRAC_IP') }}"

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.11, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.17)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, devel)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.16)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)

Check warning on line 29 in roles/idrac_attributes/molecule/default/converge.yml

View workflow job for this annotation

GitHub Actions / Ansible lint (3.10, stable-2.15)

var-naming[no-role-prefix]

Variables names from within roles should use idrac_attributes_ as a prefix. (vars: hostname)
username: "WrongUsername123"
password: "{{ lookup('env', 'IDRAC_PASSWORD') }}"
validate_certs: false
Expand Down Expand Up @@ -73,11 +74,9 @@

- name: Asserting after performing operation with invalid https_port
ansible.builtin.assert:
that:
- '"<urlopen error [Errno 111] Connection refused>" in idrac_attributes_out.msg'
# - ('"Connection refused" in idrac_attributes_out.msg')
# or
# ('"urlopen error timed out" in idrac_attributes_out.msg')
that: >-
'"<urlopen error [Errno 111] Connection refused>" in
idrac_attributes_out.msg'

- name: Perform update with invalid validate_certs
ansible.builtin.import_role:
Expand Down Expand Up @@ -116,8 +115,10 @@

- name: Asserting after performing operation with wrong ca_path
ansible.builtin.assert:
that:
- '"<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)>" in idrac_attributes_out.msg'
that: >-
'"<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
failed: self signed certificate (_ssl.c:1129)>" in
idrac_attributes_out.msg'

- name: Perform update with wrong manager_id
ansible.builtin.import_role:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,7 @@

- name: Asserting TC-115433 in normal mode
ansible.builtin.assert:
that: idrac_boot_out.msg == "The boot settings operation is triggered/submitted successfully."
that: >-
"The boot settings operation is triggered/submitted successfully." in
idrac_boot_out.msg
when: not ansible_check_mode
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@

- name: Asserting TC-115431 in normal mode
ansible.builtin.assert:
that: idrac_boot_out.msg == "The boot settings operation is triggered/submitted successfully."
that: >-
"The boot settings operation is triggered/submitted successfully." in
idrac_boot_out.msg
when: not ansible_check_mode and idrac_boot_out.changed

- name: Asserting TC-115431 in idempotence mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@

- name: Asserting TC-115432 in normal mode or idempotence mode
ansible.builtin.assert:
that:
- 'idrac_boot_out.msg == "The boot settings operation is triggered/submitted successfully." or "No changes found to be applied."'
that: >-
'idrac_boot_out.msg == "The boot settings operation is
triggered/submitted successfully." or "No changes found to be
applied."'
when: not ansible_check_mode and not idrac_boot_out.changed
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@

- name: Asserting TC-115429 in normal mode or idempotence mode
ansible.builtin.assert:
that:
- 'idrac_boot_out.msg == "The boot settings operation is triggered/submitted successfully." or "No changes found to be applied."'
that: >-
'idrac_boot_out.msg == "The boot settings operation is
triggered/submitted successfully." or "No changes found to
be applied."'
when: not ansible_check_mode and not idrac_boot_out.changed
6 changes: 3 additions & 3 deletions roles/idrac_certificate/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@

- name: Verify task status - Negative - invalid unreachable host
ansible.builtin.assert:
that:
- idrac_certificate_out.unreachable
- '"<urlopen error [Errno -2] Name or service not known>" in idrac_certificate_out.msg'
that: >-
'"<urlopen error [Errno -2] Name or service not known>" in
idrac_certificate_out.msg' and idrac_certificate_out.unreachable

- name: Negative - invalid idrac user
ansible.builtin.import_role:
Expand Down
1 change: 1 addition & 0 deletions roles/idrac_certificate/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
scenario:
test_sequence:
- dependency
Expand Down
13 changes: 9 additions & 4 deletions roles/idrac_gather_facts/molecule/passensor/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
tasks:
- name: Fetching Presence and Status Sensor info
ansible.builtin.uri:
url: "https://{{ hostname }}{{ api_system }}/Oem/Dell/DellPresenceAndStatusSensors"
url: "https://{{ hostname }}{{ api_system }}/Oem/
Dell/DellPresenceAndStatusSensors"
validate_certs: "{{ validate_certs }}"
ca_path: "{{ ca_path | default(omit) }}"
method: "{{ idrac_gather_facts_uri_method }}"
Expand All @@ -44,8 +45,10 @@

- name: Set presence and status sensor facts
ansible.builtin.set_fact:
api_response: "{{ passensor_result.json.Members | ansible.utils.remove_keys(target=['@odata.context',
api_response: "{{ passensor_result.json.Members |
ansible.utils.remove_keys(target=['@odata.context',
'@odata.id', '@odata.type', 'Assembly', 'Links']) }}"
when: passensor_result.json.Members is defined

- name: Gather Facts for the Presence and Status Sensor
ansible.builtin.include_role:
Expand All @@ -54,14 +57,16 @@
- name: Assert Presence and Status Sensor data
ansible.builtin.assert:
that:
- "((api_response | length == 0) and (presence_and_status_sensor | length == 0))"
- "((api_response | length == 0) and
(presence_and_status_sensor | length == 0))"
fail_msg: "The response from the role does not match"
success_msg: "The response from the role matches"
when: api_response | length == 0

- name: Check whether output differs
ansible.builtin.set_fact:
result_diff: "{{ presence_and_status_sensor | symmetric_difference(api_response) }}"
result_diff: "{{ presence_and_status_sensor |
symmetric_difference(api_response) }}"
when: api_response | length > 0

- name: Assert the differences in List
Expand Down
21 changes: 16 additions & 5 deletions roles/idrac_gather_facts/molecule/physicaldisk/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@

- name: Get all storage controller ids.
ansible.builtin.set_fact:
storage_ids_list: "{{ idrac_gather_facts_controllers_result.json.Members | map('dict2items') | flatten | map(attribute='value') }}"
storage_ids_list:
"{{ idrac_gather_facts_controllers_result.json.Members |
map('dict2items') | flatten | map(attribute='value') }}"
when: idrac_gather_facts_controllers_result.json.Members is defined

- name: Get physical disk information using API.
ansible.builtin.uri:
Expand All @@ -52,17 +55,25 @@
loop: "{{ storage_ids_list }}"
no_log: true
register: idrac_gather_facts_disk_result
when: storage_ids_list is defined

- name: Count the number of drives in drives_result.results
ansible.builtin.set_fact:
drives_count: "{{ idrac_gather_facts_disk_result.results | map(attribute='json.drives') | list | length }}"
drives_count: "{{ idrac_gather_facts_disk_result.results |
map(attribute='json.drives') | list | length }}"
when: idrac_gather_facts_disk_result.results is defined

- name: Set Physical Disk facts
ansible.builtin.set_fact:
api_response:
"{{ idrac_gather_facts_disk_result.results | selectattr('json', 'defined') | map(attribute='json') | selectattr('Drives', 'defined') |
map(attribute='Drives') | flatten | ansible.utils.remove_keys(target=['@odata.context', '@odata.id', '@odata.type',
'Actions', 'Assembly', 'Links', 'DellDriveSMARTAttributes', 'DellNVMeSMARTAttributes', '[email protected]']) }}"
"{{ idrac_gather_facts_disk_result.results |
selectattr('json', 'defined') | map(attribute='json') |
selectattr('Drives', 'defined') | map(attribute='Drives') |
flatten | ansible.utils.remove_keys(target=['@odata.context',
'@odata.id', '@odata.type', 'Actions', 'Assembly', 'Links',
'DellDriveSMARTAttributes', 'DellNVMeSMARTAttributes',
'[email protected]']) }}"
when: idrac_gather_facts_disk_result.results is defined

- name: Gather Facts for the Physical Disk component
ansible.builtin.include_role:
Expand Down
17 changes: 12 additions & 5 deletions roles/idrac_gather_facts/tests/asserts/mmetrics_assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

- name: Get Memory Metrics ids
ansible.builtin.set_fact:
memory_metrics_ids: "{{ response_memory.json.Members | selectattr('Metrics', 'defined') | map(attribute='Metrics') | flatten }}"
memory_metrics_ids: "{{ response_memory.json.Members |
selectattr('Metrics', 'defined') | map(attribute='Metrics') | flatten }}"
when: response_memory.json.Members is defined

- name: Get Memory Metrics information.
ansible.builtin.uri:
Expand All @@ -26,20 +28,25 @@

- name: Set Memory Metrics facts
ansible.builtin.set_fact:
api_memory_metrics: "{{ response_memory_metrics.results | selectattr('json', 'defined') | map(attribute='json') | flatten |
ansible.utils.remove_keys(target=['@odata.context', '@odata.type', '@odata.id', 'DataSourceUri']) }}"
api_memory_metrics: "{{ response_memory_metrics.results |
selectattr('json', 'defined') | map(attribute='json') |
flatten | ansible.utils.remove_keys(target=['@odata.context',
'@odata.type', '@odata.id', 'DataSourceUri']) }}"
when: response_memory_metrics.results is defined

- name: Assert memory metrics
ansible.builtin.assert:
that:
- "((api_memory_metrics | length == 0) and (memory_metrics | length == 0))"
- "((api_memory_metrics | length == 0) and
(memory_metrics | length == 0))"
fail_msg: "The response from the role does not match"
success_msg: "The response from the role matches"
when: api_memory_metrics| length == 0

- name: Check whether output differs
ansible.builtin.set_fact:
result_diff: "{{ memory_metrics | symmetric_difference(api_memory_metrics) }}"
result_diff: "{{ memory_metrics |
symmetric_difference(api_memory_metrics) }}"
when: api_memory_metrics| length > 0

- name: Assert the differences in List
Expand Down
14 changes: 10 additions & 4 deletions roles/idrac_gather_facts/tests/asserts/tmetrics_assert.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
- name: Get Thermal Metrics information.
ansible.builtin.uri:
url: "https://{{ hostname }}{{ api_chassis }}/ThermalSubsystem/ThermalMetrics"
url:
"https://{{ hostname }}{{ api_chassis }}/ThermalSubsystem/ThermalMetrics"
validate_certs: "{{ validate_certs }}"
method: "{{ idrac_gather_facts_uri_method }}"
user: "{{ username }}"
Expand All @@ -16,19 +17,24 @@
- name: Set Thermal Metrics facts
ansible.builtin.set_fact:
api_thermal_metrics: "{{ response_thermal_metrics.json |
ansible.utils.remove_keys(target=['@odata.context', '@odata.type', '@odata.id', 'DataSourceUri', '[email protected]']) }}"
ansible.utils.remove_keys(target=['@odata.context', '@odata.type',
'@odata.id', 'DataSourceUri',
'[email protected]']) }}"
when: response_thermal_metrics is defined

- name: Assert thermal metrics
ansible.builtin.assert:
that:
- "((api_thermal_metrics | length == 0) and (thermal_metrics | length == 0))"
- "((api_thermal_metrics | length == 0) and
(thermal_metrics | length == 0))"
fail_msg: "The response from the role does not match"
success_msg: "The response from the role matches"
when: api_thermal_metrics| length == 0

- name: Check whether output differs
ansible.builtin.set_fact:
result_diff: "{{ thermal_metrics | symmetric_difference(api_thermal_metrics) }}"
result_diff: "{{ thermal_metrics |
symmetric_difference(api_thermal_metrics) }}"
when: api_thermal_metrics | length > 0

- name: Assert the differences in List
Expand Down
Loading
Loading