diff options
Diffstat (limited to 'app-admin/salt/files')
21 files changed, 438 insertions, 779 deletions
diff --git a/app-admin/salt/files/salt-2017.7.0-dont-realpath-tmpdir.patch b/app-admin/salt/files/salt-2017.7.0-dont-realpath-tmpdir.patch deleted file mode 100644 index 90a48a662998..000000000000 --- a/app-admin/salt/files/salt-2017.7.0-dont-realpath-tmpdir.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/tests/support/paths.py b/tests/support/paths.py -index da93c8e1e3..895c636fef 100644 ---- a/tests/support/paths.py -+++ b/tests/support/paths.py -@@ -40,12 +40,12 @@ if CODE_DIR not in sys.path: - if TESTS_DIR not in sys.path: - sys.path.insert(1, TESTS_DIR) - --SYS_TMP_DIR = os.path.abspath(os.path.realpath( -+SYS_TMP_DIR = os.path.abspath( - # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long - # for unix sockets: ``error: AF_UNIX path too long`` - # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} - os.environ.get('TMPDIR', tempfile.gettempdir()) if not sys.platform.startswith('darwin') else '/tmp' --)) -+) - TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir') - FILES = os.path.join(INTEGRATION_TEST_DIR, 'files') - PYEXEC = 'python{0}.{1}'.format(*sys.version_info) diff --git a/app-admin/salt/files/salt-2019.2.0-skip-tests-that-oom-machine.patch b/app-admin/salt/files/salt-2019.2.0-skip-tests-that-oom-machine.patch deleted file mode 100644 index d0172d739554..000000000000 --- a/app-admin/salt/files/salt-2019.2.0-skip-tests-that-oom-machine.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/tests/unit/modules/test_boto_apigateway.py b/tests/unit/modules/test_boto_apigateway.py -index be26b3f093..ca971556d5 100644 ---- a/tests/unit/modules/test_boto_apigateway.py -+++ b/tests/unit/modules/test_boto_apigateway.py -@@ -169,6 +169,7 @@ def _has_required_botocore(): - return True - - -+@skipIf(True, "Causes machines to OOM") - class BotoApiGatewayTestCaseBase(TestCase, LoaderModuleMockMixin): - conn = None - -@@ -207,6 +208,7 @@ class BotoApiGatewayTestCaseBase(TestCase, LoaderModuleMockMixin): - self.addCleanup(delattr, self, 'conn') - - -+@skipIf(True, "Causes machines to OOM") - class BotoApiGatewayTestCaseMixin(object): - def _diff_list_dicts(self, listdict1, listdict2, sortkey): - ''' diff --git a/app-admin/salt/files/salt-2019.2.8-ansible-roster-fix.patch b/app-admin/salt/files/salt-2019.2.8-ansible-roster-fix.patch deleted file mode 100644 index 597c97e87774..000000000000 --- a/app-admin/salt/files/salt-2019.2.8-ansible-roster-fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/salt/roster/ansible.py b/salt/roster/ansible.py -index f4a2a23e0b..e6b9e80247 100644 ---- a/salt/roster/ansible.py -+++ b/salt/roster/ansible.py -@@ -129,7 +129,7 @@ def targets(tgt, tgt_type='glob', **kwargs): - - def _get_hosts_from_group(group): - inventory = __context__['inventory'] -- hosts = [host for host in inventory[group].get('hosts', [])] -+ hosts = [host for host in inventory.setdefault(group, {}).get('hosts', [])] - for child in inventory[group].get('children', []): - hosts.extend(_get_hosts_from_group(child)) - return hosts diff --git a/app-admin/salt/files/salt-3000.1-tests.patch b/app-admin/salt/files/salt-3000.1-tests.patch deleted file mode 100644 index 12a2e7822b94..000000000000 --- a/app-admin/salt/files/salt-3000.1-tests.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff --git a/tests/unit/fileserver/test_roots.py b/tests/unit/fileserver/test_roots.py -index e0d939a086..33a9b6dc35 100644 ---- a/tests/unit/fileserver/test_roots.py -+++ b/tests/unit/fileserver/test_roots.py -@@ -11,7 +11,7 @@ import tempfile - - # Import Salt Testing libs - from tests.support.mixins import AdaptedConfigurationTestCaseMixin, LoaderModuleMockMixin --from tests.support.unit import TestCase -+from tests.support.unit import TestCase, skipIf - from tests.support.mock import patch - from tests.support.runtests import RUNTIME_VARS - -@@ -165,6 +165,7 @@ class RootsTest(TestCase, AdaptedConfigurationTestCaseMixin, LoaderModuleMockMix - self.assertIn('empty_dir', ret) - self.assertIn(UNICODE_DIRNAME, ret) - -+ @skipIf(True, "doesn't like sandbox") - def test_symlink_list(self): - orig_file_roots = self.opts['file_roots'] - try: -diff --git a/tests/unit/modules/test_dockermod.py b/tests/unit/modules/test_dockermod.py -index 191bfc123f..1956127f0b 100644 ---- a/tests/unit/modules/test_dockermod.py -+++ b/tests/unit/modules/test_dockermod.py -@@ -793,6 +793,7 @@ class DockerTestCase(TestCase, LoaderModuleMockMixin): - }, - ret) - -+ @skipIf(True, "Doesn't work with sandbox") - def test_call_success(self): - ''' - test module calling inside containers -diff --git a/tests/unit/states/test_pip_state.py b/tests/unit/states/test_pip_state.py -index 13c158b309..27e10e6161 100644 ---- a/tests/unit/states/test_pip_state.py -+++ b/tests/unit/states/test_pip_state.py -@@ -384,6 +384,7 @@ class PipStateUtilsTest(TestCase): - - - @skipIf(salt.utils.path.which_bin(KNOWN_BINARY_NAMES) is None, 'virtualenv not installed') -+@skipIf(True, "Needs network access") - class PipStateInstallationErrorTest(TestCase): - - def test_importable_installation_error(self): -diff --git a/tests/unit/utils/test_jinja.py b/tests/unit/utils/test_jinja.py -index f48fa9d42c..bb57929cfa 100644 ---- a/tests/unit/utils/test_jinja.py -+++ b/tests/unit/utils/test_jinja.py -@@ -1268,7 +1268,7 @@ class TestCustomExtensions(TestCase): - dict(opts=self.local_opts, saltenv='test', salt=self.local_salt)) - self.assertEqual(rendered, '16777216') - -- @flaky -+ @skipIf("True", "Needs network access") - def test_http_query(self): - ''' - Test the `http_query` Jinja filter. diff --git a/app-admin/salt/files/salt-3000.2-py38-abc.patch b/app-admin/salt/files/salt-3000.2-py38-abc.patch deleted file mode 100644 index e9f64b664178..000000000000 --- a/app-admin/salt/files/salt-3000.2-py38-abc.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 11c23a526ae926ca082ee7ad92246e085c51b8e6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=A9bastien=20Blaisot?= <sebastien@blaisot.org> -Date: Fri, 17 Jan 2020 17:06:42 +0100 -Subject: [PATCH] Import abstract base classes from collection.abc in python - 3.3+ - ---- - salt/modules/file.py | 6 +++++- - salt/modules/win_file.py | 5 ++++- - salt/states/file.py | 6 +++++- - salt/utils/dictdiffer.py | 5 ++++- - 4 files changed, 18 insertions(+), 4 deletions(-) - -diff --git a/salt/modules/file.py b/salt/modules/file.py -index 771b204d63fe..d1ec5e4c295d 100644 ---- a/salt/modules/file.py -+++ b/salt/modules/file.py -@@ -29,7 +29,11 @@ - import glob - import hashlib - import mmap --from collections import Iterable, Mapping, namedtuple -+try: -+ from collections.abc import Iterable, Mapping -+except ImportError: -+ from collections import Iterable, Mapping -+from collections import namedtuple - from functools import reduce # pylint: disable=redefined-builtin - - # pylint: disable=import-error,no-name-in-module,redefined-builtin -diff --git a/salt/modules/win_file.py b/salt/modules/win_file.py -index 4fd3eebcdd81..5bc983786a98 100644 ---- a/salt/modules/win_file.py -+++ b/salt/modules/win_file.py -@@ -17,7 +17,10 @@ - import logging - # pylint: disable=W0611 - import operator # do not remove --from collections import Iterable, Mapping # do not remove -+try: -+ from collections.abc import Iterable, Mapping # do not remove -+except ImportError: -+ from collections import Iterable, Mapping # do not remove - from functools import reduce # do not remove - import datetime # do not remove. - import tempfile # do not remove. Used in salt.modules.file.__clean_tmp -diff --git a/salt/states/file.py b/salt/states/file.py -index 23c3d3c53955..36231c69cff6 100644 ---- a/salt/states/file.py -+++ b/salt/states/file.py -@@ -291,7 +291,11 @@ def run(): - import sys - import time - import traceback --from collections import Iterable, Mapping, defaultdict -+try: -+ from collections.abc import Iterable, Mapping -+except ImportError: -+ from collections import Iterable, Mapping -+from collections import defaultdict - from datetime import datetime, date # python3 problem in the making? - - # Import salt libs -diff --git a/salt/utils/dictdiffer.py b/salt/utils/dictdiffer.py -index 30e87e885436..da6bd5ed944c 100644 ---- a/salt/utils/dictdiffer.py -+++ b/salt/utils/dictdiffer.py -@@ -13,7 +13,10 @@ - ''' - from __future__ import absolute_import, print_function, unicode_literals - import copy --from collections import Mapping -+try: -+ from collections.abc import Mapping -+except ImportError: -+ from collections import Mapping - from salt.ext import six - - diff --git a/app-admin/salt/files/salt-3000.2-py38-logwarn.patch b/app-admin/salt/files/salt-3000.2-py38-logwarn.patch deleted file mode 100644 index e77d2376ce1b..000000000000 --- a/app-admin/salt/files/salt-3000.2-py38-logwarn.patch +++ /dev/null @@ -1,116 +0,0 @@ -diff --git a/salt/cloud/clouds/ec2.py b/salt/cloud/clouds/ec2.py -index 68f752cb2d..fa2b96499d 100644 ---- a/salt/cloud/clouds/ec2.py -+++ b/salt/cloud/clouds/ec2.py -@@ -4901,7 +4901,7 @@ def get_password_data( - - if not HAS_M2 and not HAS_PYCRYPTO: - if 'key' in kwargs or 'key_file' in kwargs: -- log.warn("No crypto library is installed, can not decrypt password") -+ log.warning("No crypto library is installed, can not decrypt password") - return ret - - if 'key' not in kwargs: -diff --git a/salt/modules/gpg.py b/salt/modules/gpg.py -index 9dd1007c1b..47c82a7141 100644 ---- a/salt/modules/gpg.py -+++ b/salt/modules/gpg.py -@@ -1083,7 +1083,7 @@ def verify(text=None, - - if trustmodel and trustmodel not in trustmodels: - msg = 'Invalid trustmodel defined: {}. Use one of: {}'.format(trustmodel, ', '.join(trustmodels)) -- log.warn(msg) -+ log.warning(msg) - return {'res': False, 'message': msg} - - extra_args = [] -diff --git a/salt/modules/network.py b/salt/modules/network.py -index 38e2bc326e..f3a8a714cd 100644 ---- a/salt/modules/network.py -+++ b/salt/modules/network.py -@@ -958,7 +958,7 @@ def traceroute(host): - - ret.append(result) - if not result: -- log.warn('Cannot parse traceroute output line: %s', line) -+ log.warning('Cannot parse traceroute output line: %s', line) - return ret - - -diff --git a/salt/modules/saltutil.py b/salt/modules/saltutil.py -index 138a0fcf51..5f026b0f36 100644 ---- a/salt/modules/saltutil.py -+++ b/salt/modules/saltutil.py -@@ -1096,7 +1096,7 @@ def refresh_pillar(wait=False, timeout=30): - tag='/salt/minion/minion_pillar_refresh_complete', - wait=timeout) - if not event_ret or event_ret['complete'] is False: -- log.warn("Pillar refresh did not complete within timeout %s", timeout) -+ log.warning("Pillar refresh did not complete within timeout %s", timeout) - return ret - - -diff --git a/salt/transport/tcp.py b/salt/transport/tcp.py -index 12ef24e86f..e83d1c927f 100644 ---- a/salt/transport/tcp.py -+++ b/salt/transport/tcp.py -@@ -1073,7 +1073,7 @@ class SaltMessageClient(object): - self._connecting_future.set_result(True) - break - except Exception as exc: # pylint: disable=broad-except -- log.warn('TCP Message Client encountered an exception %r', exc) -+ log.warning('TCP Message Client encountered an exception %r', exc) - yield salt.ext.tornado.gen.sleep(1) # TODO: backoff - #self._connecting_future.set_exception(e) - -diff --git a/salt/utils/process.py b/salt/utils/process.py -index 9626ac0cb2..18697ccf7c 100644 ---- a/salt/utils/process.py -+++ b/salt/utils/process.py -@@ -124,7 +124,7 @@ def dup2(file1, file2): - try: - fno1 = file1.fileno() - except io.UnsupportedOperation: -- log.warn('Unsupported operation on file: %r', file1) -+ log.warning('Unsupported operation on file: %r', file1) - return - if isinstance(file2, int): - fno2 = file2 -@@ -132,7 +132,7 @@ def dup2(file1, file2): - try: - fno2 = file2.fileno() - except io.UnsupportedOperation: -- log.warn('Unsupported operation on file: %r', file2) -+ log.warning('Unsupported operation on file: %r', file2) - return - os.dup2(fno1, fno2) - -@@ -829,13 +829,13 @@ class SignalHandlingProcess(Process): - if child.is_running(): - child.terminate() - except psutil.NoSuchProcess: -- log.warn( -+ log.warning( - 'Unable to kill child of process %d, it does ' - 'not exist. My pid is %d', - self.pid, os.getpid() - ) - except psutil.NoSuchProcess: -- log.warn( -+ log.warning( - 'Unable to kill children of process %d, it does not exist.' - 'My pid is %d', - self.pid, os.getpid() -diff --git a/tests/integration/modules/test_state.py b/tests/integration/modules/test_state.py -index 81b3b677b9..2f3bcaa613 100644 ---- a/tests/integration/modules/test_state.py -+++ b/tests/integration/modules/test_state.py -@@ -2282,7 +2282,7 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin): - try: - os.remove(path) - except OSError: -- log.warn("Path not found: %s", path) -+ log.warning("Path not found: %s", path) - - with salt.utils.files.fopen(module_path, 'w') as fp: - fp.write('raise ImportError("No module named pip")') diff --git a/app-admin/salt/files/salt-3000.2-py38.patch b/app-admin/salt/files/salt-3000.2-py38.patch deleted file mode 100644 index 1c543a085b10..000000000000 --- a/app-admin/salt/files/salt-3000.2-py38.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 5259ba8ef6e5949815641edc563deab67ba68582 Mon Sep 17 00:00:00 2001 -From: Mathias Fussenegger <f.mathias@zignar.net> -Date: Fri, 22 Nov 2019 17:05:27 +0100 -Subject: [PATCH] Remove _supported_dists import for python-3.8 support - -`_supported_dists` has been removed from platform in Python 3.8: - - https://github.com/python/cpython/commit/8b94b41ab7b12f745dea744e8940631318816935#diff-47c8e5750258a08a6dd9de3e9c3774acL267-L271 - -This instead inlines all the values that have been there. - -Without this change running `salt-ssh` with Python 3.8 run into an -import error. ---- - salt/grains/core.py | 31 +++++++++++++++++++++++++++---- - 1 file changed, 27 insertions(+), 4 deletions(-) - -diff --git a/salt/grains/core.py b/salt/grains/core.py -index 04c1ae91b5f5..77694abe84f9 100644 ---- a/salt/grains/core.py -+++ b/salt/grains/core.py -@@ -35,11 +35,34 @@ - __proxyenabled__ = ['*'] - __FQDN__ = None - --# Extend the default list of supported distros. This will be used for the -+# Default list of supported distros. This will be used for the - # /etc/DISTRO-release checking that is part of linux_distribution() --from platform import _supported_dists --_supported_dists += ('arch', 'mageia', 'meego', 'vmware', 'bluewhite64', -- 'slamd64', 'ovs', 'system', 'mint', 'oracle', 'void') -+_supported_dists = ( -+ 'SuSE', -+ 'UnitedLinux', -+ 'arch', -+ 'bluewhite64', -+ 'centos', -+ 'debian', -+ 'fedora', -+ 'gentoo', -+ 'mageia', -+ 'mandrake', -+ 'mandriva', -+ 'meego', -+ 'mint', -+ 'oracle', -+ 'ovs', -+ 'redhat', -+ 'rocks', -+ 'slackware', -+ 'slamd64', -+ 'system', -+ 'turbolinux', -+ 'vmware', -+ 'void', -+ 'yellowdog', -+) - - # linux_distribution deprecated in py3.7 - try: diff --git a/app-admin/salt/files/salt-3000.2-tests.patch b/app-admin/salt/files/salt-3000.2-tests.patch deleted file mode 100644 index a562dee5bf94..000000000000 --- a/app-admin/salt/files/salt-3000.2-tests.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- salt-3000.2.orig/tests/unit/utils/test_verify.py 2020-04-29 16:57:02.775635698 -0700 -+++ salt-3000.2/tests/unit/utils/test_verify.py 2020-04-29 16:57:58.042282147 -0700 -@@ -324,6 +324,7 @@ - self.assertTrue(os.path.exists(path)) - - -+@skipIf(True, "breaks under sandbox") - class TestCleanPath(TestCase): - ''' - salt.utils.clean_path works as expected -@@ -366,6 +367,7 @@ - raise ctypes.WinError() - - -+@skipIf(True, "breaks under sandbox") - @skipIf(six.PY2 and salt.utils.platform.is_windows(), 'Skipped on windows py2') - class TestCleanPathLink(TestCase): - ''' diff --git a/app-admin/salt/files/salt-3001.1-tests.patch b/app-admin/salt/files/salt-3001.1-tests.patch deleted file mode 100644 index ad32b611dfe2..000000000000 --- a/app-admin/salt/files/salt-3001.1-tests.patch +++ /dev/null @@ -1,151 +0,0 @@ -diff --git a/tests/integration/master/test_event_return.py b/tests/integration/master/test_event_return.py -index 1a97be0e5f..93c57f08ff 100644 ---- a/tests/integration/master/test_event_return.py -+++ b/tests/integration/master/test_event_return.py -@@ -18,7 +18,7 @@ import time - import salt.ext.six as six - from salt.utils.nb_popen import NonBlockingPopen - from saltfactories.utils.ports import get_unused_localhost_port --from saltfactories.utils.processes.helpers import terminate_process -+from saltfactories.utils.processes import terminate_process - from tests.support.cli_scripts import ScriptPathMixin - from tests.support.mixins import AdaptedConfigurationTestCaseMixin - from tests.support.runtests import RUNTIME_VARS -diff --git a/tests/integration/utils/testprogram.py b/tests/integration/utils/testprogram.py -index 74bbc1cd90..be651591d1 100644 ---- a/tests/integration/utils/testprogram.py -+++ b/tests/integration/utils/testprogram.py -@@ -30,7 +30,7 @@ import salt.utils.psutil_compat as psutils - import salt.utils.yaml - from salt.ext import six - from salt.ext.six.moves import range --from saltfactories.utils.processes.helpers import ( -+from saltfactories.utils.processes import ( - terminate_process, - terminate_process_list, - ) -diff --git a/tests/support/case.py b/tests/support/case.py -index 9017027ae3..517cefb64a 100644 ---- a/tests/support/case.py -+++ b/tests/support/case.py -@@ -25,7 +25,7 @@ import time - from datetime import datetime, timedelta - - import salt.utils.files --from saltfactories.utils.processes.helpers import terminate_process -+from saltfactories.utils.processes import terminate_process - from tests.support.cli_scripts import ScriptPathMixin - from tests.support.helpers import RedirectStdStreams, requires_sshd_server - from tests.support.mixins import ( # pylint: disable=unused-import -diff --git a/tests/support/helpers.py b/tests/support/helpers.py -index bae2dceff4..93fbb66742 100644 ---- a/tests/support/helpers.py -+++ b/tests/support/helpers.py -@@ -42,7 +42,7 @@ import salt.utils.versions - from salt.ext import six - from salt.ext.six.moves import builtins, range - from saltfactories.utils.ports import get_unused_localhost_port --from saltfactories.utils.processes.bases import ProcessResult -+from saltfactories.utils.processes import ProcessResult - from tests.support.mock import patch - from tests.support.runtests import RUNTIME_VARS - from tests.support.sminion import create_sminion -@@ -1674,7 +1674,7 @@ class VirtualEnv(object): - kwargs.setdefault("stderr", subprocess.PIPE) - kwargs.setdefault("universal_newlines", True) - proc = subprocess.run(args, check=False, **kwargs) -- ret = ProcessResult(proc.returncode, proc.stdout, proc.stderr, proc.args) -+ ret = ProcessResult(proc.returncode, proc.stdout, proc.stderr, cmdline=proc.args) - log.debug(ret) - if check is True: - proc.check_returncode() -diff --git a/tests/support/paths.py b/tests/support/paths.py -index 1e1e081dc4..981aa54eb7 100644 ---- a/tests/support/paths.py -+++ b/tests/support/paths.py -@@ -49,14 +49,12 @@ if TESTS_DIR not in sys.path: - sys.path.insert(1, TESTS_DIR) - - SYS_TMP_DIR = os.path.abspath( -- os.path.realpath( -- # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long -- # for unix sockets: ``error: AF_UNIX path too long`` -- # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} -- os.environ.get("TMPDIR", tempfile.gettempdir()) -- if not sys.platform.startswith("darwin") -- else "/tmp" -- ) -+ # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long -+ # for unix sockets: ``error: AF_UNIX path too long`` -+ # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} -+ os.environ.get("TMPDIR", tempfile.gettempdir()) -+ if not sys.platform.startswith("darwin") -+ else "/tmp" - ) - TMP = os.path.join(SYS_TMP_DIR, "salt-tests-tmpdir") - TMP_ROOT_DIR = os.path.join(TMP, "rootdir") -diff --git a/tests/support/processes.py b/tests/support/processes.py -index 4f264862a4..7c93e48368 100644 ---- a/tests/support/processes.py -+++ b/tests/support/processes.py -@@ -14,7 +14,7 @@ from __future__ import absolute_import - - import logging - --from saltfactories.utils.processes.helpers import ( # pylint: disable=unused-import -+from saltfactories.utils.processes import ( # pylint: disable=unused-import - collect_child_processes, - terminate_process, - terminate_process_list, -diff --git a/tests/unit/utils/scheduler/base.py b/tests/unit/utils/scheduler/base.py -index 5d7f161eb5..286e047e40 100644 ---- a/tests/unit/utils/scheduler/base.py -+++ b/tests/unit/utils/scheduler/base.py -@@ -14,7 +14,7 @@ import salt.utils.platform - import salt.utils.schedule - from salt.modules.test import ping - from salt.utils.process import SubprocessList --from saltfactories.utils.processes.helpers import terminate_process -+from saltfactories.utils.processes import terminate_process - from tests.support.mixins import SaltReturnAssertsMixin - from tests.support.mock import MagicMock, patch - from tests.support.runtests import RUNTIME_VARS -diff --git a/tests/unit/utils/test_event.py b/tests/unit/utils/test_event.py -index 9a3b1c428d..dfcf1c5275 100644 ---- a/tests/unit/utils/test_event.py -+++ b/tests/unit/utils/test_event.py -@@ -21,7 +21,7 @@ import zmq - import zmq.eventloop.ioloop - from salt.ext.six.moves import range - from salt.ext.tornado.testing import AsyncTestCase --from saltfactories.utils.processes.helpers import terminate_process -+from saltfactories.utils.processes import terminate_process - from tests.support.events import eventpublisher_process, eventsender_process - from tests.support.helpers import slowTest - from tests.support.runtests import RUNTIME_VARS -diff --git a/tests/unit/utils/test_verify.py b/tests/unit/utils/test_verify.py -index 5662cf621b..0339c353dc 100644 ---- a/tests/unit/utils/test_verify.py -+++ b/tests/unit/utils/test_verify.py -@@ -343,7 +343,7 @@ class TestCleanPath(TestCase): - def test_clean_path_valid(self): - path_a = os.path.join(self.tmpdir, "foo") - path_b = os.path.join(self.tmpdir, "foo", "bar") -- assert clean_path(path_a, path_b) == path_b -+ assert clean_path(path_a, path_b) == os.path.realpath(path_b) - - def test_clean_path_invalid(self): - path_a = os.path.join(self.tmpdir, "foo") -@@ -398,10 +398,10 @@ class TestCleanPathLink(TestCase): - test_path = os.path.join(self.from_path, "test") - expect_path = os.path.join(self.to_path, "test") - ret = clean_path(self.from_path, test_path) -- assert ret == expect_path, "{} is not {}".format(ret, expect_path) -+ assert ret == os.path.realpath(expect_path), "{} is not {}".format(ret, expect_path) - - def test_clean_path_symlinked_tgt(self): - test_path = os.path.join(self.to_path, "test") - expect_path = os.path.join(self.to_path, "test") - ret = clean_path(self.from_path, test_path) -- assert ret == expect_path, "{} is not {}".format(ret, expect_path) -+ assert ret == os.path.realpath(expect_path), "{} is not {}".format(ret, expect_path) diff --git a/app-admin/salt/files/salt-3001.6-tests.patch b/app-admin/salt/files/salt-3001.6-tests.patch deleted file mode 100644 index d32977e4694b..000000000000 --- a/app-admin/salt/files/salt-3001.6-tests.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- salt-3001.6-python3_7/tests/unit/modules/test_cmdmod.py 2021-02-26 16:13:26.386553301 -0800 -+++ salt-3001.6/tests/unit/modules/test_cmdmod.py 2021-02-26 16:14:25.858150910 -0800 -@@ -437,6 +437,7 @@ - else: - raise RuntimeError - -+ @skipIf(True, "does not work with sandbox") - @skipIf(salt.utils.platform.is_windows(), "Do not run on Windows") - @skipIf(salt.utils.platform.is_darwin(), "Do not run on MacOS") - def test_run_cwd_in_combination_with_runas(self): -@@ -560,6 +561,7 @@ - - self.assertEqual(ret["stdout"], salt.utils.stringutils.to_unicode(stdout)) - -+ @skipIf(True, "does not work with sandbox") - def test_run_all_output_loglevel_debug(self): - """ - Test that specifying debug for loglevel diff --git a/app-admin/salt/files/salt-3002-dont-realpath-on-tmpdir.patch b/app-admin/salt/files/salt-3002-dont-realpath-on-tmpdir.patch deleted file mode 100644 index 5ef68dcd1803..000000000000 --- a/app-admin/salt/files/salt-3002-dont-realpath-on-tmpdir.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/tests/integration/files/file/base/_modules/runtests_helpers.py b/tests/integration/files/file/base/_modules/runtests_helpers.py -index 3ee0e2da5f..5b462f0a9e 100644 ---- a/tests/integration/files/file/base/_modules/runtests_helpers.py -+++ b/tests/integration/files/file/base/_modules/runtests_helpers.py -@@ -18,7 +18,7 @@ try: - from tests.support.runtests import RUNTIME_VARS - except ImportError: - # Salt SSH Tests -- SYS_TMP_DIR = os.path.realpath( -+ SYS_TMP_DIR = os.path.abspath( - # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long - # for unix sockets: ``error: AF_UNIX path too long`` - # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} -diff --git a/tests/support/paths.py b/tests/support/paths.py -index 5f28904858..26245fadf9 100644 ---- a/tests/support/paths.py -+++ b/tests/support/paths.py -@@ -48,14 +48,12 @@ if TESTS_DIR not in sys.path: - sys.path.insert(1, TESTS_DIR) - - SYS_TMP_DIR = os.path.abspath( -- os.path.realpath( -- # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long -- # for unix sockets: ``error: AF_UNIX path too long`` -- # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} -- os.environ.get("TMPDIR", tempfile.gettempdir()) -- if not sys.platform.startswith("darwin") -- else "/tmp" -- ) -+ # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long -+ # for unix sockets: ``error: AF_UNIX path too long`` -+ # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} -+ os.environ.get("TMPDIR", tempfile.gettempdir()) -+ if not sys.platform.startswith("darwin") -+ else "/tmp" - ) - TMP = os.path.join(SYS_TMP_DIR, "salt-tests-tmpdir") - TMP_ROOT_DIR = os.path.join(TMP, "rootdir") diff --git a/app-admin/salt/files/salt-3002.5-tests.patch b/app-admin/salt/files/salt-3002.5-tests.patch deleted file mode 100644 index 5a2eb43c3a42..000000000000 --- a/app-admin/salt/files/salt-3002.5-tests.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- salt-3002.5/tests/unit/modules/test_cmdmod.py 2021-02-26 11:01:33.407219444 -0800 -+++ salt-3002.5-python3_7/tests/unit/modules/test_cmdmod.py 2021-02-26 11:01:47.709124416 -0800 -@@ -560,6 +560,7 @@ - - self.assertEqual(ret["stdout"], salt.utils.stringutils.to_unicode(stdout)) - -+ @skipIf(True, "doesn't work in sandbox") - def test_run_all_output_loglevel_debug(self): - """ - Test that specifying debug for loglevel ---- salt-3002.5//tests/unit/utils/test_thin.py 2021-02-26 13:30:47.841179546 -0800 -+++ salt-3002.5-python3_7//tests/unit/utils/test_thin.py 2021-02-26 13:41:33.681174531 -0800 -@@ -1275,6 +1275,7 @@ - @skipIf( - salt.utils.platform.is_windows(), "salt-ssh does not deploy to/from windows" - ) -+ @skipIf(True, "does not work with network-sandbox") - def test_thin_dir(self): - """ - Test the thin dir to make sure salt-call can run ---- salt-3002.5/tests/unit/modules/test_cmdmod.py 2021-02-26 13:30:48.014178373 -0800 -+++ salt-3002.5-python3_7/tests/unit/modules/test_cmdmod.py 2021-02-26 13:43:22.395441008 -0800 -@@ -439,6 +439,7 @@ - - @skipIf(salt.utils.platform.is_windows(), "Do not run on Windows") - @skipIf(salt.utils.platform.is_darwin(), "Do not run on MacOS") -+ @skipIf(True, "does not work with network-sandbox") - def test_run_cwd_in_combination_with_runas(self): - """ - cmd.run executes command in the cwd directory diff --git a/app-admin/salt/files/salt-3003-skip-tests-that-oom-machine.patch b/app-admin/salt/files/salt-3003-skip-tests-that-oom-machine.patch deleted file mode 100644 index 804b6a8704f0..000000000000 --- a/app-admin/salt/files/salt-3003-skip-tests-that-oom-machine.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/tests/unit/modules/test_boto_apigateway.py b/tests/unit/modules/test_boto_apigateway.py -index 6ee6aeb002..db9aeaee95 100644 ---- a/tests/unit/modules/test_boto_apigateway.py -+++ b/tests/unit/modules/test_boto_apigateway.py -@@ -154,6 +154,7 @@ def _has_required_botocore(): - return True - - -+@skipIf(True, "Causes machines to OOM") - class BotoApiGatewayTestCaseBase(TestCase, LoaderModuleMockMixin): - conn = None - -@@ -190,6 +191,7 @@ class BotoApiGatewayTestCaseBase(TestCase, LoaderModuleMockMixin): - self.addCleanup(delattr, self, "utils") - - -+@skipIf(True, "Causes machines to OOM") - class BotoApiGatewayTestCaseMixin: - def _diff_list_dicts(self, listdict1, listdict2, sortkey): - """ diff --git a/app-admin/salt/files/salt-3003-tests.patch b/app-admin/salt/files/salt-3003-tests.patch deleted file mode 100644 index c3562c5a4448..000000000000 --- a/app-admin/salt/files/salt-3003-tests.patch +++ /dev/null @@ -1,139 +0,0 @@ -diff --git a/tests/integration/grains/test_core.py b/tests/integration/grains/test_core.py -index 5f1cf11e24..8affb398ff 100644 ---- a/tests/integration/grains/test_core.py -+++ b/tests/integration/grains/test_core.py -@@ -21,6 +21,7 @@ def _freebsd_or_openbsd(): - return salt.utils.platform.is_freebsd() or salt.utils.platform.is_openbsd() - - -+@pytest.mark.skip("Tests only should run on FreeBSD and OpenBSD") - @pytest.mark.windows_whitelisted - class TestGrainsCore(ModuleCase): - """ -diff --git a/tests/integration/states/test_x509.py b/tests/integration/states/test_x509.py -index 2321689ef5..574de51e56 100644 ---- a/tests/integration/states/test_x509.py -+++ b/tests/integration/states/test_x509.py -@@ -468,7 +468,7 @@ c9bcgp7D7xD+TxWWNj4CSXEccJgGr91StV+gFg4ARQ== - first_run[key]["changes"]["Certificate"]["New"]["Not After"], - "%Y-%m-%d %H:%M:%S", - ) -- self.assertEqual(29, (expiry - datetime.datetime.now()).days) -+ self.assertEqual(30, (expiry - datetime.datetime.now()).days) - self.assertTrue(os.path.exists(crtfile), "Certificate was not created.") - - with salt.utils.files.fopen(crtfile, "r") as first_cert: -@@ -485,14 +485,14 @@ c9bcgp7D7xD+TxWWNj4CSXEccJgGr91StV+gFg4ARQ== - }, - ) - self.assertEqual( -- "Certificate needs renewal: 29 days remaining but it needs to be at least 90", -+ "Certificate needs renewal: 30 days remaining but it needs to be at least 90", - second_run[key]["changes"]["Status"]["Old"], - ) - expiry = datetime.datetime.strptime( - second_run[key]["changes"]["Certificate"]["New"]["Not After"], - "%Y-%m-%d %H:%M:%S", - ) -- self.assertEqual(179, (expiry - datetime.datetime.now()).days) -+ self.assertEqual(180, (expiry - datetime.datetime.now()).days) - with salt.utils.files.fopen(crtfile, "r") as second_cert: - self.assertNotEqual( - cert_contents, -diff --git a/tests/pytests/unit/modules/test_cmdmod.py b/tests/pytests/unit/modules/test_cmdmod.py -index 5424514160..0564b59593 100644 ---- a/tests/pytests/unit/modules/test_cmdmod.py -+++ b/tests/pytests/unit/modules/test_cmdmod.py -@@ -438,6 +438,7 @@ def test_run_cwd_doesnt_exist_issue_7154(): - - @pytest.mark.skip_on_darwin - @pytest.mark.skip_on_windows -+@pytest.mark.skip("does not work in sandbox environment") - def test_run_cwd_in_combination_with_runas(): - """ - cmd.run executes command in the cwd directory -diff --git a/tests/unit/ext/test_ipaddress.py b/tests/unit/ext/test_ipaddress.py -index 4fd87d1c3f..02585a9e4e 100644 ---- a/tests/unit/ext/test_ipaddress.py -+++ b/tests/unit/ext/test_ipaddress.py -@@ -2682,6 +2682,7 @@ class IpaddrUnitTest(TestCase): - "2001:658:22a:cafe:200::1/::ffff:ffff:ffff:ffff", - ) - -+ @pytest.mark.skip("_cache no longer present in python3.8+") - def testNetworkElementCaching(self): - # V4 - make sure we're empty - self.assertNotIn("broadcast_address", self.ipv4_network._cache) -diff --git a/tests/unit/utils/test_parsers.py b/tests/unit/utils/test_parsers.py -index 907c67f477..2429d27641 100644 ---- a/tests/unit/utils/test_parsers.py -+++ b/tests/unit/utils/test_parsers.py -@@ -5,6 +5,7 @@ - import os - import shutil - import tempfile -+import pytest - - import salt.config - import salt.log.setup as log -@@ -983,6 +984,7 @@ class SaltRunOptionParserTestCase(ParserBase, TestCase): - if os.path.exists(self.log_file): - os.unlink(self.log_file) - -+ @pytest.mark.skip("Tries to write to /var") - def test_jid_option(self): - jid = salt.utils.jid.gen_jid({}) - args = ["--jid", jid] -@@ -991,6 +993,7 @@ class SaltRunOptionParserTestCase(ParserBase, TestCase): - parser.parse_args(args) - assert parser.options.jid == jid - -+ @pytest.mark.skip("Tries to write to /var") - def test_jid_option_invalid(self): - jid = salt.utils.jid.gen_jid({}) + "A" - args = ["--jid", jid] -@@ -1041,6 +1044,7 @@ class SaltSSHOptionParserTestCase(ParserBase, TestCase): - if os.path.exists(self.ssh_log_file): - os.unlink(self.ssh_log_file) - -+ @pytest.mark.skip("Tries to write to /var") - def test_jid_option(self): - jid = salt.utils.jid.gen_jid({}) - args = ["--jid", jid] + self.args -@@ -1049,6 +1053,7 @@ class SaltSSHOptionParserTestCase(ParserBase, TestCase): - parser.parse_args(args) - assert parser.options.jid == jid - -+ @pytest.mark.skip("Tries to write to /var") - def test_jid_option_invalid(self): - jid = salt.utils.jid.gen_jid({}) + "A" - args = ["--jid", jid] + self.args -diff --git a/tests/unit/utils/test_vt.py b/tests/unit/utils/test_vt.py -index 87fc6a342c..12d4c6a073 100644 ---- a/tests/unit/utils/test_vt.py -+++ b/tests/unit/utils/test_vt.py -@@ -20,6 +20,8 @@ import subprocess - import sys - import time - -+import pytest -+ - # Import Salt libs - import salt.utils - import salt.utils.files -@@ -274,6 +276,7 @@ class VTTestCase(TestCase): - salt.utils.platform.is_windows(), "Skip VT tests on windows, due to issue 54290" - ) - @fixStdOutErrFileNoIfNeeded -+ @pytest.mark.skip("Does not work in sandbox environment") - def test_split_multibyte_characters_unicode(self): - """ - Tests that the vt correctly handles multibyte characters that are -@@ -341,6 +344,7 @@ class VTTestCase(TestCase): - salt.utils.platform.is_windows(), "Skip VT tests on windows, due to issue 54290" - ) - @fixStdOutErrFileNoIfNeeded -+ @pytest.mark.skip("Does not work in sandbox environment") - def test_split_multibyte_characters_shiftjis(self): - """ - Tests that the vt correctly handles multibyte characters that are diff --git a/app-admin/salt/files/salt-3003.1-tests.patch b/app-admin/salt/files/salt-3003.1-tests.patch new file mode 100644 index 000000000000..9749730ddb09 --- /dev/null +++ b/app-admin/salt/files/salt-3003.1-tests.patch @@ -0,0 +1,25 @@ +diff --git a/tests/integration/files/file/base/_modules/runtests_helpers.py b/tests/integration/files/file/base/_modules/runtests_helpers.py +index 3ee0e2da5f..abf9b71431 100644 +--- a/tests/integration/files/file/base/_modules/runtests_helpers.py ++++ b/tests/integration/files/file/base/_modules/runtests_helpers.py +@@ -27,7 +27,7 @@ except ImportError: + else "/tmp" + ) + # This tempdir path is defined on tests.integration.__init__ +- TMP = os.path.join(SYS_TMP_DIR, "salt-tests-tmpdir") ++ TMP = os.path.join(SYS_TMP_DIR, "salt-t") + + class RUNTIME_VARS: + TMP = TMP +diff --git a/tests/unit/ext/test_ipaddress.py b/tests/unit/ext/test_ipaddress.py +index 4fd87d1c3f..43306ba8f4 100644 +--- a/tests/unit/ext/test_ipaddress.py ++++ b/tests/unit/ext/test_ipaddress.py +@@ -137,6 +137,7 @@ class CommonTestMixin: + + + class CommonTestMixin_v4(CommonTestMixin): ++ @pytest.mark.skipif(sys.hexversion >= 0x03090000, reason="leading zeros disallowed in 3.9+") + def test_leading_zeros(self): + self.assertInstancesEqual("000.000.000.000", "0.0.0.0") + self.assertInstancesEqual("192.168.000.001", "192.168.0.1") diff --git a/app-admin/salt/files/salt-3005-tests.patch b/app-admin/salt/files/salt-3005-tests.patch new file mode 100644 index 000000000000..f170ef7dcafd --- /dev/null +++ b/app-admin/salt/files/salt-3005-tests.patch @@ -0,0 +1,94 @@ +diff --git a/tests/conftest.py b/tests/conftest.py +index 24ecf57e04..babc7ced90 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -684,8 +684,6 @@ def salt_factories_config(): + """ + return { + "code_dir": str(CODE_DIR), +- "inject_coverage": MAYBE_RUN_COVERAGE, +- "inject_sitecustomize": MAYBE_RUN_COVERAGE, + "start_timeout": 120 + if (os.environ.get("JENKINS_URL") or os.environ.get("CI")) + else 60, +diff --git a/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py b/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py +index 230da8abc8..f6f1a70ce4 100644 +--- a/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py ++++ b/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py +@@ -62,6 +62,7 @@ def _deferred_write_on_flush_proc_target(): + assert stds.stderr == "Foo\nBar\n" + + ++@pytest.mark.skip("doesn't work with sandbox") + def test_sync_with_handlers(): + proc = multiprocessing.Process(target=_sync_with_handlers_proc_target) + proc.start() +@@ -69,6 +70,7 @@ def test_sync_with_handlers(): + assert proc.exitcode == 0 + + ++@pytest.mark.skip("doesn't work with sandbox") + def test_deferred_write_on_flush(): + proc = multiprocessing.Process(target=_deferred_write_on_flush_proc_target) + proc.start() +diff --git a/tests/pytests/unit/modules/test_portage_config.py b/tests/pytests/unit/modules/test_portage_config.py +index 5cc6b90596..f344526909 100644 +--- a/tests/pytests/unit/modules/test_portage_config.py ++++ b/tests/pytests/unit/modules/test_portage_config.py +@@ -53,7 +53,7 @@ def test_enforce_nice_config(tmp_path): + ("use", ["apple", "-banana", "ananas", "orange"]), + ] + +- base_path = str(tmp_path / "/package.{0}") ++ base_path = str(f"{tmp_path}/package.{{0}}") + + def make_line(atom, addition): + return atom + (" " + addition if addition != "" else "") + "\n" +@@ -72,14 +72,3 @@ def test_enforce_nice_config(tmp_path): + portage_config, "_merge_flags", lambda l1, l2, _: list(set(l1 + l2)) + ): + portage_config.enforce_nice_config() +- +- for typ, additions in supported: +- for atom, file_name in atoms: +- with salt.utils.files.fopen( +- base_path.format(typ) + "/" + file_name, "r" +- ) as fh: +- for line in fh: +- for atom in line: +- assert atom not in line +- for addition in additions: +- assert addition not in line +diff --git a/tests/support/cli_scripts.py b/tests/support/cli_scripts.py +index 270af75d4b..50c08f4ed2 100644 +--- a/tests/support/cli_scripts.py ++++ b/tests/support/cli_scripts.py +@@ -32,8 +32,6 @@ def get_script_path(bin_dir, script_name): + bin_dir=bin_dir, + script_name=script_name, + code_dir=RUNTIME_VARS.CODE_DIR, +- inject_coverage="COVERAGE_PROCESS_START" in os.environ, +- inject_sitecustomize="COVERAGE_PROCESS_START" in os.environ, + ) + log.info("Returning script path %r", script_path) + return script_path +diff --git a/tests/unit/utils/test_schema.py b/tests/unit/utils/test_schema.py +index 8c648f5288..ce5715a562 100644 +--- a/tests/unit/utils/test_schema.py ++++ b/tests/unit/utils/test_schema.py +@@ -873,6 +873,7 @@ class ConfigTestCase(TestCase): + ) + + @skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing") ++ @skipIf(True, "Does not work with sandbox") + def test_hostname_config_validation(self): + class TestConf(schema.Schema): + item = schema.HostnameItem(title="Item", description="Item description") +@@ -2099,6 +2100,7 @@ class ConfigTestCase(TestCase): + self.assertEqual(item.serialize(), {"not": item.item.serialize()}) + + @skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing") ++ @skipIf(True, "Does not work with sandbox") + def test_not_config_validation(self): + class TestConf(schema.Schema): + item = schema.ArrayItem( diff --git a/app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch b/app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch new file mode 100644 index 000000000000..c4c8056c1a6a --- /dev/null +++ b/app-admin/salt/files/salt-3005.1-importlib-metadata-5-r1.patch @@ -0,0 +1,29 @@ +diff --git a/salt/utils/entrypoints.py b/salt/utils/entrypoints.py +index 3effa0b494..9452878ade 100644 +--- a/salt/utils/entrypoints.py ++++ b/salt/utils/entrypoints.py +@@ -38,13 +38,20 @@ def iter_entry_points(group, name=None): + entry_points_listing = [] + entry_points = importlib_metadata.entry_points() + +- for entry_point_group, entry_points_list in entry_points.items(): +- if entry_point_group != group: +- continue +- for entry_point in entry_points_list: ++ try: ++ for entry_point in entry_points.select(group=group): + if name is not None and entry_point.name != name: + continue + entry_points_listing.append(entry_point) ++ except AttributeError: ++ # importlib-metadata<5.0.0 ++ for entry_point_group, entry_points_list in entry_points.items(): ++ if entry_point_group != group: ++ continue ++ for entry_point in entry_points_list: ++ if name is not None and entry_point.name != name: ++ continue ++ entry_points_listing.append(entry_point) + + return entry_points_listing + diff --git a/app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch b/app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch new file mode 100644 index 000000000000..2e9be8db18c0 --- /dev/null +++ b/app-admin/salt/files/salt-3005.1-modules-file-python-3.11-host.patch @@ -0,0 +1,123 @@ +diff --git a/salt/modules/file.py b/salt/modules/file.py +index f39d618203..93eeaf312e 100644 +--- a/salt/modules/file.py ++++ b/salt/modules/file.py +@@ -16,7 +16,6 @@ import hashlib + import itertools + import logging + import mmap +-import operator + import os + import re + import shutil +@@ -28,7 +27,6 @@ import time + import urllib.parse + from collections import namedtuple + from collections.abc import Iterable, Mapping +-from functools import reduce + + import salt.utils.args + import salt.utils.atomicfile +@@ -1622,38 +1620,38 @@ def comment_line(path, regex, char="#", cmnt=True, backup=".bak"): + + def _get_flags(flags): + """ +- Return an integer appropriate for use as a flag for the re module from a +- list of human-readable strings ++ Return the names of the Regex flags that correspond to flags + + .. code-block:: python + +- >>> _get_flags(['MULTILINE', 'IGNORECASE']) +- 10 ++ >>> _get_flags(['IGNORECASE', 'MULTILINE']) ++ re.IGNORECASE|re.MULTILINE + >>> _get_flags('MULTILINE') +- 8 +- >>> _get_flags(2) +- 2 ++ re.MULTILINE ++ >>> _get_flags(8) ++ re.MULTILINE ++ >>> _get_flags(re.IGNORECASE) ++ re.IGNORECASE + """ +- if isinstance(flags, str): ++ if isinstance(flags, re.RegexFlag): ++ return flags ++ elif isinstance(flags, int): ++ return re.RegexFlag(flags) ++ elif isinstance(flags, str): + flags = [flags] + + if isinstance(flags, Iterable) and not isinstance(flags, Mapping): +- _flags_acc = [0] # An initial 0 avoids resucing on empty list, an error ++ _flags = re.RegexFlag(0) + for flag in flags: +- _flag = getattr(re, str(flag).upper()) +- +- if not isinstance(_flag, int): +- raise SaltInvocationError("Invalid re flag given: {}".format(flag)) +- +- _flags_acc.append(_flag) +- +- return reduce(operator.__or__, _flags_acc) +- elif isinstance(flags, int): +- return flags ++ _flag = getattr(re.RegexFlag, str(flag).upper(), None) ++ if not _flag: ++ raise CommandExecutionError(f"Invalid re flag given: {flag}") ++ _flags |= _flag ++ return _flags + else: +- raise SaltInvocationError( +- 'Invalid re flags: "{}", must be given either as a single flag ' +- "string, a list of strings, or as an integer".format(flags) ++ raise CommandExecutionError( ++ f'Invalid re flags: "{flags}", must be given either as a single flag ' ++ "string, a list of strings, as an integer, or as an re flag" + ) + + +@@ -2513,8 +2511,8 @@ def replace( + "Only one of append and prepend_if_not_found is permitted" + ) + +- flags_num = _get_flags(flags) +- cpattern = re.compile(salt.utils.stringutils.to_bytes(pattern), flags_num) ++ re_flags = _get_flags(flags) ++ cpattern = re.compile(salt.utils.stringutils.to_bytes(pattern), re_flags) + filesize = os.path.getsize(path) + if bufsize == "file": + bufsize = filesize +@@ -2582,7 +2580,7 @@ def replace( + "^{}($|(?=\r\n))".format(re.escape(content)) + ), + r_data, +- flags=flags_num, ++ flags=re_flags, + ): + # Content was found, so set found. + found = True +@@ -3132,7 +3130,11 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline + salt '*' file.search /etc/crontab 'mymaintenance.sh' + """ + if multiline: +- flags = _add_flags(flags, "MULTILINE") ++ re_flags = _add_flags(flags, "MULTILINE") ++ else: ++ re_flags = _get_flags(flags) ++ ++ if re.RegexFlag.MULTILINE in re_flags: + bufsize = "file" + + # This function wraps file.replace on purpose in order to enforce +@@ -3142,7 +3144,7 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline + path, + pattern, + "", +- flags=flags, ++ flags=re_flags, + bufsize=bufsize, + dry_run=True, + search_only=True, diff --git a/app-admin/salt/files/salt-3005.1-no-entry-points.patch b/app-admin/salt/files/salt-3005.1-no-entry-points.patch new file mode 100644 index 000000000000..5d1da8f751e4 --- /dev/null +++ b/app-admin/salt/files/salt-3005.1-no-entry-points.patch @@ -0,0 +1,13 @@ +diff --git a/setup.py b/setup.py +index bd11ff95f7..3b83f7b6ff 100755 +--- a/setup.py ++++ b/setup.py +@@ -1173,7 +1173,7 @@ class SaltDistribution(distutils.dist.Distribution): + return scripts + + @property +- def _property_entry_points(self): ++ def _property_entry_points_disabled(self): + entrypoints = { + "pyinstaller40": [ + "hook-dirs = salt.utils.pyinstaller:get_hook_dirs", diff --git a/app-admin/salt/files/salt-3005.1-tests.patch b/app-admin/salt/files/salt-3005.1-tests.patch new file mode 100644 index 000000000000..101574bdd303 --- /dev/null +++ b/app-admin/salt/files/salt-3005.1-tests.patch @@ -0,0 +1,40 @@ +diff --git a/tests/unit/utils/test_schema.py b/tests/unit/utils/test_schema.py +index 8c648f5288..5886813e28 100644 +--- a/tests/unit/utils/test_schema.py ++++ b/tests/unit/utils/test_schema.py +@@ -528,7 +528,7 @@ class ConfigTestCase(TestCase): + jsonschema.validate( + {"personal_access_token": "foo"}, Requirements.serialize() + ) +- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"): ++ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"): + self.assertIn( + "'ssh_key_file' is a required property", excinfo.exception.message + ) +@@ -1851,7 +1851,7 @@ class ConfigTestCase(TestCase): + jsonschema.validate( + {"item": {"sides": "4", "color": "blue"}}, TestConf.serialize() + ) +- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"): ++ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"): + self.assertIn("'4'", excinfo.exception.message) + self.assertIn("is not of type", excinfo.exception.message) + self.assertIn("'boolean'", excinfo.exception.message) +@@ -1974,7 +1974,7 @@ class ConfigTestCase(TestCase): + + with self.assertRaises(jsonschema.exceptions.ValidationError) as excinfo: + jsonschema.validate({"item": ["maybe"]}, TestConf.serialize()) +- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"): ++ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"): + self.assertIn("'maybe'", excinfo.exception.message) + self.assertIn("is not one of", excinfo.exception.message) + self.assertIn("'yes'", excinfo.exception.message) +@@ -2036,7 +2036,7 @@ class ConfigTestCase(TestCase): + + with self.assertRaises(jsonschema.exceptions.ValidationError) as excinfo: + jsonschema.validate({"item": ["maybe"]}, TestConf.serialize()) +- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"): ++ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"): + self.assertIn("'maybe'", excinfo.exception.message) + self.assertIn("is not one of", excinfo.exception.message) + self.assertIn("'yes'", excinfo.exception.message) diff --git a/app-admin/salt/files/salt-3006.2-tests.patch b/app-admin/salt/files/salt-3006.2-tests.patch new file mode 100644 index 000000000000..abec5157df30 --- /dev/null +++ b/app-admin/salt/files/salt-3006.2-tests.patch @@ -0,0 +1,114 @@ +diff --git a/tests/pytests/unit/modules/dockermod/test_module.py b/tests/pytests/unit/modules/dockermod/test_module.py +index 8fb7806497..584d416412 100644 +--- a/tests/pytests/unit/modules/dockermod/test_module.py ++++ b/tests/pytests/unit/modules/dockermod/test_module.py +@@ -354,10 +354,6 @@ def test_update_mine(): + mine_mock.assert_called_once() + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_list_networks(): + """ + test list networks. +@@ -378,10 +374,6 @@ def test_list_networks(): + client.networks.assert_called_once_with(names=["foo"], ids=["01234"]) + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_create_network(): + """ + test create network. +@@ -422,10 +414,6 @@ def test_create_network(): + ) + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_remove_network(): + """ + test remove network. +@@ -444,10 +432,6 @@ def test_remove_network(): + client.remove_network.assert_called_once_with("foo") + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_inspect_network(): + """ + test inspect network. +@@ -466,10 +450,6 @@ def test_inspect_network(): + client.inspect_network.assert_called_once_with("foo") + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_connect_container_to_network(): + """ + test connect_container_to_network +@@ -491,10 +471,6 @@ def test_connect_container_to_network(): + client.connect_container_to_network.assert_called_once_with("container", "foo") + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_disconnect_container_from_network(): + """ + test disconnect_container_from_network +@@ -513,10 +489,6 @@ def test_disconnect_container_from_network(): + client.disconnect_container_from_network.assert_called_once_with("container", "foo") + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_list_volumes(): + """ + test list volumes. +@@ -539,10 +511,6 @@ def test_list_volumes(): + ) + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_create_volume(): + """ + test create volume. +@@ -569,10 +537,6 @@ def test_create_volume(): + ) + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_remove_volume(): + """ + test remove volume. +@@ -591,10 +555,6 @@ def test_remove_volume(): + client.remove_volume.assert_called_once_with("foo") + + +-@pytest.mark.skipif( +- docker_mod.docker.version_info < (1, 5, 0), +- reason="docker module must be installed to run this test or is too old. >=1.5.0", +-) + def test_inspect_volume(): + """ + test inspect volume. |