saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.21k stars 5.48k forks source link

Using netscaler execution module through salt-ssh #36182

Closed illee closed 6 years ago

illee commented 8 years ago

Description of Issue/Question

Hi~ Recently I'm trying to use saltstack to my load-balancer automation (citrix-netscaler) and, found execution module of salt (SALT.MODULES.NETSCALER) My netscaler is appliance model, so I decided to use salt-ssh, because it's almost now possible to install minion to appliance device.

I succeeded to connect my netscaler with salt-ssh.

# salt-ssh 'gmdv' -r 'show ns version'
gmdv:
    ----------
    retcode:
        0
    stderr:
    stdout:
        Password:
         Done
                NetScaler NS10.1: Build 133.9.nc, Date: Aug 27 2015, 02:35:41
         Done

But if I try to use excution module, it failed and I don't know how to do. I installed "nsnitro" in my salt-ssh server (master server). Could I get any advise regarding this? I'm worring this module support only software version of netscaler.

# salt-ssh 'gmdv' netscaler.server_exists 'sysopst25gm'
gmdv:
    ----------
    retcode:
        1
    stderr:
        ERROR: No such command
    stdout:
        Password:
         Done
        ERROR: No such command

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Steps to Reproduce Issue

(Include debug logs if possible and relevant.) Here's ltrace debug result

echo "ERROR: Unable to locate appropriate python command" >&2
exit $EX_PYTHON_INVALID
EOF
[DEBUG   ] Child Forked! PID: 101205  STDOUT_FD: 9  STDERR_FD: 11
[DEBUG   ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE
[TRACE   ] Terminal Command: /bin/sh -c ssh 172.30.217.11  -o KbdInteractiveAuthentication=no -o PasswordAuthentication=yes -o GSSAPIAuthentication=no -o ConnectTimeout=65 -o Port=22 -o IdentityFile=/etc/salt/pki/master/ssh/salt-ssh.rsa -o User=nsroot  /bin/sh << 'EOF'
set -e
set -u
DEBUG="1"
if [ -n "$DEBUG" ]
then set -x
fi
SUDO=""
if [ -n "" ]
then SUDO="sudo "
fi
SUDO_USER=""
if [ "$SUDO" ] && [ "$SUDO_USER" ]
then SUDO="sudo -u "
elif [ "$SUDO" ] && [ -n "$SUDO_USER" ]
then SUDO="sudo "
fi
EX_PYTHON_INVALID=10
PYTHON_CMDS="python3 python27 python2.7 python26 python2.6 python2 python"
for py_cmd in $PYTHON_CMDS
do
if command -v "$py_cmd" >/dev/null 2>&1 && "$py_cmd" -c \
"import sys; sys.exit(not (sys.version_info >= (2, 6)
and sys.version_info[0] == 2));"
then
py_cmd_path=`"$py_cmd" -c \
'from __future__ import print_function;
import sys; print(sys.executable);'`
cmdpath=$(which $py_cmd 2>&1)
if file $cmdpath | grep "shell script" > /dev/null
then
ex_vars="'PATH', 'LD_LIBRARY_PATH', 'MANPATH', \
'XDG_DATA_DIRS', 'PKG_CONFIG_PATH'"
export $($py_cmd -c \
"from __future__ import print_function;
import sys;
import os;
map(sys.stdout.write, ['{0}={1} ' \
.format(x, os.environ[x]) for x in [$ex_vars]])")
exec $SUDO PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH \
MANPATH=$MANPATH XDG_DATA_DIRS=$XDG_DATA_DIRS \
PKG_CONFIG_PATH=$PKG_CONFIG_PATH \
"$py_cmd_path" -c \
'import base64;
############omitted############
fi
exit 0
else
continue
fi
done
echo "ERROR: Unable to locate appropriate python command" >&2
exit $EX_PYTHON_INVALID
EOF
[TRACE   ] Password:
[TRACE   ] ERROR: No such command
[TRACE   ]  Done
ERROR: No such command
[TRACE   ] STDOUT 172.30.217.11
Password:
 Done
ERROR: No such command

[TRACE   ] STDERR 172.30.217.11
ERROR: No such command

[DEBUG   ] RETCODE 172.30.217.11: 1
[DEBUG   ] SHIM retcode(1) and command: Password:
[DEBUG   ] LazyLoaded nested.output
[TRACE   ] data = {'gmdv': {'retcode': 1, 'stderr': 'ERROR: No such command\n', 'stdout': 'Password: \n Done\nERROR: No such command\n'}}

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

# salt-ssh --versions-report
Salt Version:
           Salt: 2016.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 0.9.1
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: 0.8.2
    timelib: Not Installed
    Tornado: 4.2.1
        ZMQ: 4.0.5

System Versions: dist: Ubuntu 14.04 trusty machine: x86_64 release: 3.13.0-93-generic system: Linux version: Ubuntu 14.04 trusty

Ch3LL commented 8 years ago

@illee looking at your logs I"m seeing this: Unable to locate appropriate python command". It looks like your device does not have python installed. is it possible to install python that should resolve that issue for you.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.