salt icon indicating copy to clipboard operation
salt copied to clipboard

Error trying a salt-ssh test.ping

Open davidpsv17 opened this issue 10 years ago • 4 comments

Hi,

I already installed salt in a Debian jessie, and I'm trying to do a "salt-ssh" 'wordpressServer' test.ping, but the next error appears:

Traceback (most recent call last): File "/var/tmp/.root_9cdddb_salt/salt-call", line 15, in <module> salt_call() File "/var/tmp/.root_9cdddb_salt/py2/salt/scripts.py", line 339, in salt_call import salt.cli.call File "/var/tmp/.root_9cdddb_salt/py2/salt/cli/call.py", line 6, in <module> from salt.utils import parsers File "/var/tmp/.root_9cdddb_salt/py2/salt/utils/parsers.py", line 28, in <module> import salt.config as config File "/var/tmp/.root_9cdddb_salt/py2/salt/config/__init__.py", line 41, in <module> import salt.utils.sdb File "/var/tmp/.root_9cdddb_salt/py2/salt/utils/sdb.py", line 9, in <module> import salt.loader File "/var/tmp/.root_9cdddb_salt/py2/salt/loader.py", line 30, in <module> import salt.utils.event File "/var/tmp/.root_9cdddb_salt/py2/salt/utils/event.py", line 68, in <module> import tornado.iostream File "/var/tmp/.root_9cdddb_salt/py2/tornado/iostream.py", line 40, in <module> from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults File "/var/tmp/.root_9cdddb_salt/py2/tornado/netutil.py", line 49, in <module> import backports.ssl_match_hostname ImportError: No module named backports.ssl_match_hostname

I tried to install with pip configparser and backports.ssl_match_hostname but didn't run. The target is debian 7 and the version of salt-ssh is the next:

`Salt Version: Salt: 2016.3.1

Dependency Versions: cffi: 0.8.6 cherrypy: 3.5.0 dateutil: 2.2 gitdb: 0.5.4 gitpython: 0.3.2 RC1 ioflo: Not Installed Jinja2: 2.7.3 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.4.2 mysql-python: 1.3.7 pycparser: 2.10 pycrypto: 2.6.1 pygit2: Not Installed Python: 2.7.9 (default, Mar 1 2015, 12:57:24) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 14.4.0 RAET: Not Installed smmap: 0.8.2 timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.0.5

System Versions: dist: debian 8.5 machine: x86_64 release: 4.3.5-grsec system: Linux version: debian 8.5 `

Can anyone help me please?

davidpsv17 avatar Jul 12 '16 11:07 davidpsv17

I tried with a Debian8 target and works fine..

davidpsv17 avatar Jul 12 '16 12:07 davidpsv17

I'm having the same issue on an Ubuntu 12.04 machine using latest salt-ssh release on Debian Jessie. It's the only target it fails on - even after deleting /tmp/.$USER_$RANDOM_salt - so it might be a good machine to debug this issue on. I can also say, that it's not the only Ubuntu 12.04 target I have and it works fine on those other ones.

mirko avatar Jul 22 '16 11:07 mirko

Im seeing the same issue on Ubuntu 12.04 target:

Traceback (most recent call last):
          File "/var/tmp/.robert.hernandez_e72a63_salt/salt-call", line 15, in <module>
            salt_call()
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/scripts.py", line 339, in salt_call
            import salt.cli.call
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/cli/call.py", line 6, in <module>
            from salt.utils import parsers
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/utils/parsers.py", line 28, in <module>
            import salt.config as config
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/config/__init__.py", line 41, in <module>
            import salt.utils.sdb
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/utils/sdb.py", line 9, in <module>
            import salt.loader
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/loader.py", line 30, in <module>
            import salt.utils.event
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/salt/utils/event.py", line 68, in <module>
            import tornado.iostream
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/tornado/iostream.py", line 40, in <module>
            from tornado.netutil import ssl_wrap_socket, ssl_match_hostname, SSLCertificateError, _client_ssl_defaults, _server_ssl_defaults
          File "/var/tmp/.robert.hernandez_e72a63_salt/py2/tornado/netutil.py", line 56, in <module>
            import backports.ssl_match_hostname
        ImportError: No module named backports.ssl_match_hostname
$ salt-ssh --versions-report
Salt Version:
           Salt: 2016.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Jul  1 2016, 15:12:24)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: Not Installed
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.1
            ZMQ: Not Installed

System Versions:
           dist: Ubuntu 16.04 xenial
        machine: x86_64
        release: 4.4.0-31-generic
         system: Linux
        version: Ubuntu 16.04 xenial

Looks like theres a similar issue: https://github.com/saltstack/salt/issues/27355

l2ol33rt avatar Aug 02 '16 15:08 l2ol33rt

Hi,

I had this issue, too. And I found a workaround. ssl_match_hostname.py is inside thin.tgz as py2/salt/ext/ssl_match_hostname.py but the running python scripts can't find it because they import backports.ssl_match_hostname.

So I simply add a symlink for backports folder to thin.tgz as py2/backports -> salt/ext.

Diff:

--- /usr/lib/python2.7/dist-packages/salt/utils/thin.py.orig    2016-10-29 23:51:16.465667613 +0000
+++ /usr/lib/python2.7/dist-packages/salt/utils/thin.py 2016-10-30 01:00:40.224248452 +0000
@@ -292,6 +292,16 @@
             if tempdir is not None:
                 shutil.rmtree(tempdir)
                 tempdir = None
+
+        # workaround for backports
+        os.symlink('salt/ext','/tmp/workaround_symlink_backports')
+        tftp_deref_old = tfp.dereference
+        tfp.dereference = False
+        tfp.add('/tmp/workaround_symlink_backports', arcname=os.path.join('py{0}'.format(py_ver), 'backports'))
+        tfp.dereference = tftp_deref_old
+        os.unlink('/tmp/workaround_symlink_backports')
+        # workaround end
+
     os.chdir(thindir)
     tfp.add('salt-call')
     with salt.utils.fopen(thinver, 'w+') as fp_:

Versions of salt-ssh machine

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

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: Not Installed
      gitpython: Not Installed
          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.4.6
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: Not Installed
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: Not Installed

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

Target was Ubuntu 12.04 64Bit.

mjaepel avatar Oct 30 '16 01:10 mjaepel