Skip to content

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

Closed

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

Activity

  1. Ch3LL commented on Nov 11, 2016

    @Ch3LL
    Contributor

    Looks like i'm able to replicate this.

    Here is a docker container for whoever wants to replicate this easily:

    1. docker run -itv /home/ch3ll/git/salt/:/testing/ ch3ll/issues:37648 salt-call --local state.sls test (where /home/ch3ll/git/salt/ is a local git clone of salt)

    Looks like we need to get this fixed up. Thanks

  2. added
    bug
    P3
    Platform
    severity-medium
    on Nov 11, 2016
  3. added this to the Approved milestone on Nov 11, 2016
  4. added a commit that references this issue on Dec 2, 2016
    835630f
  5. stale commented on Jul 24, 2018

    @stale

    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.

  6. arcaartem commented on Mar 19, 2019

    @arcaartem

    has this issue ever been resolved?

  7. reopened this on Mar 21, 2019
  8. stale commented on Mar 21, 2019

    @stale

    Thank you for updating this issue. It is no longer marked as stale.

  9. 13 remaining items

  10. removed
    Magnesium
    on Sep 16, 2020
  11. modified the milestones: Approved, Argon v3008 on Aug 23, 2023
  12. corywright commented on May 5, 2026

    @corywright
    Contributor

    This appears to still be broken.

  13. added a commit that references this issue on Jul 9, 2026
    a450794
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

    ConfirmedPlatformState-Modulebughelp-wantedseverity-medium

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions