mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #30018 from gladiatr72/pip_state__handle_requirements_chaining
Pip module/state -- handle requirements chaining
This commit is contained in:
commit
28e01aa8ac
@ -79,11 +79,12 @@ from __future__ import absolute_import
|
||||
# Import python libs
|
||||
import os
|
||||
import re
|
||||
import logging
|
||||
import shutil
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import tempfile
|
||||
import salt.utils.locales
|
||||
import salt.utils.url
|
||||
from salt.ext.six import string_types
|
||||
@ -99,6 +100,8 @@ __func_alias__ = {
|
||||
|
||||
VALID_PROTOS = ['http', 'https', 'ftp', 'file']
|
||||
|
||||
rex_pip_chain_read = re.compile(r'-r\s(.*)\n?', re.MULTILINE)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
@ -189,17 +192,53 @@ def _get_env_activate(bin_env):
|
||||
raise CommandNotFoundError('Could not find a `activate` binary')
|
||||
|
||||
|
||||
def _process_requirements(requirements, cmd, saltenv, user, no_chown):
|
||||
def _find_req(link):
|
||||
|
||||
logger.info('_find_req -- link = %s', str(link))
|
||||
|
||||
with salt.utils.fopen(link) as fh_link:
|
||||
child_links = rex_pip_chain_read.findall(fh_link.read())
|
||||
|
||||
base_path = os.path.dirname(link)
|
||||
child_links = [os.path.join(base_path, d) for d in child_links]
|
||||
|
||||
return child_links
|
||||
|
||||
|
||||
def _resolve_requirements_chain(requirements):
|
||||
'''
|
||||
Return an array of requirements file paths that can be used to complete
|
||||
the no_chown==False && user != None conundrum
|
||||
'''
|
||||
|
||||
chain = []
|
||||
|
||||
if isinstance(requirements, string_types):
|
||||
requirements = [requirements]
|
||||
|
||||
for req_file in requirements:
|
||||
chain.append(req_file)
|
||||
chain.extend(_resolve_requirements_chain(_find_req(req_file)))
|
||||
|
||||
return chain
|
||||
|
||||
|
||||
def _process_requirements(requirements, cmd, cwd, saltenv, user):
|
||||
'''
|
||||
Process the requirements argument
|
||||
'''
|
||||
cleanup_requirements = []
|
||||
|
||||
if requirements is not None:
|
||||
if isinstance(requirements, string_types):
|
||||
requirements = [r.strip() for r in requirements.split(',')]
|
||||
elif not isinstance(requirements, list):
|
||||
raise TypeError('requirements must be a string or list')
|
||||
|
||||
treq = None
|
||||
|
||||
for requirement in requirements:
|
||||
treq = None
|
||||
logger.debug('TREQ IS: %s', str(treq))
|
||||
if requirement.startswith('salt://'):
|
||||
cached_requirements = _get_cached_requirements(
|
||||
requirement, saltenv
|
||||
@ -211,18 +250,80 @@ def _process_requirements(requirements, cmd, saltenv, user, no_chown):
|
||||
return None, ret
|
||||
requirement = cached_requirements
|
||||
|
||||
if user and not no_chown:
|
||||
if user:
|
||||
# Need to make a temporary copy since the user will, most
|
||||
# likely, not have the right permissions to read the file
|
||||
treq = salt.utils.mkstemp()
|
||||
shutil.copyfile(requirement, treq)
|
||||
logger.debug(
|
||||
'Changing ownership of requirements file \'{0}\' to '
|
||||
'user \'{1}\''.format(treq, user)
|
||||
)
|
||||
|
||||
if not treq:
|
||||
treq = tempfile.mkdtemp()
|
||||
|
||||
__salt__['file.chown'](treq, user, None)
|
||||
cleanup_requirements.append(treq)
|
||||
cmd.extend(['--requirement', treq or requirement])
|
||||
|
||||
current_directory = None
|
||||
|
||||
if not current_directory:
|
||||
current_directory = os.path.abspath(os.curdir)
|
||||
|
||||
logger.info('_process_requirements from directory,' +
|
||||
'%s -- requirement: %s', cwd, requirement
|
||||
)
|
||||
|
||||
if cwd is None:
|
||||
r = requirement
|
||||
c = cwd
|
||||
|
||||
requirement_abspath = os.path.abspath(requirement)
|
||||
cwd = os.path.dirname(requirement_abspath)
|
||||
requirement = os.path.basename(requirement)
|
||||
|
||||
logger.debug('\n\tcwd: %s -> %s\n\trequirement: %s -> %s\n',
|
||||
c, cwd, r, requirement
|
||||
)
|
||||
|
||||
os.chdir(cwd)
|
||||
|
||||
reqs = _resolve_requirements_chain(requirement)
|
||||
|
||||
os.chdir(current_directory)
|
||||
|
||||
logger.info('request files: {0}'.format(str(reqs)))
|
||||
|
||||
for req_file in reqs:
|
||||
|
||||
req_filename = os.path.basename(req_file)
|
||||
|
||||
logger.debug('TREQ N CWD: %s -- %s -- for %s', str(treq), str(cwd), str(req_filename))
|
||||
source_path = os.path.join(cwd, req_filename)
|
||||
target_path = os.path.join(treq, req_filename)
|
||||
|
||||
logger.debug('S: %s', source_path)
|
||||
logger.debug('T: %s', target_path)
|
||||
|
||||
target_base = os.path.dirname(target_path)
|
||||
|
||||
if not os.path.exists(target_base):
|
||||
os.makedirs(target_base, mode=0o755)
|
||||
__salt__['file.chown'](target_base, user, None)
|
||||
|
||||
if not os.path.exists(target_path):
|
||||
logger.debug(
|
||||
'Copying %s to %s', source_path, target_path
|
||||
)
|
||||
__salt__['file.copy'](source_path, target_path)
|
||||
|
||||
logger.debug(
|
||||
'Changing ownership of requirements file \'{0}\' to '
|
||||
'user \'{1}\''.format(target_path, user)
|
||||
)
|
||||
|
||||
__salt__['file.chown'](target_path, user, None)
|
||||
|
||||
req_args = os.path.join(treq, requirement) if treq else requirement
|
||||
cmd.extend(['--requirement', req_args])
|
||||
|
||||
cleanup_requirements.append(treq)
|
||||
|
||||
logger.debug('CLEANUP_REQUIREMENTS: %s', str(cleanup_requirements))
|
||||
return cleanup_requirements, None
|
||||
|
||||
|
||||
@ -492,9 +593,10 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
|
||||
cleanup_requirements, error = _process_requirements(
|
||||
requirements=requirements,
|
||||
cmd=cmd,
|
||||
cwd=cwd,
|
||||
saltenv=saltenv,
|
||||
user=user,
|
||||
no_chown=no_chown)
|
||||
user=user
|
||||
)
|
||||
|
||||
if error:
|
||||
return error
|
||||
@ -722,18 +824,26 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
|
||||
cmd.extend(['--trusted-host', trusted_host])
|
||||
|
||||
try:
|
||||
cmd_kwargs = dict(cwd=cwd, saltenv=saltenv, use_vt=use_vt, runas=user)
|
||||
cmd_kwargs = dict(saltenv=saltenv, use_vt=use_vt, runas=user)
|
||||
|
||||
if cwd:
|
||||
cmd_kwargs['cwd'] = cwd
|
||||
|
||||
if bin_env and os.path.isdir(bin_env):
|
||||
cmd_kwargs['env'] = {'VIRTUAL_ENV': bin_env}
|
||||
|
||||
logger.debug(
|
||||
'TRY BLOCK: end of pip.install -- cmd: %s, cmd_kwargs: %s',
|
||||
str(cmd), str(cmd_kwargs)
|
||||
)
|
||||
|
||||
return __salt__['cmd.run_all'](cmd,
|
||||
python_shell=False,
|
||||
**cmd_kwargs)
|
||||
finally:
|
||||
for requirement in cleanup_requirements:
|
||||
try:
|
||||
os.remove(requirement)
|
||||
except OSError:
|
||||
pass
|
||||
for tempdir in [cr for cr in cleanup_requirements if cr is not None]:
|
||||
if os.path.isdir(tempdir):
|
||||
shutil.rmtree(tempdir)
|
||||
|
||||
|
||||
def uninstall(pkgs=None,
|
||||
@ -811,9 +921,11 @@ def uninstall(pkgs=None,
|
||||
# Backwards compatibility
|
||||
saltenv = __env__
|
||||
|
||||
cleanup_requirements, error = _process_requirements(requirements=requirements, cmd=cmd,
|
||||
saltenv=saltenv, user=user,
|
||||
no_chown=no_chown)
|
||||
cleanup_requirements, error = _process_requirements(
|
||||
requirements=requirements, cmd=cmd, saltenv=saltenv, user=user,
|
||||
cwd=cwd
|
||||
)
|
||||
|
||||
if error:
|
||||
return error
|
||||
|
||||
@ -867,10 +979,11 @@ def uninstall(pkgs=None,
|
||||
return __salt__['cmd.run_all'](cmd, **cmd_kwargs)
|
||||
finally:
|
||||
for requirement in cleanup_requirements:
|
||||
try:
|
||||
os.remove(requirement)
|
||||
except OSError:
|
||||
pass
|
||||
if requirement:
|
||||
try:
|
||||
os.remove(requirement)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def freeze(bin_env=None,
|
||||
|
@ -14,6 +14,7 @@ import os
|
||||
import salt.version
|
||||
import salt.utils
|
||||
|
||||
from salt.ext import six
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# Define the module's virtual name
|
||||
@ -216,6 +217,21 @@ def managed(name,
|
||||
# Populate the venv via a requirements file
|
||||
if requirements or pip_pkgs:
|
||||
before = set(__salt__['pip.freeze'](bin_env=name, user=user, use_vt=use_vt))
|
||||
|
||||
if requirements:
|
||||
|
||||
if isinstance(requirements, six.string_types):
|
||||
req_canary = requirements.split(',')[0]
|
||||
elif isinstance(requirements, list):
|
||||
req_canary = requirements[0]
|
||||
else:
|
||||
raise TypeError(
|
||||
'pip requirements must be either a string or a list'
|
||||
)
|
||||
|
||||
if req_canary != os.path.abspath(req_canary):
|
||||
cwd = os.path.dirname(os.path.abspath(req_canary))
|
||||
|
||||
_ret = __salt__['pip.install'](
|
||||
pkgs=pip_pkgs,
|
||||
requirements=requirements,
|
||||
|
@ -11,6 +11,7 @@ from __future__ import absolute_import
|
||||
import os
|
||||
import pwd
|
||||
import shutil
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
# Import Salt Testing libs
|
||||
@ -40,6 +41,26 @@ class PipModuleTest(integration.ModuleCase):
|
||||
os.makedirs(self.pip_temp)
|
||||
os.environ['PIP_SOURCE_DIR'] = os.environ['PIP_BUILD_DIR'] = ''
|
||||
|
||||
def pip_successful_install(self, target, expect=('flake8', 'pep8',)):
|
||||
'''
|
||||
isolate regex for extracting `successful install` message from pip
|
||||
'''
|
||||
|
||||
expect = set(expect)
|
||||
expect_str = '|'.join(expect)
|
||||
|
||||
success = re.search(
|
||||
r'^.*Successfully installed\s([^\n]+)(?:Clean.*)?',
|
||||
target,
|
||||
re.M | re.S)
|
||||
|
||||
success_for = re.findall(
|
||||
r'({0})(?:-(?:[\d\.-]))?'.format(expect_str),
|
||||
success.groups()[0]
|
||||
) if success else []
|
||||
|
||||
return expect.issubset(set(success_for))
|
||||
|
||||
def test_issue_2087_missing_pip(self):
|
||||
# Let's create the testing virtualenv
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
@ -61,6 +82,208 @@ class PipModuleTest(integration.ModuleCase):
|
||||
ret
|
||||
)
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_requirements_as_list_of_chains__sans_no_chown__cwd_set__absolute_file_path(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
||||
# Create a requirements file that depends on another one.
|
||||
|
||||
req1_filename = os.path.join(self.venv_dir, 'requirements1.txt')
|
||||
req1b_filename = os.path.join(self.venv_dir, 'requirements1b.txt')
|
||||
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
||||
req2b_filename = os.path.join(self.venv_dir, 'requirements2b.txt')
|
||||
|
||||
with salt.utils.fopen(req1_filename, 'wb') as f:
|
||||
f.write('-r requirements1b.txt\n')
|
||||
with salt.utils.fopen(req1b_filename, 'wb') as f:
|
||||
f.write('flake8\n')
|
||||
with salt.utils.fopen(req2_filename, 'wb') as f:
|
||||
f.write('-r requirements2b.txt\n')
|
||||
with salt.utils.fopen(req2b_filename, 'wb') as f:
|
||||
f.write('pep8\n')
|
||||
|
||||
this_user = pwd.getpwuid(os.getuid())[0]
|
||||
requirements_list = [req1_filename, req2_filename]
|
||||
|
||||
ret = self.run_function(
|
||||
'pip.install', requirements=requirements_list, user=this_user,
|
||||
bin_env=self.venv_dir, cwd=self.venv_dir
|
||||
)
|
||||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
|
||||
found = self.pip_successful_install(ret['stdout'])
|
||||
|
||||
self.assertTrue(found)
|
||||
except (AssertionError, TypeError):
|
||||
import pprint
|
||||
pprint.pprint(ret)
|
||||
raise
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_requirements_as_list_of_chains__sans_no_chown__cwd_not_set__absolute_file_path(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
||||
# Create a requirements file that depends on another one.
|
||||
|
||||
req1_filename = os.path.join(self.venv_dir, 'requirements1.txt')
|
||||
req1b_filename = os.path.join(self.venv_dir, 'requirements1b.txt')
|
||||
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
||||
req2b_filename = os.path.join(self.venv_dir, 'requirements2b.txt')
|
||||
|
||||
with salt.utils.fopen(req1_filename, 'wb') as f:
|
||||
f.write('-r requirements1b.txt\n')
|
||||
with salt.utils.fopen(req1b_filename, 'wb') as f:
|
||||
f.write('flake8\n')
|
||||
with salt.utils.fopen(req2_filename, 'wb') as f:
|
||||
f.write('-r requirements2b.txt\n')
|
||||
with salt.utils.fopen(req2b_filename, 'wb') as f:
|
||||
f.write('pep8\n')
|
||||
|
||||
this_user = pwd.getpwuid(os.getuid())[0]
|
||||
requirements_list = [req1_filename, req2_filename]
|
||||
|
||||
ret = self.run_function(
|
||||
'pip.install', requirements=requirements_list, user=this_user,
|
||||
bin_env=self.venv_dir
|
||||
)
|
||||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
|
||||
found = self.pip_successful_install(ret['stdout'])
|
||||
|
||||
self.assertTrue(found)
|
||||
|
||||
except (AssertionError, TypeError):
|
||||
import pprint
|
||||
pprint.pprint(ret)
|
||||
raise
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_requirements_as_list__sans_no_chown__absolute_file_path(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
||||
req1_filename = os.path.join(self.venv_dir, 'requirements.txt')
|
||||
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
||||
|
||||
with salt.utils.fopen(req1_filename, 'wb') as f:
|
||||
f.write('flake8\n')
|
||||
with salt.utils.fopen(req2_filename, 'wb') as f:
|
||||
f.write('pep8\n')
|
||||
|
||||
this_user = pwd.getpwuid(os.getuid())[0]
|
||||
requirements_list = [req1_filename, req2_filename]
|
||||
|
||||
ret = self.run_function(
|
||||
'pip.install', requirements=requirements_list, user=this_user,
|
||||
bin_env=self.venv_dir
|
||||
)
|
||||
|
||||
found = self.pip_successful_install(ret['stdout'])
|
||||
|
||||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
self.assertTrue(found)
|
||||
|
||||
except (AssertionError, TypeError):
|
||||
import pprint
|
||||
pprint.pprint(ret)
|
||||
raise
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_requirements_as_list__sans_no_chown__non_absolute_file_path(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
||||
# Create a requirements file that depends on another one.
|
||||
|
||||
req1_filename = 'requirements.txt'
|
||||
req2_filename = 'requirements2.txt'
|
||||
req_cwd = self.venv_dir
|
||||
|
||||
req1_filepath = os.path.join(req_cwd, req1_filename)
|
||||
req2_filepath = os.path.join(req_cwd, req2_filename)
|
||||
|
||||
with salt.utils.fopen(req1_filepath, 'wb') as f:
|
||||
f.write('flake8\n')
|
||||
with salt.utils.fopen(req2_filepath, 'wb') as f:
|
||||
f.write('pep8\n')
|
||||
|
||||
this_user = pwd.getpwuid(os.getuid())[0]
|
||||
requirements_list = [req1_filename, req2_filename]
|
||||
|
||||
ret = self.run_function(
|
||||
'pip.install', requirements=requirements_list, user=this_user,
|
||||
bin_env=self.venv_dir, cwd=req_cwd
|
||||
)
|
||||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
|
||||
found = self.pip_successful_install(ret['stdout'])
|
||||
self.assertTrue(found)
|
||||
|
||||
except (AssertionError, TypeError):
|
||||
import pprint
|
||||
pprint.pprint(ret)
|
||||
raise
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_chained_requirements__sans_no_chown__absolute_file_path(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
||||
# Create a requirements file that depends on another one.
|
||||
|
||||
req1_filename = os.path.join(self.venv_dir, 'requirements.txt')
|
||||
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
||||
|
||||
with salt.utils.fopen(req1_filename, 'wb') as f:
|
||||
f.write('-r requirements2.txt')
|
||||
with salt.utils.fopen(req2_filename, 'wb') as f:
|
||||
f.write('pep8')
|
||||
|
||||
this_user = pwd.getpwuid(os.getuid())[0]
|
||||
ret = self.run_function(
|
||||
'pip.install', requirements=req1_filename, user=this_user,
|
||||
bin_env=self.venv_dir
|
||||
)
|
||||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
self.assertIn('installed pep8', ret['stdout'])
|
||||
except (AssertionError, TypeError):
|
||||
import pprint
|
||||
pprint.pprint(ret)
|
||||
raise
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_chained_requirements__sans_no_chown__non_absolute_file_path(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
||||
# Create a requirements file that depends on another one.
|
||||
req_basepath = (self.venv_dir)
|
||||
|
||||
req1_filename = 'requirements.txt'
|
||||
req2_filename = 'requirements2.txt'
|
||||
|
||||
req1_file = os.path.join(self.venv_dir, req1_filename)
|
||||
req2_file = os.path.join(self.venv_dir, req2_filename)
|
||||
|
||||
with salt.utils.fopen(req1_file, 'wb') as f:
|
||||
f.write('-r requirements2.txt')
|
||||
with salt.utils.fopen(req2_file, 'wb') as f:
|
||||
f.write('pep8')
|
||||
|
||||
this_user = pwd.getpwuid(os.getuid())[0]
|
||||
ret = self.run_function(
|
||||
'pip.install', requirements=req1_filename, user=this_user,
|
||||
no_chown=False, cwd=req_basepath, bin_env=self.venv_dir
|
||||
)
|
||||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
self.assertIn('installed pep8', ret['stdout'])
|
||||
except (AssertionError, TypeError):
|
||||
import pprint
|
||||
pprint.pprint(ret)
|
||||
raise
|
||||
|
||||
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
||||
def test_issue_4805_nested_requirements_user_no_chown(self):
|
||||
self.run_function('virtualenv.create', [self.venv_dir])
|
||||
|
@ -30,7 +30,6 @@ class PipTestCase(TestCase):
|
||||
expected_cmd,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -62,7 +61,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -75,7 +73,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -99,7 +96,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -112,7 +108,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -125,7 +120,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', pkgs[0], '--editable', editables[0]],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -149,7 +143,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -162,7 +155,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -175,7 +167,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--use-mirrors', '--mirrors', mirrors[0]],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -201,7 +192,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -214,7 +204,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -227,7 +216,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--find-links', find_links[0], pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -250,7 +238,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -288,7 +275,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -312,7 +298,6 @@ class PipTestCase(TestCase):
|
||||
env={'VIRTUAL_ENV': '/test_env'},
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -328,7 +313,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--log', log_path, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -359,7 +343,6 @@ class PipTestCase(TestCase):
|
||||
expected_prefix + [10, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -372,7 +355,6 @@ class PipTestCase(TestCase):
|
||||
expected_prefix + ['10', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -397,7 +379,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--index-url', index_url, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -412,7 +393,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--extra-index-url', extra_index_url, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -426,7 +406,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--no-index', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -441,7 +420,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--build', build, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -456,7 +434,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--target', target, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -471,7 +448,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--download', download, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -485,7 +461,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--no-download', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -500,7 +475,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--download-cache', download_cache, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -515,7 +489,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--source', source, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -530,7 +503,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--exists-action', action, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -565,7 +537,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -578,7 +549,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -592,7 +562,6 @@ class PipTestCase(TestCase):
|
||||
install_options[0], pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -617,7 +586,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -630,7 +598,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -643,7 +610,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--global-option', global_options[0], pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -657,7 +623,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--upgrade', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -671,7 +636,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--force-reinstall', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -685,7 +649,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--ignore-installed', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -699,7 +662,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--no-deps', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -713,7 +675,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--no-install', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -728,7 +689,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--proxy', proxy, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -755,7 +715,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -769,7 +728,6 @@ class PipTestCase(TestCase):
|
||||
expected,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -783,7 +741,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--requirement', cached_reqs[0]],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -808,9 +765,9 @@ class PipTestCase(TestCase):
|
||||
pip.uninstall(requirements=requirements)
|
||||
mock.assert_called_once_with(
|
||||
expected,
|
||||
cwd=None,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -822,9 +779,9 @@ class PipTestCase(TestCase):
|
||||
pip.uninstall(requirements=','.join(requirements))
|
||||
mock.assert_called_once_with(
|
||||
expected,
|
||||
cwd=None,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -836,9 +793,9 @@ class PipTestCase(TestCase):
|
||||
pip.uninstall(requirements=requirements[0])
|
||||
mock.assert_called_once_with(
|
||||
['pip', 'uninstall', '-y', '--requirement', cached_reqs[0]],
|
||||
cwd=None,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -852,8 +809,8 @@ class PipTestCase(TestCase):
|
||||
mock.assert_called_once_with(
|
||||
['pip', 'uninstall', '-y', '--proxy', proxy, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
runas=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -868,8 +825,8 @@ class PipTestCase(TestCase):
|
||||
mock.assert_called_once_with(
|
||||
['pip', 'uninstall', '-y', '--log', log_path, pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
runas=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -894,9 +851,9 @@ class PipTestCase(TestCase):
|
||||
pip.uninstall(pkg, timeout=10)
|
||||
mock.assert_called_once_with(
|
||||
expected_prefix + [10, pkg],
|
||||
cwd=None,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -907,9 +864,9 @@ class PipTestCase(TestCase):
|
||||
pip.uninstall(pkg, timeout='10')
|
||||
mock.assert_called_once_with(
|
||||
expected_prefix + ['10', pkg],
|
||||
cwd=None,
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -942,8 +899,8 @@ class PipTestCase(TestCase):
|
||||
ret = pip.freeze()
|
||||
mock.assert_called_once_with(
|
||||
['pip', 'freeze'],
|
||||
runas=None,
|
||||
cwd=None,
|
||||
runas=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -973,8 +930,8 @@ class PipTestCase(TestCase):
|
||||
ret = pip.list_()
|
||||
mock.assert_called_with(
|
||||
['pip', 'freeze'],
|
||||
runas=None,
|
||||
cwd=None,
|
||||
runas=None,
|
||||
python_shell=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -1016,8 +973,8 @@ class PipTestCase(TestCase):
|
||||
ret = pip.list_(prefix='bb')
|
||||
mock.assert_called_with(
|
||||
['pip', 'freeze'],
|
||||
runas=None,
|
||||
cwd=None,
|
||||
runas=None,
|
||||
python_shell=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -1043,7 +1000,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
@ -1059,7 +1015,6 @@ class PipTestCase(TestCase):
|
||||
['pip', 'install', '--pre', pkg],
|
||||
saltenv='base',
|
||||
runas=None,
|
||||
cwd=None,
|
||||
use_vt=False,
|
||||
python_shell=False,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user