fixed incorrect "No command provided!" in ipmitool

The check for "No command provided!" in ipmitool output was failing due
to the output being a list with newline characters. This commit adjusts
the check to:
- Confirm the output list is not empty.
- Use `strip()` to compare the first list element against "No command provided!".
- DOC109 there are no type hints in the docstring arg list
- DOC110 not all args in the docstring arg list have type hints
- DOC105 type hints in these args do not match: ssh_connection

Change-Id: Ifee7b85042863c83dd4c825577d3ee342e6d3ef1
Signed-off-by: Abhishek jaiswal <abhishek.jaiswal@windriver.com>
This commit is contained in:
Abhishek jaiswal
2025-03-21 07:03:21 -04:00
parent 75ecc0927f
commit 7db1cdf885

View File

@@ -8,10 +8,10 @@ class IsIPMIToolKeywords(BaseKeyword):
"""
def __init__(self, ssh_connection: SSHConnection):
"""
Constructor
"""Constructor
Args:
ssh_connection:
ssh_connection (SSHConnection): SSH connection object.
"""
self.ssh_connection = ssh_connection
@@ -24,9 +24,8 @@ class IsIPMIToolKeywords(BaseKeyword):
Returns: True if the ipmi tool is available, false otherwise.
"""
output = self.ssh_connection.send_as_sudo('ipmitool')
if "No command provided!" in output:
output = self.ssh_connection.send_as_sudo("ipmitool")
if len(output) > 1 and output[0].strip() == "No command provided!":
return True
# Output is either "ipmitool: command not found" or, if sudo isn't used: