mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
We must also provide venv_bin
when running within a virtualenv
This commit is contained in:
parent
31e91b03bb
commit
ea9d2460f0
3 changed files with 26 additions and 3 deletions
|
@ -760,6 +760,21 @@ class TestDaemon(object):
|
|||
syndic_opts['cachedir'] = os.path.join(TMP, 'rootdir', 'cache')
|
||||
syndic_opts['config_dir'] = RUNTIME_VARS.TMP_SYNDIC_MINION_CONF_DIR
|
||||
|
||||
# Under windows we can't seem to properly create a virtualenv off of another
|
||||
# virtualenv, we can on linux but we will still point to the virtualenv binary
|
||||
# outside the virtualenv running the test suite, if that's the case.
|
||||
try:
|
||||
if salt.utils.is_windows():
|
||||
virtualenv_binary = os.path.join(sys.real_prefix, 'Scripts', 'virtualenv.exe')
|
||||
else:
|
||||
virtualenv_binary = os.path.join(sys.real_prefix, 'bin', 'virtualenv')
|
||||
if not os.path.exists(virtualenv_binary):
|
||||
# It doesn't exist?!
|
||||
virtualenv_binary = None
|
||||
except AttributeError:
|
||||
# We're not running inside a virtualenv
|
||||
virtualenv_binary = None
|
||||
|
||||
# This minion connects to master
|
||||
minion_opts = salt.config._read_conf_file(os.path.join(RUNTIME_VARS.CONF_DIR, 'minion'))
|
||||
minion_opts['cachedir'] = os.path.join(TMP, 'rootdir', 'cache')
|
||||
|
@ -769,6 +784,8 @@ class TestDaemon(object):
|
|||
minion_opts['pki_dir'] = os.path.join(TMP, 'rootdir', 'pki')
|
||||
minion_opts['hosts.file'] = os.path.join(TMP, 'rootdir', 'hosts')
|
||||
minion_opts['aliases.file'] = os.path.join(TMP, 'rootdir', 'aliases')
|
||||
if virtualenv_binary:
|
||||
minion_opts['venv_bin'] = virtualenv_binary
|
||||
|
||||
# This sub_minion also connects to master
|
||||
sub_minion_opts = salt.config._read_conf_file(os.path.join(RUNTIME_VARS.CONF_DIR, 'sub_minion'))
|
||||
|
@ -779,6 +796,8 @@ class TestDaemon(object):
|
|||
sub_minion_opts['pki_dir'] = os.path.join(TMP, 'rootdir-sub-minion', 'pki', 'minion')
|
||||
sub_minion_opts['hosts.file'] = os.path.join(TMP, 'rootdir', 'hosts')
|
||||
sub_minion_opts['aliases.file'] = os.path.join(TMP, 'rootdir', 'aliases')
|
||||
if virtualenv_binary:
|
||||
sub_minion_opts['venv_bin'] = virtualenv_binary
|
||||
|
||||
# This is the master of masters
|
||||
syndic_master_opts = salt.config._read_conf_file(os.path.join(RUNTIME_VARS.CONF_DIR, 'syndic_master'))
|
||||
|
|
|
@ -56,7 +56,9 @@ class PipModuleTest(ModuleCase):
|
|||
because under windows, we can't seem to properly create a virtualenv off of
|
||||
another virtualenv(we can on linux) and also because, we really don't want to
|
||||
test virtualenv creation off of another virtualenv, we want a virtualenv created
|
||||
from the original python
|
||||
from the original python.
|
||||
Also, one windows, we must also point to the virtualenv binary outside the existing
|
||||
virtualenv because it will fail otherwise
|
||||
'''
|
||||
try:
|
||||
if salt.utils.is_windows():
|
||||
|
|
|
@ -78,7 +78,9 @@ class PipStateTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
because under windows, we can't seem to properly create a virtualenv off of
|
||||
another virtualenv(we can on linux) and also because, we really don't want to
|
||||
test virtualenv creation off of another virtualenv, we want a virtualenv created
|
||||
from the original python
|
||||
from the original python.
|
||||
Also, one windows, we must also point to the virtualenv binary outside the existing
|
||||
virtualenv because it will fail otherwise
|
||||
'''
|
||||
self.addCleanup(shutil.rmtree, path, ignore_errors=True)
|
||||
try:
|
||||
|
@ -87,7 +89,7 @@ class PipStateTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
else:
|
||||
python = os.path.join(sys.real_prefix, 'bin', os.path.basename(sys.executable))
|
||||
# We're running off a virtualenv, and we don't want to create a virtualenv off of
|
||||
# a virtualenv
|
||||
# a virtualenv, let's point to the actual python that created the virtualenv
|
||||
kwargs = {'python': python}
|
||||
except AttributeError:
|
||||
# We're running off of the system python
|
||||
|
|
Loading…
Add table
Reference in a new issue