简体   繁体   中英

Unable to execute commands using Ride-Robot-SSH Library

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

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 ... .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM