Skip to content

Exception loading pip_state on Ubuntu 12.04 #31025

Closed

Description

@byronclark

We're seeing this error on any salt run on Ubuntu 12.04 with the system pip package (python-pip_1.0-1build1) installed.

[ERROR   ] Failed to import states pip_state, this is due most likely to a syntax error:
Traceback (most recent call last):
 File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1135, in _load_module
   ), fn_, fpath, desc)
 File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 51, in <module>
   ver = pip.__version__.split('.')
AttributeError: 'module' object has no attribute '__version__'

Unlike later versions of pip, version 1.0 doesn't have a version string:

$ python
Python 2.7.3 (default, Jun 22 2015, 19:33:41)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> pip.__version__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'

It's probably best to wrap the pip.__version__ check in salt/states/pip_state.py in a hasattr call. Incidentally, the version check in that module appears to be duplicated.

Activity

  1. ssgward commented on Feb 8, 2016

    @ssgward

    @byronclark - what version of salt are you using? salt --versions-report

    What command are you running to get the error? Or can you add your state file contents to the bug?

    Thanks for bringing this to our attention.

  2. added this to the Approved milestone on Feb 8, 2016
  3. added
    bug
    severity-medium
    P2
    Platform
    on Feb 8, 2016
  4. jfindlay commented on Feb 8, 2016

    @jfindlay
    Contributor

    @byronclark, also you're welcome to send in a pull request if you have a fix for this.

  5. byronclark commented on Feb 8, 2016

    @byronclark
    ContributorAuthor

    Versions:

    Salt Version:
               Salt: 2015.8.5
    
    Dependency Versions:
             Jinja2: 2.6
           M2Crypto: 0.21.1
               Mako: Not Installed
             PyYAML: 3.10
              PyZMQ: 14.0.1
             Python: 2.7.3 (default, Jun 22 2015, 19:33:41)
               RAET: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.0.4
               cffi: Not Installed
           cherrypy: Not Installed
           dateutil: 1.5
              gitdb: Not Installed
          gitpython: Not Installed
              ioflo: Not Installed
            libgit2: Not Installed
            libnacl: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.3.0
       mysql-python: Not Installed
          pycparser: Not Installed
           pycrypto: 2.6.1
             pygit2: Not Installed
       python-gnupg: Not Installed
              smmap: Not Installed
            timelib: Not Installed
    
    System Versions:
               dist: Ubuntu 12.04 precise
            machine: x86_64
            release: 3.2.0-95-virtual
             system: Ubuntu 12.04 precise
    
  6. byronclark commented on Feb 8, 2016

    @byronclark
    ContributorAuthor

    The error appears on every state.highstate run if the python-pip package is installed.

  7. byronclark commented on Feb 8, 2016

    @byronclark
    ContributorAuthor

    Linked pull request at least hides the error. Notably, none of our states are using the pip state.

  8. byronclark commented on Feb 9, 2016

    @byronclark
    ContributorAuthor

    #31027 was merged. I'd love to see that merged to the 2015.8 branch as well so the next point release has that fix.

  9. rallytime commented on Nov 3, 2016

    @rallytime
    Contributor

    Hi @byronclark - apologies for not coming back to this issue sooner. Thank you for fixing this issue. We are no longer accepting fixes to that branch unless it is for a security issue, so I won't be merging this fix into 2015.8.

    However, I did check and realized this fix is not in the 2016.3 branch yet either. I will back-port your fix to 2016.3 right now and it will be available in the 2016.3.5 release of Salt. After the back-port is merged in, are you OK closing this issue?

  10. added
    fixed-pls-verify
    on Nov 3, 2016
  11. rallytime commented on Nov 3, 2016

    @rallytime
    Contributor

    Oh! It looks like I spoke too soon. When attempting to backport your fix I discovered through a merge-conflict that your change was back-ported to 2015.8 with #33396, which also built on your work.

    I'm going to go ahead and close this as resolved. Please let us know if this pops up again and we can take another look. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2PlatformState-Modulebugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions