problem configuring remote process variables

110 views
Skip to first unread message

tgh

unread,
Feb 26, 2016, 1:51:36 PM2/26/16
to robotframework-users
I have a remote server and I use it for process keywords as:
- Start Process
- Terminate Process
- Get Process Result

It works fine if I only use with command and arguments, but when I try to configure something as stdout, or cwd, it doesn't apply it to the process, and pass it as command argument.

In local (with no remote server), it works fine, in remote it doesn't. This is what I have:

Local:
${id}= | Start Process | echo | hello | world
Terminate Process | ${id}
${stdout}= | Get Process Result | ${id} | stdout=true
Log | ${stdout}
hello world  <- Its OK

Remote:
${id}= | KEYWORD FOR REMOTE SERVER | IP | Start Process | echo | hello | world
KEYWORD FOR REMOTE SERVER | IP | Terminate Process | ${id}
${stdout}= | KEYWORD FOR REMOTE SERVER | IP | Get Process Result | ${id} | stdout=true
Log | ${stdout}
hello world  <---- It was executed correctly in remote server

Local:
${id}= | Start Process | echo | hello | world | stdout=tmp.txt
Terminate Process | ${id}
${stdout}= | Get Process Result | ${id} | stdout=true
Log | ${stdout}
hello world  <- Its OK inside the tmp.txt file and the log

Remote:
${id}= | KEYWORD FOR REMOTE SERVER | IP | Start Process | echo | hello | world | stdout=tmp.txt
KEYWORD FOR REMOTE SERVER | IP | Terminate Process | ${id}
${stdout}= | KEYWORD FOR REMOTE SERVER | IP | Get Process Result | ${id} | stdout=true
Log | ${stdout}
hello world stdout=tmp.txt  <---- Passes the configuration argument as argument to the command and doesn't create the tmp.txt file

Any ideas? Thank you so much


Hélio Guilherme

unread,
Feb 26, 2016, 5:34:38 PM2/26/16
to robotframework-users
I can only think in escaping the equal sign (but I did not tried with these keywords).
Remote:
${id}= | KEYWORD FOR REMOTE SERVER | IP | Start Process | echo | hello | world | stdout=tmp.txt
So you would have:
${id}= | KEYWORD FOR REMOTE SERVER | IP | Start Process | echo | hello | world | stdout\=tmp.txt 

And other option, where you have "| hello | world |" (two arguments), to use a variable with that content.

Maybe someone knows better options.

tgh

unread,
Feb 29, 2016, 4:37:29 AM2/29/16
to robotframework-users
I tried to put only echo (without parameters), but it still get stdout=tmp.txt as argument to the command.
I tried to put the escape char to the equal sign (\=), and it has the same result.
It works fine in local execution, but not with remote server...
I'm using robotframework 2.8.7 in both sides...

Hélio Guilherme

unread,
Feb 29, 2016, 5:06:15 AM2/29/16
to robotframework-users
I'm using robotframework 2.8.7 in both sides...

Would you have the chance to prepare a virtuaenv and try with RF 2.9.2 or 3.0? I think that those versions touched that area of passing arguments. I would do that test if possible.

 

tgh

unread,
Feb 29, 2016, 6:56:51 AM2/29/16
to robotframework-users
I just tried with RF 3.0 and I've got the same result, stdout=tmp.txt is passed to the process as an argument instead to use it as a configuration

Hélio Guilherme

unread,
Feb 29, 2016, 1:32:24 PM2/29/16
to robotframework-users

I think that the problem is that the command "echo" is not allowing the redirection. But the question here is that those Process keywords are being executed in your local (the caller) machine. If you change the command from echo to a command that only exists in the remote machine (it will not find), if you change to other command you could see your local file with its output (maybe just not for "echo").

From the example test file, this will work (I have that path in my server) the keyword only exists in server.
${id}=    Start Process    zypper    info kernel-desktop    stdout=/tmp/myclientfile.txt

And this test from your example would fail (because calling machine is Fedora and server OpenSUSE):
${id}=    Start Process    zypper    info kernel-desktop    stdout=/tmp/myclientfile.txt

