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

Created on 11 Nov 2016  路  10Comments  路  Source: saltstack/salt

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

Bug Confirmed Platform State Module help-wanted severity-medium

All 10 comments

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

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.

has this issue ever been resolved?

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

looks like the PR was never merged. I went ahead and re-opened so please feel free to take a go at a PR

Thanks @Ch3LL ! I wanted to have a look at the build pipeline at https://jenkins.saltstack.com/ but I can't seem to be able to access it. Is it down for maintenance?

We have migrated to https://jenkinsci.saltstack.com/ for our tests.

Hi there,
I have added the request to resolve the bug when instead of installing pyenv the function tries to install a wrong version of python. The previous fix mentioned in this discussion just have changed the parameters for a python installation. With suggested changes the real installation of pyenv and only pyenv will be requested.

I have added the request based on merge base for develop & 2018.3 so it can be merged into both branches simultaneously.

I have looked in the build logs. In both pull requests the same issue with kitchen appears. I'm not familiar with it unfortunately.

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.

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

Was this page helpful?
0 / 5 - 0 ratings