Thanks to visit codestin.com
Credit goes to github.com

Skip to content

salt.states.pyenv.install_pyenv broken since at least 2015.8.8 #37648

@eykd

Description

@eykd

Description of Issue/Question

The pyenv.install_pyenv state uses the wrong signature when calling _check_and_install_python(), passing user in for the python arg. Since user defaults to None, this causes a fun-to-debug traceback when it later tries to run a regex search against python:

----------
          ID: install-pyenv
    Function: pyenv.install_pyenv
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1626, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1492, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/states/pyenv.py", line 215, in install_pyenv
                  return _check_and_install_python(ret, user)
                File "/usr/lib/python2.7/dist-packages/salt/states/pyenv.py", line 84, in _check_and_install_python
                  if __salt__['pyenv.install_python'](python, runas=user):
                File "/usr/lib/python2.7/dist-packages/salt/modules/pyenv.py", line 159, in install_python
                  python = re.sub(r'^python-', '', python)
                File "/usr/lib/python2.7/re.py", line 151, in sub
                  return _compile(pattern, flags).sub(repl, string, count)
              TypeError: expected string or buffer
     Started: 12:14:18.916348
    Duration: 2.586 ms
     Changes:   

Setup

This state will adequately demonstrate the bug:

    pyenv-install:
      pyenv.install_pyenv

Versions Report

$ salt --versions-report
Salt Version:
           Salt: 2015.8.8
 
Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: Not Installed
           Mako: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.1
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 1.8.3
       cherrypy: Not Installed
       dateutil: 2.6.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: 2.17
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed
 
System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-30-generic
         system: Ubuntu 14.04 trusty

We ran into the problem on a masterless VM.

/cc @ryanmrubin

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConfirmedSalt engineer has confirmed bug/feature - often including a MCVEPlatformRelates to OS, containers, platform-based utilities like FS, system based appsState-Modulebugbroken, incorrect, or confusing behaviorhelp-wantedCommunity help is needed to resolve thisseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions