- ssh = SSH()
- ssh.connect(node)
-
- retval = None
- for i in range(3):
- logger.trace(f"Try {i}: Get {process} PID")
- ret_code, stdout, stderr = ssh.exec_command(f"pidof {process}")
-
- if int(ret_code):
- raise RuntimeError(
- f"Not possible to get PID of {process} process on node: "
- f"{node[u'host']}\n {stdout + stderr}"
- )
-
- pid_list = stdout.split()
- if len(pid_list) == 1:
- return [int(stdout)]
- if not pid_list:
- logger.debug(f"No {process} PID found on node {node[u'host']}")
- continue
- logger.debug(f"More than one {process} PID found " \
- f"on node {node[u'host']}")
- retval = [int(pid) for pid in pid_list]
-
- return retval
+ cmd = f"pidof {process}"
+ stdout, _ = exec_cmd_no_error(
+ node, cmd, retries=retries,
+ message=f"No {process} PID found on node {node[u'host']}")
+ pid_list = stdout.split()
+ return [int(pid) for pid in pid_list]