salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-ssh from python2.6 master to python2.7 minion fails on "from _elementtree import *"

Open HG00 opened this issue 11 years ago • 7 comments

Sorry if this is the wrong place to put this - I dont have a solution at the moment so hoping for some help!

master: Scientific Linux 6.6 (Centos/RHEL 6.6)
salt-ssh --versions-report
           Salt: 2015.5.3
         Python: 2.6.6 (r266:84292, Jul 22 2015, 16:47:47)
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.5
           Mako: Not Installed
        Tornado: Not Installed

We're trying to use salt-ssh from centos6.6 to ubuntu 14.04 minions, it seems to get a lot of the way, but then fail with this:

salt-ssh -i cserver4 test.ping
cserver4:
    ----------
    retcode:
        1
    stderr:
        Traceback (most recent call last):
          File "/tmp/.root_62a99a__salt/salt-call", line 4, in <module>
            salt_call()
          File "/tmp/.root_62a99a__salt/salt/scripts.py", line 221, in salt_call
            import salt.cli.call
          File "/tmp/.root_62a99a__salt/salt/cli/call.py", line 6, in <module>
            from salt.utils import parsers
          File "/tmp/.root_62a99a__salt/salt/utils/parsers.py", line 28, in <module>
            import salt.config as config
          File "/tmp/.root_62a99a__salt/salt/config.py", line 28, in <module>
            import salt.utils.network
          File "/tmp/.root_62a99a__salt/salt/utils/network.py", line 26, in <module>
            from salt._compat import subprocess
          File "/tmp/.root_62a99a__salt/salt/_compat.py", line 22, in <module>
            import xml.etree.cElementTree as ElementTree
          File "/tmp/.root_62a99a__salt/xml/etree/cElementTree.py", line 3, in <module>
            from _elementtree import *
          File "<string>", line 147, in <module>
        AttributeError: 'module' object has no attribute 'fromstringlist'
    stdout:

If I install salt-ssh on another ubuntu14.04 box (python2.7) and retry, it works just fine:

salt-ssh cserver4 test.ping
cserver4:
    True

Any ideas? I can test / run anything that will be helpful

HG00 avatar Aug 10 '15 15:08 HG00

@HG00, thanks for the report. This looks to be an overlooked incompatibility or assumption when packing up the thin tar ball from the centos 6 system to the ubuntu system.

jfindlay avatar Aug 10 '15 19:08 jfindlay

thanks @jfindlay - happy to help with any info/test you need.

HG00 avatar Aug 11 '15 15:08 HG00

Same problem running salt-ssh from a centos 6.7 master to a centos 7.1 minion (RHEL7 ships with python 2.7).

I would suggest to mention this issue in the salt-ssh documentation so people are aware of the problem (it is quite common to have python 2.7 minions these days).

javicacheiro avatar Dec 24 '15 00:12 javicacheiro

+1

dreampuf avatar Jan 12 '16 06:01 dreampuf

resolve it by https://gist.github.com/dreampuf/a07fd546857f8444b90d

dreampuf avatar Jan 12 '16 06:01 dreampuf

I ran into this exact error and verified the temporary fix from dreampuf. My master is CentOS 6.5 with Python 2.6.6 and my broken minion is Ubuntu 14.04.2 LTS with Python 2.7.6.

Wrote state to fix:

# File:    /srv/salt/setup/fix-salt-thin.sls
# PURPOSE: Fix for https://github.com/saltstack/salt/issues/18425
# ISSUE:   Problem in Python when master is Python 2.6 and minion
#          is 2.7  

# NOTES:   If you already SSH'd to the host then you will need to
#          delete the salt thin directory on the minion:
#          rm /tmp/.user_hex_salt


# Fix the thin.py
fix_salt_thin:
  file.replace:
    - name: /usr/lib/python2.6/site-packages/salt/utils/thin.py
    - pattern: '^    HAS_XML = True'
    - repl: '    HAS_XML = False'

# Remove the old Salt thin tarball
remove_old_salt_thin:
  file.absent:
    - name: /var/cache/salt/master/thin/thin.tgz

grep4linux avatar Feb 22 '16 19:02 grep4linux

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.

stale[bot] avatar Mar 30 '18 18:03 stale[bot]