0
votes

I am exploring options of using RIDE-Robot Framework for my Project. Here, I am using SSH Library.

I am trying to login into my server and then try to execute some commands

Manually, I am trying to login to the server and then give a sudo admin command and then execute the set of commands.

Using Ride- I am using Open Connection, Execute Command keywords

I am able to login to the server with the username and password, but I am not able to execute commands.

Can you please help me understand how to execute commands?

I am able to open Connection and Login with username and password.

Paramiko

import paramiko    

from paramiko import SSHClient

ssh = SSHClient()

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh.connect('10.184.59.41', username='******', password='*******')

shell=ssh.invoke_shell()

shell.settimeout(0.5)

ssh.exec_command("sudo -u tradmin -E bash")

ssh.exec_command("/ThomsonReuters/apps/hillfarber")

******Ride******

Open Connection    10.184.59.41
Login    ${username}    ${password}
Execute Command    sudo - u tradmin -E bash
${stdout}=     Execute Command     /ThomsonReuters/tools/bin/adsmon -key 29 -get IDBFeed  c205xcmpdfh01.ECP_TUL.IDBFeed.IDBFeed PageCount

Unable to execute the commands, no error is displayed

1
Using Paramiko also I was unable to execute commandAdarsh Kalkur
What is hillfarber? perhaps you want ssh.exec_command("./ThomsonReuters/apps/hillfarber")Madison Courto
Hillfarber is actually a folder related to my project. yeah I want to execute that command, prior to that I need to execute the sudo -u tradmin -E Bash command. None of these commands I am able to executeAdarsh Kalkur
The code I pasted above has 2 things, one related to Paramiko and other related to my code in Ride Robot FrameworkAdarsh Kalkur
Have you tried adding sudo=True and the sudo_password=password argumentsin the execute command?Sameem

1 Answers

0
votes

Each invocation of Execute Command is in a new shell - thus the sudo from the first does not influence the user in the second. See the keyword documentation, it's suggested there to use Write and Read keywords for continuity of commands execution within the same shell.

Alternatively you could combine the two calls in a single command - sudo ... adsmon ....