Starting process:
zypper
"info kernel-desktop"
20160229 18:28:13.429 :  FAIL : OSError: [Errno 2] No such file or directory



Have you considered SSHLibrary?

Hélio Guilherme

unread,
Feb 29, 2016, 1:34:31 PM2/29/16
to robotframework-users
Sorry copy paste error, now goes corrected.


segunda-feira, 29 de Fevereiro de 2016 às 18:32:24 UTC, Hélio Guilherme escreveu:

I think that the problem is that the command "echo" is not allowing the redirection. But the question here is that those Process keywords are being executed in your local (the caller) machine. If you change the command from echo to a command that only exists in the remote machine (it will not find), if you change to other command you could see your local file with its output (maybe just not for "echo").

From the example test file, this will work (I have that path in my server) the keyword only exists in server.
${items1} =    Count Items In Directory    /home/robot

tgh

unread,
Feb 29, 2016, 2:58:43 PM2/29/16
to robotframework-users
I'm sure that I was running in remote machine because I used pwd command and the path only exists on remote machine, I change to echo command to be sure whats going on with stdout=tmp.txt argument, because using it with pwd I get an error about an argument, but I'm not sure if it is the stdout=tmp.txt value, changing to echo I can see that this argument is passed to command instead to configuring it...

Pekka Klärck

unread,
Mar 1, 2016, 1:22:45 PM3/1/16
to tomas.ga...@gmail.com, robotframework-users
Hello,

It seems that the remote server you use doesn't report keyword
signature to Robot correctly. Are you using the standard Python remote
server or something else? What version?

Cheers,
.peke
> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to robotframework-u...@googlegroups.com.
> To post to this group, send email to robotframe...@googlegroups.com.
> Visit this group at https://groups.google.com/group/robotframework-users.
> For more options, visit https://groups.google.com/d/optout.



--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

tgh

unread,
Mar 1, 2016, 2:54:04 PM3/1/16
to robotframework-users, tomas.ga...@gmail.com
I had an python library to encapsulate the remote client, but to avoid any kind of problem with that I just clean the code to the most basic I can, I still have the problem, but my code is the following:

In remote pc I have the server which is running the following code:
if __name__ == '__main__':
    from robotremoteserver import RobotRemoteServer
    RobotRemoteServer(Process(), *sys.argv[1:])

In the local computer, I have the following code:

Library           Remote    http://192.168.1.25:4444    WITH NAME    RemoteKW

And I use it as:
${id}=    RemoteKW.Start Process    echo    hello    world
${result}=    RemoteKW.Terminate Process    ${id}
${rc}    ${output}    ${stderr}=    RemoteKW.Get Process Result    ${id}    rc=true    stdout=true    stderr=true
Log    ${output}
It works fine, the log is "hello world", but when I add the stdout:
${id}=    RemoteKW.Start Process    echo    hello    world    stdout=tmp.txt
${result}=    RemoteKW.Terminate Process    ${id}
${rc}    ${output}    ${stderr}=    RemoteKW.Get Process Result    ${id}    rc=true    stdout=true    stderr=true
Log    ${output}
Then I get "hello world stdout=tmp.txt" and no file was created. In local (changing "RemoteKW." by "Process." it works fine).

I have python 2.7.11 installed and I tried with robotframework2.8.7 (the default one I use), and with robotframework3.0 (I update on both sides to check it)

Pekka Klärck

unread,
Mar 1, 2016, 5:26:48 PM3/1/16
to tomas.ga...@gmail.com, robotframework-users
2016-03-01 21:54 GMT+02:00 tgh <tomas.ga...@gmail.com>:
>
> I have python 2.7.11 installed and I tried with robotframework2.8.7 (the
> default one I use), and with robotframework3.0 (I update on both sides to
> check it)

Which remote server version? Older versions don't support **kwargs
that Process library uses.

Cheers,
.peke

tgh

unread,
Mar 2, 2016, 2:38:42 AM3/2/16
to robotframework-users
Yes, finally this is the problem, I had an older version of robotremoteserver, I've updated it and all works as expected...

Thanks to all
Reply all
Reply to author
Forward
0 new messages