salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-ssh is not working with coreos

Open sugun999 opened this issue 9 years ago • 4 comments

Description of Issue/Question

Installed Activepython on coreos and trying to run salt-ssh from centos but it fails with an error saying that "Unable to locate appropriate python command."

Below is the output with debug log. It says that python is not installed, but it was installed on coreOS and able to run python script on coreos server.

[DEBUG ] Reading configuration from /etc/salt/master [DEBUG ] Configuration file path: /etc/salt/master [WARNING ] Insecure logging configuration detected! Sensitive data may be logged. [DEBUG ] LazyLoaded flat.targets [DEBUG ] LazyLoaded jinja.render [DEBUG ] LazyLoaded yaml.render [DEBUG ] compile template: /etc/salt/roster [DEBUG ] Jinja search path: ['/var/cache/salt/master/files/base'] [PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'jinja' renderer: 0.00697112083435 [DEBUG ] Rendered data from file: /etc/salt/roster:

core2: host: 10.10.11.6 user: core priv: /root/.ssh/id_rsa

[DEBUG ] Results of YAML rendering: OrderedDict([('core2', OrderedDict([('host', '10.10.11.6'), ('user', 'core'), ('priv', '/root/.ssh/id_rsa')]))]) [PROFILE ] Time (in seconds) to render '/etc/salt/roster' using 'yaml' renderer: 0.00415897369385 [DEBUG ] Matched minions: {'core2': OrderedDict([('host', '10.10.11.6'), ('user', 'core'), ('priv', '/root/.ssh/id_rsa')])} [DEBUG ] LazyLoaded roots.envs [DEBUG ] Could not LazyLoad roots.init: 'roots.init' is not available. [DEBUG ] Updating roots fileserver cache [DEBUG ] LazyLoaded local_cache.prep_jid [DEBUG ] Adding minions for job 20170204173125281997: ['core2'] [DEBUG ] Could not LazyLoad network.interfaces: 'network.interfaces' is not available. [DEBUG ] Performing shimmed, blocking command as follows: network.interfaces [DEBUG ] Executed SHIM command. Command logged to TRACE [DEBUG ] Child Forked! PID: 11302 STDOUT_FD: 10 STDERR_FD: 12 [DEBUG ] VT: Salt-SSH SHIM Terminal Command executed. Logged to TRACE [DEBUG ] RETCODE 10.10.11.6: 10 [DEBUG ] LazyLoaded nested.output core2:

retcode: 10 stderr:

  • SUDO=
  • '[' -n '' ']'
  • SUDO_USER=
  • '[' '' ']'
  • '[' '' ']'
  • EX_PYTHON_INVALID=10
  • PYTHON_CMDS='python3 python27 python2.7 python26 python2.6 python2 python'
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python3
  • continue
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python27
  • continue
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python2.7
  • continue
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python26
  • continue
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python2.6
  • continue
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python2
  • continue
  • for py_cmd in '$PYTHON_CMDS'
  • command -v python
  • continue
  • echo 'ERROR: Unable to locate appropriate python command' ERROR: Unable to locate appropriate python command
  • exit 10 stdout: ERROR: salt requires python 2.6 or newer on target hosts, must have same major version as origin host

Steps to Reproduce Issue

  1. Install Activepython on coreos
  2. Install saltstack master on centos with https://repo.saltstack.com/yum/redhat/salt-repo-2016.11-1.el7.noarch.rpm
  3. Install salt-ssh with pip on centos.
  4. run: salt-ssh -i '*' network.interfaces -l debug

Versions Report on centos

salt --versions-report Salt Version: Salt: 2016.11.2

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed Jinja2: 2.7.2 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pygit2: Not Installed Python: 2.7.5 (default, Nov 6 2016, 00:28:07) python-gnupg: Not Installed PyYAML: 3.10 PyZMQ: 15.3.0 RAET: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4

System Versions: dist: centos 7.3.1611 Core machine: x86_64 release: 3.10.0-514.6.1.el7.x86_64 system: Linux version: CentOS Linux 7.3.1611 Core

sugun999 avatar Feb 04 '17 20:02 sugun999

Hello. You need to have python locatable in the path. Try to put into /etc/environment: PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin LD_LIBRARY_PATH=/opt/lib

horakmar avatar Feb 06 '17 12:02 horakmar

@sugun999 any luck with @horakmar 's suggestions?

Ch3LL avatar Feb 06 '17 20:02 Ch3LL

Hi,

Thanks for the reply. Still getting below same error even after updating the /etc/environment file on coreOS with above specified settings.

  • echo 'ERROR: Unable to locate appropriate python command' ERROR: Unable to locate appropriate python command + exit 10

If I run command from centOS, I do get response of python path

ssh [email protected] "command -v python"

/opt/bin/python

wondering why "salt-ssh -i '*' test.ping" fails?

sugun999 avatar Feb 07 '17 07:02 sugun999

Hi,

Ok. I found the reason. There are different versions of python on Centos and coreOS.

after I install same versions of python on the both the servers, the issues is fixed.

Thanks a lot.

sugun999 avatar Feb 07 '17 07:02 sugun999