From 3256fa2ce9d99ae4b94ab202f5c36339e0159cc8 Mon Sep 17 00:00:00 2001 From: mrichomme Date: Mon, 9 Mar 2020 11:23:35 +0100 Subject: Remove trailing spaces in robot scripts warning raised when using robotframework-linter Issue-ID: INT-1478 Signed-off-by: mrichomme Change-Id: I8eb97ef9e3651c0d8f9de6647ebc917d1addf9d0 Signed-off-by: mrichomme --- robot/resources/ssh/processes.robot | 45 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'robot/resources/ssh/processes.robot') diff --git a/robot/resources/ssh/processes.robot b/robot/resources/ssh/processes.robot index 8574f137..65960e4f 100644 --- a/robot/resources/ssh/processes.robot +++ b/robot/resources/ssh/processes.robot @@ -10,64 +10,63 @@ Library Collections *** Keywords *** Get Processes - [Documentation] Returns all of the processes on the currently connected host - ${output}= Execute Command ps -ef + [Documentation] Returns all of the processes on the currently connected host + ${output}= Execute Command ps -ef ${map}= Create Process Map ${output} [Return] ${map} Grep Processes - [Documentation] Return the list of processes matching the passed regex - [Arguments] ${pattern} - ${output}= Execute Command ps -ef|grep "${pattern}"|grep -v grep + [Documentation] Return the list of processes matching the passed regex + [Arguments] ${pattern} + ${output}= Execute Command ps -ef|grep "${pattern}"|grep -v grep ${map}= Create Process Map ${output} [Return] ${map} Create Process Map [Documentation] Extract process pids and process names from ps -ef output - [Arguments] ${input} + [Arguments] ${input} @{lines}= Split To Lines ${input} ${map}= Create Dictionary :FOR ${line} IN @{lines} - \ @{parts}= Split String ${line} max_split=7 + \ @{parts}= Split String ${line} max_split=7 \ ${pid}= Catenate ${parts[1]} \ ${name}= Catenate ${parts[7]} - \ Set To Dictionary ${map} ${pid}=${name} + \ Set To Dictionary ${map} ${pid}=${name} [Return] ${map} - - + + Wait for Process on Host - [Documentation] Wait for the passed process name (regular expression) to be running on the passed host + [Documentation] Wait for the passed process name (regular expression) to be running on the passed host [Arguments] ${process_name} ${host} ${timeout}=1200s ${map}= Wait Until Keyword Succeeds ${timeout} 10 sec Is Process On Host ${process_name} ${host} [Return] ${map} Pkill Process on Host - [Documentation] Kill the named process(es). Process name must match exactly + [Documentation] Kill the named process(es). Process name must match exactly [Arguments] ${process_name} ${host} ${timeout}=600s Switch Connection ${host} - ${output}= Execute Command pkill -9 -e -f ${process_name} + ${output}= Execute Command pkill -9 -e -f ${process_name} [Return] ${output} Is Process on Host - [Documentation] Look for the passed process name (regex) to be running on the passed host. Process name can include regex. - [Arguments] ${process_name} ${host} + [Documentation] Look for the passed process name (regex) to be running on the passed host. Process name can include regex. + [Arguments] ${process_name} ${host} Switch Connection ${host} ${pass} ${map}= Run Keyword and Ignore Error Grep Processes ${process_name} @{pids}= Get Dictionary Keys ${map} ${foundpid}= Catenate "" :FOR ${pid} IN @{pids} \ ${process_cmd}= Get From Dictionary ${map} ${pid} - \ ${status} ${value}= Run Keyword And Ignore Error Should Match Regexp ${process_cmd} ${process_name} + \ ${status} ${value}= Run Keyword And Ignore Error Should Match Regexp ${process_cmd} ${process_name} \ ${foundpid}= Set Variable If '${status}' == 'PASS' ${pid} "" - Should Not Be Equal ${foundpid} "" + Should Not Be Equal ${foundpid} "" [Return] ${map}[${foundpid}] - - + + Get Process List on Host - [Documentation] Gets the list of all processes on the passed host - [Arguments] ${host} + [Documentation] Gets the list of all processes on the passed host + [Arguments] ${host} Switch Connection ${host} - ${map}= Get Processes + ${map}= Get Processes [Return] ${map} - \ No newline at end of file -- cgit 1.2.3-korg