Carlos García
2015-02-04 09:18:11 UTC
Hi list,
I was trying to execute some commands on an ESX server, but I'm having some
problems.
ESX has a custom Linux, it lacks of sudo, bash among many other things.
Anyway, I just want to run a simple ls so the code I'm trying to run is:
@task
def esx_cmd( command ):
env.shell = '/bin/sh'
return run(command)
[host] Executing task 'run_cmd'
[host] run: ls
[host] Login password for 'user':
[host] out: /bin/sh: can't open 'ls'
[host] out:
Fatal error: run() received nonzero return code 2 while executing!
Requested: ls
Executed: /bin/sh "ls"
Aborting.
Disconnecting from host... done.
If I run the same command in an interactive SSH session on that host:
The ESXi Shell can be disabled by an administrative user. See the
vSphere Security documentation for more information.
~ # env
SSH_CLIENT=X.X.X.X 50909 22
MAIL=/var/mail/user
USER=user
TERMINFO=/usr/share/terminfo
HOME=/
SSH_TTY=/dev/char/pty/t0
VI_USERNAME=user
LOGNAME=user
TERM=xterm
PATH=/bin:/sbin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/
LC_ALL=en_US.UTF-8
SSH_CONNECTION=X.X.X.X 50909 X.X.X.X 22
TMOUT=0
~ # ls
VIB bootbank etc local.tgz opt
sbin tardisks usr vmimages
altbootbank bootpart.gz lib locker proc
scratch tardisks.noauto var vmupgrade
bin dev lib64 mbr
productLocker store tmp vmfs
~ #
What I'm doing wrong??
Thanks in advance
I was trying to execute some commands on an ESX server, but I'm having some
problems.
ESX has a custom Linux, it lacks of sudo, bash among many other things.
Anyway, I just want to run a simple ls so the code I'm trying to run is:
@task
def esx_cmd( command ):
env.shell = '/bin/sh'
return run(command)
fab esx_cmd:"ls" -H host
And the output:[host] Executing task 'run_cmd'
[host] run: ls
[host] Login password for 'user':
[host] out: /bin/sh: can't open 'ls'
[host] out:
Fatal error: run() received nonzero return code 2 while executing!
Requested: ls
Executed: /bin/sh "ls"
Aborting.
Disconnecting from host... done.
If I run the same command in an interactive SSH session on that host:
The ESXi Shell can be disabled by an administrative user. See the
vSphere Security documentation for more information.
~ # env
SSH_CLIENT=X.X.X.X 50909 22
MAIL=/var/mail/user
USER=user
TERMINFO=/usr/share/terminfo
HOME=/
SSH_TTY=/dev/char/pty/t0
VI_USERNAME=user
LOGNAME=user
TERM=xterm
PATH=/bin:/sbin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/
LC_ALL=en_US.UTF-8
SSH_CONNECTION=X.X.X.X 50909 X.X.X.X 22
TMOUT=0
~ # ls
VIB bootbank etc local.tgz opt
sbin tardisks usr vmimages
altbootbank bootpart.gz lib locker proc
scratch tardisks.noauto var vmupgrade
bin dev lib64 mbr
productLocker store tmp vmfs
~ #
What I'm doing wrong??
Thanks in advance