Runs commands on the remote host.
Similar to command except that it runs commands through a shell /bin/sh.
def test_fun(duthosts, rand_one_dut_hostname):
duthost = duthosts[rand_one_dut_hostname]
free_form_ret = duthost.shell("ls -ltr")
cmd_ret = duthost.shell(cmd="ls -ltr")
chdir- change into specified directory before running command- Required:
False - Type:
String
- Required:
cmd- The command to be run as a string with space dilineated options.- Required:
Trueif free-form argument is not provided,Falseotherwise - Type:
String
- Required:
creates- filename. If a matching file already exists, command will not be run.- Required:
False - Type:
String
- Required:
removes- filename. If matching file exists, command will be run- Required:
False - Type:
String
- Required:
stdin- Set the stdin command directly to the specified value- Required:
False - Type:
String
- Required:
stdin_add_newline- ifTrue, newline is appended to stdin data- Required:
False - Type:
Boolean - Default:
True
- Required:
warn- Enable or disable task warnings (deprecated)- Required:
False - Type:
Boolean - Default:
False
- Required:
Dictionary with information on command output:
cmd- the command executed by taskdelta- the command execution timeend- The command end timemsg- whether the associated task was in achangedstaterc- return code for commandstart- the command execution start timestderr- The standard error as a stringstderr_lines- The standard error as a list of stringsstdout- the standard output as a stringstdout_lines- the standard output as a list of strings