virtualenv.managed ran twice over the same directory breaks it #38681

Open
alexykot opened this Issue Jan 11, 2017 · 2 comments

Projects

None yet

2 participants

@alexykot

Description of Issue/Question

virtualenv.managed configured to create Python3 venv on first run does the right thing, but when run for second time on the same minion with already existing venv breaks it and resets to Python2.

Workaround - explicitly delete venv environment folder before (re)creating the venv.

Setup

/opt/projects/project
  virtualenv.managed:
    - cwd: /opt/projects/project
    - name: /opt/projects/project/venv
    - python: /bin/python3
    - pip_upgrade: True

Steps to Reproduce Issue

  1. create virtualenv.managed state to create a python3 venv.
  2. run salt '<minion_name>' state.apply on master.
  3. login into the minion.
  4. on minion run cd /opt/projects/project && . venv/bin/activate && which python && python --version
  5. as expected get:
/opt/projects/project/venv/bin/python
Python 3.4.5
  1. run salt '<minion_name>' state.apply on master again.
  2. on minion run same cd /opt/projects/project && . venv/bin/activate && which python && python --version
  3. suddenly get:
/bin/python
Python 2.7.5

Versions Report

[root@master]# salt --versions-report
Salt Version:
           Salt: 2016.11.1
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.3.1611 Core
        machine: x86_64
        release: 3.10.0-327.22.2.el7.x86_64
         system: Linux
        version: CentOS Linux 7.3.1611 Core
[root@minion]# salt-minion --versions-report
Salt Version:
           Salt: 2016.3.4
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-327.22.2.el7.x86_64
         system: Linux
        version: CentOS Linux 7.2.1511 Core
@Ch3LL
Contributor
Ch3LL commented Jan 11, 2017

@alexykot i'm haivng a hard time replicate this. When you run the state.apply again does it state that there were any changes?

@Ch3LL Ch3LL added this to the Blocked milestone Jan 11, 2017
@alexykot
alexykot commented Jan 12, 2017 edited

Just retried it, no, it returns:

          ID: project-venv
    Function: virtualenv.managed
        Name: /opt/projects/project/venv
      Result: True
     Comment: virtualenv exists
     Started: 09:35:04.548450
    Duration: 0.73 ms
     Changes:   

There are 88 states applied to this system at once when I run state.apply, and I'm not sure what can interfere here. How can I debug that?

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