2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-02-20 16:40:10 +00:00
|
|
|
noxfile
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
Nox configuration script
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2024-02-27 10:24:22 +00:00
|
|
|
|
2020-04-09 11:32:38 +01:00
|
|
|
# pylint: disable=resource-leakage,3rd-party-module-not-gated
|
2019-02-20 16:40:10 +00:00
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
import contextlib
|
2019-02-20 16:40:10 +00:00
|
|
|
import datetime
|
2023-10-05 09:57:50 +01:00
|
|
|
import glob
|
2023-01-18 11:09:56 +00:00
|
|
|
import gzip
|
2022-10-04 07:28:29 +01:00
|
|
|
import json
|
2019-02-20 16:40:10 +00:00
|
|
|
import os
|
2022-02-21 06:47:57 +00:00
|
|
|
import pathlib
|
2023-01-18 11:09:56 +00:00
|
|
|
import shutil
|
2022-10-04 16:40:32 +01:00
|
|
|
import sqlite3
|
2019-06-14 13:07:49 +01:00
|
|
|
import sys
|
2023-01-18 11:09:56 +00:00
|
|
|
import tarfile
|
2019-04-13 16:24:41 +01:00
|
|
|
import tempfile
|
2019-03-16 19:00:01 +00:00
|
|
|
|
2023-01-23 08:24:35 -07:00
|
|
|
import nox.command
|
|
|
|
|
2020-04-02 20:10:20 -05:00
|
|
|
# fmt: off
|
2020-04-09 11:32:38 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.stderr.write(
|
|
|
|
"Do not execute this file directly. Use nox instead, it will know how to handle this file\n"
|
|
|
|
)
|
2019-02-20 16:40:10 +00:00
|
|
|
sys.stderr.flush()
|
|
|
|
exit(1)
|
2020-04-02 20:10:20 -05:00
|
|
|
# fmt: on
|
2019-02-20 16:40:10 +00:00
|
|
|
|
|
|
|
import nox # isort:skip
|
2019-03-22 17:27:01 +00:00
|
|
|
from nox.command import CommandFailed # isort:skip
|
2020-04-02 20:10:20 -05:00
|
|
|
|
2022-10-04 07:28:29 +01:00
|
|
|
|
|
|
|
REPO_ROOT = pathlib.Path(__file__).resolve().parent
|
|
|
|
ENV_FILE = REPO_ROOT / ".ci-env"
|
|
|
|
if ENV_FILE.exists():
|
|
|
|
print("Found .ci-env file. Updating environment...", flush=True)
|
|
|
|
for key, value in json.loads(ENV_FILE.read_text()).items():
|
|
|
|
print(f" {key}={value}", flush=True)
|
|
|
|
os.environ[key] = value
|
|
|
|
print("Deleting .ci-env file", flush=True)
|
|
|
|
ENV_FILE.unlink()
|
|
|
|
|
2023-12-19 16:13:09 +01:00
|
|
|
# Be verbose when running under a CI context
|
2020-04-17 21:37:42 +01:00
|
|
|
CI_RUN = (
|
|
|
|
os.environ.get("JENKINS_URL")
|
|
|
|
or os.environ.get("CI")
|
|
|
|
or os.environ.get("DRONE") is not None
|
|
|
|
)
|
|
|
|
PIP_INSTALL_SILENT = CI_RUN is False
|
2022-09-26 17:58:19 +01:00
|
|
|
PRINT_TEST_SELECTION = os.environ.get("PRINT_TEST_SELECTION")
|
|
|
|
if PRINT_TEST_SELECTION is None:
|
|
|
|
PRINT_TEST_SELECTION = CI_RUN
|
|
|
|
else:
|
|
|
|
PRINT_TEST_SELECTION = PRINT_TEST_SELECTION == "1"
|
2022-12-16 16:43:22 +00:00
|
|
|
PRINT_TEST_PLAN_ONLY = os.environ.get("PRINT_TEST_PLAN_ONLY", "0") == "1"
|
2022-09-26 17:58:19 +01:00
|
|
|
PRINT_SYSTEM_INFO = os.environ.get("PRINT_SYSTEM_INFO")
|
|
|
|
if PRINT_SYSTEM_INFO is None:
|
|
|
|
PRINT_SYSTEM_INFO = CI_RUN
|
|
|
|
else:
|
|
|
|
PRINT_SYSTEM_INFO = PRINT_SYSTEM_INFO == "1"
|
2024-01-23 12:46:21 +00:00
|
|
|
PRINT_SYSTEM_INFO_ONLY = os.environ.get("PRINT_SYSTEM_INFO_ONLY", "0") == "1"
|
2022-08-23 09:15:28 +01:00
|
|
|
SKIP_REQUIREMENTS_INSTALL = os.environ.get("SKIP_REQUIREMENTS_INSTALL", "0") == "1"
|
2020-05-19 06:54:53 +01:00
|
|
|
EXTRA_REQUIREMENTS_INSTALL = os.environ.get("EXTRA_REQUIREMENTS_INSTALL")
|
2022-10-07 12:02:37 +01:00
|
|
|
COVERAGE_REQUIREMENT = os.environ.get("COVERAGE_REQUIREMENT")
|
2019-04-01 19:41:26 +01:00
|
|
|
|
2019-02-20 16:40:10 +00:00
|
|
|
# Global Path Definitions
|
2022-02-21 06:47:57 +00:00
|
|
|
REPO_ROOT = pathlib.Path(os.path.dirname(__file__)).resolve()
|
|
|
|
ARTIFACTS_DIR = REPO_ROOT / "artifacts"
|
|
|
|
COVERAGE_OUTPUT_DIR = ARTIFACTS_DIR / "coverage"
|
2022-12-06 17:48:27 +00:00
|
|
|
COVERAGE_FILE = os.environ.get("COVERAGE_FILE")
|
|
|
|
if COVERAGE_FILE is None:
|
|
|
|
COVERAGE_FILE = str(COVERAGE_OUTPUT_DIR / ".coverage")
|
2019-10-28 13:55:06 +00:00
|
|
|
IS_DARWIN = sys.platform.lower().startswith("darwin")
|
2019-03-01 23:25:31 +00:00
|
|
|
IS_WINDOWS = sys.platform.lower().startswith("win")
|
2020-06-03 13:58:37 +01:00
|
|
|
IS_FREEBSD = sys.platform.lower().startswith("freebsd")
|
2022-12-22 18:54:12 +00:00
|
|
|
IS_LINUX = sys.platform.lower().startswith("linux")
|
2023-01-17 04:50:55 +00:00
|
|
|
ONEDIR_ARTIFACT_PATH = ARTIFACTS_DIR / "salt"
|
|
|
|
if IS_WINDOWS:
|
|
|
|
ONEDIR_PYTHON_PATH = ONEDIR_ARTIFACT_PATH / "Scripts" / "python.exe"
|
|
|
|
else:
|
|
|
|
ONEDIR_PYTHON_PATH = ONEDIR_ARTIFACT_PATH / "bin" / "python3"
|
2019-02-20 16:40:10 +00:00
|
|
|
# Python versions to run against
|
2023-06-05 21:17:51 +01:00
|
|
|
_PYTHON_VERSIONS = ("3", "3.8", "3.9", "3.10", "3.11")
|
2019-02-20 16:40:10 +00:00
|
|
|
|
|
|
|
# Nox options
|
|
|
|
# Reuse existing virtualenvs
|
|
|
|
nox.options.reuse_existing_virtualenvs = True
|
|
|
|
|
2019-10-31 10:14:36 +00:00
|
|
|
# Change current directory to REPO_ROOT
|
2022-02-21 06:47:57 +00:00
|
|
|
os.chdir(str(REPO_ROOT))
|
2019-10-31 10:14:36 +00:00
|
|
|
|
2022-02-21 06:47:57 +00:00
|
|
|
RUNTESTS_LOGFILE = ARTIFACTS_DIR.joinpath(
|
2019-06-08 18:19:01 +01:00
|
|
|
"logs",
|
|
|
|
"runtests-{}.log".format(datetime.datetime.now().strftime("%Y%m%d%H%M%S.%f")),
|
|
|
|
)
|
|
|
|
|
2019-11-27 15:10:21 +00:00
|
|
|
# Prevent Python from writing bytecode
|
2020-08-14 15:19:49 +01:00
|
|
|
os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
|
2019-11-27 15:10:21 +00:00
|
|
|
|
2019-03-16 19:00:01 +00:00
|
|
|
|
2022-08-23 07:31:42 +01:00
|
|
|
def session_warn(session, message):
|
|
|
|
try:
|
|
|
|
session.warn(message)
|
|
|
|
except AttributeError:
|
2023-06-03 09:26:26 +01:00
|
|
|
session.log(f"WARNING: {message}")
|
2022-08-23 07:31:42 +01:00
|
|
|
|
|
|
|
|
2022-06-15 15:19:26 +01:00
|
|
|
def session_run_always(session, *command, **kwargs):
|
|
|
|
"""
|
|
|
|
Patch nox to allow running some commands which would be skipped if --install-only is passed.
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
# Guess we weren't the only ones wanting this
|
|
|
|
# https://github.com/theacodes/nox/pull/331
|
|
|
|
return session.run_always(*command, **kwargs)
|
|
|
|
except AttributeError:
|
|
|
|
old_install_only_value = session._runner.global_config.install_only
|
|
|
|
try:
|
|
|
|
# Force install only to be false for the following chunk of code
|
|
|
|
# For additional information as to why see:
|
|
|
|
# https://github.com/theacodes/nox/pull/181
|
|
|
|
session._runner.global_config.install_only = False
|
|
|
|
return session.run(*command, **kwargs)
|
|
|
|
finally:
|
|
|
|
session._runner.global_config.install_only = old_install_only_value
|
|
|
|
|
|
|
|
|
2023-01-17 04:50:55 +00:00
|
|
|
def find_session_runner(session, name, python_version, onedir=False, **kwargs):
|
|
|
|
if onedir:
|
2023-06-03 09:26:26 +01:00
|
|
|
name += f"-onedir-{ONEDIR_PYTHON_PATH}"
|
2023-01-17 04:50:55 +00:00
|
|
|
else:
|
2023-06-03 09:26:26 +01:00
|
|
|
name += f"-{python_version}"
|
2020-06-08 09:14:07 +01:00
|
|
|
for s, _ in session._runner.manifest.list_all_sessions():
|
|
|
|
if name not in s.signatures:
|
|
|
|
continue
|
|
|
|
for signature in s.signatures:
|
|
|
|
for key, value in kwargs.items():
|
2023-06-03 09:26:26 +01:00
|
|
|
param = f"{key}={value!r}"
|
2020-06-08 09:14:07 +01:00
|
|
|
if param not in signature:
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
return s
|
|
|
|
continue
|
|
|
|
session.error(
|
|
|
|
"Could not find a nox session by the name {!r} with the following keyword arguments: {!r}".format(
|
|
|
|
name, kwargs
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-02-20 16:40:10 +00:00
|
|
|
def _create_ci_directories():
|
2022-02-21 06:47:57 +00:00
|
|
|
ARTIFACTS_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
# Allow other users to write to this directory.
|
|
|
|
# This helps when some tests run under a different name and yet
|
|
|
|
# they need access to this path, for example, code coverage.
|
|
|
|
ARTIFACTS_DIR.chmod(0o777)
|
|
|
|
COVERAGE_OUTPUT_DIR.mkdir(exist_ok=True)
|
|
|
|
COVERAGE_OUTPUT_DIR.chmod(0o777)
|
|
|
|
ARTIFACTS_DIR.joinpath("xml-unittests-output").mkdir(exist_ok=True)
|
2019-02-20 16:40:10 +00:00
|
|
|
|
|
|
|
|
2019-04-12 12:02:51 +01:00
|
|
|
def _get_session_python_version_info(session):
|
2019-04-05 15:56:16 +01:00
|
|
|
try:
|
2019-04-12 12:02:51 +01:00
|
|
|
version_info = session._runner._real_python_version_info
|
2019-04-05 15:56:16 +01:00
|
|
|
except AttributeError:
|
2022-06-15 15:19:26 +01:00
|
|
|
session_py_version = session_run_always(
|
|
|
|
session,
|
|
|
|
"python",
|
|
|
|
"-c",
|
|
|
|
'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))',
|
2022-12-06 17:48:27 +00:00
|
|
|
stderr=None,
|
2022-06-15 15:19:26 +01:00
|
|
|
silent=True,
|
|
|
|
log=False,
|
|
|
|
)
|
|
|
|
version_info = tuple(
|
2022-12-06 17:48:27 +00:00
|
|
|
int(part)
|
|
|
|
for part in session_py_version.strip().split(".")
|
|
|
|
if part.isdigit()
|
2022-06-15 15:19:26 +01:00
|
|
|
)
|
|
|
|
session._runner._real_python_version_info = version_info
|
2019-04-12 12:02:51 +01:00
|
|
|
return version_info
|
|
|
|
|
|
|
|
|
|
|
|
def _get_pydir(session):
|
|
|
|
version_info = _get_session_python_version_info(session)
|
2023-06-03 09:26:26 +01:00
|
|
|
if version_info < (3, 8):
|
|
|
|
session.error("Only Python >= 3.8 is supported")
|
2019-04-12 12:02:51 +01:00
|
|
|
return "py{}.{}".format(*version_info)
|
|
|
|
|
|
|
|
|
2023-09-26 12:27:28 +01:00
|
|
|
def _get_pip_requirements_file(session, crypto=None, requirements_type="ci"):
|
2021-02-25 09:43:44 +00:00
|
|
|
assert requirements_type in ("ci", "pkg")
|
2019-04-01 19:41:26 +01:00
|
|
|
pydir = _get_pydir(session)
|
|
|
|
|
2019-03-20 14:02:51 +00:00
|
|
|
if IS_WINDOWS:
|
2020-04-27 09:09:05 +01:00
|
|
|
if crypto is None:
|
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "windows.txt"
|
2020-04-27 09:09:05 +01:00
|
|
|
)
|
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "windows-crypto.txt"
|
2019-10-28 13:55:06 +00:00
|
|
|
)
|
2020-04-27 09:09:05 +01:00
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
2023-06-03 09:26:26 +01:00
|
|
|
session.error(f"Could not find a windows requirements file for {pydir}")
|
2019-10-28 13:55:06 +00:00
|
|
|
elif IS_DARWIN:
|
2020-04-27 09:09:05 +01:00
|
|
|
if crypto is None:
|
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "darwin.txt"
|
2020-04-27 09:09:05 +01:00
|
|
|
)
|
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "darwin-crypto.txt"
|
2019-10-28 13:55:06 +00:00
|
|
|
)
|
2020-04-27 09:09:05 +01:00
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
2023-06-03 09:26:26 +01:00
|
|
|
session.error(f"Could not find a darwin requirements file for {pydir}")
|
2020-06-03 13:58:37 +01:00
|
|
|
elif IS_FREEBSD:
|
|
|
|
if crypto is None:
|
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "freebsd.txt"
|
2020-06-03 13:58:37 +01:00
|
|
|
)
|
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "freebsd-crypto.txt"
|
2020-06-03 13:58:37 +01:00
|
|
|
)
|
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
2023-06-03 09:26:26 +01:00
|
|
|
session.error(f"Could not find a freebsd requirements file for {pydir}")
|
2019-03-20 14:02:51 +00:00
|
|
|
else:
|
2020-05-19 07:56:26 +01:00
|
|
|
if crypto is None:
|
2020-04-27 09:09:05 +01:00
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "linux.txt"
|
2019-10-28 13:55:06 +00:00
|
|
|
)
|
2020-04-27 09:09:05 +01:00
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
2020-05-19 07:56:26 +01:00
|
|
|
_requirements_file = os.path.join(
|
2021-02-25 09:43:44 +00:00
|
|
|
"requirements", "static", requirements_type, pydir, "linux-crypto.txt"
|
2020-05-19 07:56:26 +01:00
|
|
|
)
|
|
|
|
if os.path.exists(_requirements_file):
|
|
|
|
return _requirements_file
|
2023-06-03 09:26:26 +01:00
|
|
|
session.error(f"Could not find a linux requirements file for {pydir}")
|
2019-03-16 19:00:01 +00:00
|
|
|
|
2019-10-07 18:29:02 +01:00
|
|
|
|
2023-11-21 13:42:41 +00:00
|
|
|
def _upgrade_pip_setuptools_and_wheel(session, upgrade=True):
|
2020-05-13 07:12:57 +01:00
|
|
|
if SKIP_REQUIREMENTS_INSTALL:
|
|
|
|
session.log(
|
|
|
|
"Skipping Python Requirements because SKIP_REQUIREMENTS_INSTALL was found in the environ"
|
|
|
|
)
|
2021-08-03 14:03:17 +01:00
|
|
|
return False
|
2020-08-31 17:56:16 +01:00
|
|
|
|
2023-11-21 13:42:41 +00:00
|
|
|
env = os.environ.copy()
|
|
|
|
env["PIP_CONSTRAINT"] = str(REPO_ROOT / "requirements" / "constraints.txt")
|
2021-02-25 07:02:15 +00:00
|
|
|
install_command = [
|
2021-02-25 14:32:02 +00:00
|
|
|
"python",
|
|
|
|
"-m",
|
|
|
|
"pip",
|
|
|
|
"install",
|
2021-02-25 07:02:15 +00:00
|
|
|
"--progress-bar=off",
|
|
|
|
]
|
2021-09-22 12:57:30 +01:00
|
|
|
if upgrade:
|
|
|
|
install_command.append("-U")
|
2023-11-21 13:42:41 +00:00
|
|
|
install_command.extend(["setuptools", "pip", "wheel"])
|
|
|
|
session_run_always(session, *install_command, silent=PIP_INSTALL_SILENT, env=env)
|
2021-08-03 14:03:17 +01:00
|
|
|
return True
|
2020-08-31 17:56:16 +01:00
|
|
|
|
2021-07-26 17:41:13 +01:00
|
|
|
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
def _install_requirements(
|
2023-01-17 04:50:55 +00:00
|
|
|
session,
|
|
|
|
*extra_requirements,
|
|
|
|
requirements_type="ci",
|
|
|
|
onedir=False,
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
):
|
2022-12-22 18:54:12 +00:00
|
|
|
if onedir and IS_LINUX:
|
|
|
|
session_run_always(session, "python3", "-m", "relenv", "toolchain", "fetch")
|
|
|
|
|
2023-11-21 13:42:41 +00:00
|
|
|
if not _upgrade_pip_setuptools_and_wheel(session):
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
return False
|
|
|
|
|
2019-10-07 18:29:02 +01:00
|
|
|
# Install requirements
|
2023-11-21 13:42:41 +00:00
|
|
|
env = os.environ.copy()
|
|
|
|
env["PIP_CONSTRAINT"] = str(REPO_ROOT / "requirements" / "constraints.txt")
|
|
|
|
|
2021-02-25 09:43:44 +00:00
|
|
|
requirements_file = _get_pip_requirements_file(
|
2023-09-26 12:27:28 +01:00
|
|
|
session, requirements_type=requirements_type
|
2021-02-25 09:43:44 +00:00
|
|
|
)
|
2020-09-01 19:38:37 +01:00
|
|
|
install_command = ["--progress-bar=off", "-r", requirements_file]
|
2023-11-21 13:42:41 +00:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
|
2019-02-20 16:40:10 +00:00
|
|
|
|
|
|
|
if extra_requirements:
|
2020-09-01 19:38:37 +01:00
|
|
|
install_command = ["--progress-bar=off"]
|
2019-10-07 18:29:02 +01:00
|
|
|
install_command += list(extra_requirements)
|
2023-11-21 13:42:41 +00:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
|
2019-02-20 16:40:10 +00:00
|
|
|
|
2020-05-19 06:54:53 +01:00
|
|
|
if EXTRA_REQUIREMENTS_INSTALL:
|
|
|
|
session.log(
|
2021-08-03 08:40:21 +01:00
|
|
|
"Installing the following extra requirements because the"
|
|
|
|
" EXTRA_REQUIREMENTS_INSTALL environment variable was set: %s",
|
2020-05-19 06:54:53 +01:00
|
|
|
EXTRA_REQUIREMENTS_INSTALL,
|
|
|
|
)
|
|
|
|
# We pass --constraint in this step because in case any of these extra dependencies has a requirement
|
|
|
|
# we're already using, we want to maintain the locked version
|
|
|
|
install_command = ["--progress-bar=off", "--constraint", requirements_file]
|
|
|
|
install_command += EXTRA_REQUIREMENTS_INSTALL.split()
|
2023-11-21 13:42:41 +00:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
|
2020-05-19 06:54:53 +01:00
|
|
|
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
return True
|
|
|
|
|
2019-02-20 16:40:10 +00:00
|
|
|
|
2022-12-06 17:48:27 +00:00
|
|
|
def _install_coverage_requirement(session):
|
2020-05-13 07:12:57 +01:00
|
|
|
if SKIP_REQUIREMENTS_INSTALL is False:
|
2023-11-21 13:42:41 +00:00
|
|
|
env = os.environ.copy()
|
|
|
|
env["PIP_CONSTRAINT"] = str(REPO_ROOT / "requirements" / "constraints.txt")
|
2022-10-07 12:02:37 +01:00
|
|
|
coverage_requirement = COVERAGE_REQUIREMENT
|
|
|
|
if coverage_requirement is None:
|
2023-05-08 12:14:23 +01:00
|
|
|
coverage_requirement = "coverage==7.3.1"
|
2023-09-29 09:15:23 +01:00
|
|
|
if IS_LINUX:
|
|
|
|
distro_slug = os.environ.get("TOOLS_DISTRO_SLUG")
|
|
|
|
if distro_slug is not None and distro_slug in (
|
|
|
|
"centos-7",
|
|
|
|
"debian-10",
|
|
|
|
"photonos-3",
|
|
|
|
):
|
|
|
|
# Keep the old coverage requirement version since the new one, on these
|
2023-12-19 16:13:09 +01:00
|
|
|
# Plaforms turns the test suite quite slow.
|
2023-09-29 09:15:23 +01:00
|
|
|
# Unit tests don't finish before the 5 hours timeout when they should
|
|
|
|
# finish within 1 to 2 hours.
|
2023-10-01 21:13:38 +01:00
|
|
|
coverage_requirement = "coverage==5.5"
|
2020-05-13 07:12:57 +01:00
|
|
|
session.install(
|
2023-11-21 13:42:41 +00:00
|
|
|
"--progress-bar=off",
|
|
|
|
coverage_requirement,
|
|
|
|
silent=PIP_INSTALL_SILENT,
|
|
|
|
env=env,
|
2020-05-13 07:12:57 +01:00
|
|
|
)
|
2022-12-06 17:48:27 +00:00
|
|
|
|
|
|
|
|
2023-09-17 18:06:08 +01:00
|
|
|
def _run_with_coverage(session, *test_cmd, env=None, on_rerun=False):
|
2022-12-06 17:48:27 +00:00
|
|
|
_install_coverage_requirement(session)
|
2023-09-17 18:06:08 +01:00
|
|
|
if on_rerun is False:
|
|
|
|
session.run("coverage", "erase")
|
2019-11-12 17:25:30 +00:00
|
|
|
|
2020-09-14 18:29:48 +01:00
|
|
|
if env is None:
|
|
|
|
env = {}
|
|
|
|
|
2022-12-06 17:48:27 +00:00
|
|
|
sitecustomize_dir = session.run(
|
|
|
|
"salt-factories", "--coverage", silent=True, log=True, stderr=None
|
2020-09-14 18:29:48 +01:00
|
|
|
)
|
2022-12-06 17:48:27 +00:00
|
|
|
if sitecustomize_dir is not None:
|
|
|
|
sitecustomize_dir = pathlib.Path(sitecustomize_dir.strip()).resolve()
|
|
|
|
if not sitecustomize_dir.exists():
|
|
|
|
session.error(
|
|
|
|
f"The path to 'sitecustomize.py', '{str(sitecustomize_dir)}', does not exist."
|
|
|
|
)
|
|
|
|
|
|
|
|
if sitecustomize_dir:
|
|
|
|
try:
|
2022-12-07 07:40:10 +00:00
|
|
|
relative_sitecustomize_dir = sitecustomize_dir.relative_to(REPO_ROOT)
|
2022-12-06 17:48:27 +00:00
|
|
|
except ValueError:
|
2022-12-07 07:40:10 +00:00
|
|
|
relative_sitecustomize_dir = sitecustomize_dir
|
|
|
|
log_msg = f"Discovered salt-factories coverage 'sitecustomize.py' path: {relative_sitecustomize_dir}"
|
|
|
|
try:
|
|
|
|
session.debug(log_msg)
|
|
|
|
except AttributeError:
|
|
|
|
# Older nox
|
|
|
|
session.log(log_msg)
|
2022-12-06 17:48:27 +00:00
|
|
|
python_path_env_var = os.environ.get("PYTHONPATH") or None
|
|
|
|
if python_path_env_var is None:
|
|
|
|
python_path_env_var = str(sitecustomize_dir)
|
|
|
|
else:
|
|
|
|
python_path_entries = python_path_env_var.split(os.pathsep)
|
|
|
|
if str(sitecustomize_dir) in python_path_entries:
|
|
|
|
python_path_entries.remove(str(sitecustomize_dir))
|
|
|
|
python_path_entries.insert(0, str(sitecustomize_dir))
|
|
|
|
python_path_env_var = os.pathsep.join(python_path_entries)
|
|
|
|
|
|
|
|
env.update(
|
|
|
|
{
|
|
|
|
# The updated python path so that sitecustomize is importable
|
|
|
|
"PYTHONPATH": python_path_env_var,
|
|
|
|
# Instruct sub processes to also run under coverage
|
|
|
|
"COVERAGE_PROCESS_START": str(REPO_ROOT / ".coveragerc"),
|
2023-10-05 09:57:50 +01:00
|
|
|
# The full path to the .coverage data file. Makes sure we always write
|
|
|
|
# them to the same directory
|
|
|
|
"COVERAGE_FILE": COVERAGE_FILE,
|
|
|
|
}
|
2022-12-06 17:48:27 +00:00
|
|
|
)
|
2019-11-12 17:25:30 +00:00
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
session.run(*test_cmd, env=env)
|
2022-08-23 09:15:28 +01:00
|
|
|
|
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
def _report_coverage(
|
|
|
|
session,
|
|
|
|
combine=True,
|
|
|
|
cli_report=True,
|
|
|
|
html_report=False,
|
|
|
|
xml_report=False,
|
|
|
|
json_report=False,
|
|
|
|
):
|
2022-09-26 17:58:19 +01:00
|
|
|
_install_coverage_requirement(session)
|
2022-08-23 09:15:28 +01:00
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
if not any([combine, cli_report, html_report, xml_report, json_report]):
|
|
|
|
session.error(
|
|
|
|
"At least one of combine, cli_report, html_report, xml_report, json_report needs to be True"
|
|
|
|
)
|
|
|
|
|
2022-08-23 09:15:28 +01:00
|
|
|
env = {
|
|
|
|
# The full path to the .coverage data file. Makes sure we always write
|
|
|
|
# them to the same directory
|
2022-12-06 17:48:27 +00:00
|
|
|
"COVERAGE_FILE": COVERAGE_FILE,
|
2022-08-23 09:15:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
report_section = None
|
|
|
|
if session.posargs:
|
|
|
|
report_section = session.posargs.pop(0)
|
|
|
|
if report_section not in ("salt", "tests"):
|
2023-10-05 09:57:50 +01:00
|
|
|
session.error(
|
|
|
|
f"The report section can only be one of 'salt', 'tests', not: {report_section}"
|
|
|
|
)
|
2022-08-23 09:15:28 +01:00
|
|
|
if session.posargs:
|
|
|
|
session.error(
|
|
|
|
"Only one argument can be passed to the session, which is optional "
|
|
|
|
"and is one of 'salt', 'tests'."
|
2022-08-23 07:31:42 +01:00
|
|
|
)
|
2019-02-20 16:40:10 +00:00
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
if combine is True:
|
|
|
|
coverage_db_files = glob.glob(f"{COVERAGE_FILE}.*")
|
|
|
|
if coverage_db_files:
|
|
|
|
with contextlib.suppress(CommandFailed):
|
|
|
|
# Sometimes some of the coverage files are corrupt which would trigger a CommandFailed
|
|
|
|
# exception
|
|
|
|
session.run("coverage", "combine", env=env)
|
|
|
|
elif os.path.exists(COVERAGE_FILE):
|
|
|
|
session_warn(session, "Coverage files already combined.")
|
|
|
|
|
|
|
|
if os.path.exists(COVERAGE_FILE) and not IS_WINDOWS:
|
|
|
|
# Some coverage files might have come from a windows machine, fix paths
|
|
|
|
with sqlite3.connect(COVERAGE_FILE) as db:
|
|
|
|
res = db.execute(r"SELECT * FROM file WHERE path LIKE '%salt\%'")
|
|
|
|
if res.fetchone():
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"Replacing backwards slashes with forward slashes on file "
|
|
|
|
"paths in the coverage database",
|
|
|
|
)
|
|
|
|
db.execute(
|
|
|
|
r"UPDATE OR IGNORE file SET path=replace(path, '\', '/');"
|
|
|
|
)
|
|
|
|
|
|
|
|
if not os.path.exists(COVERAGE_FILE):
|
|
|
|
session.error("No coverage files found.")
|
2022-10-04 16:40:32 +01:00
|
|
|
|
2022-08-23 09:15:28 +01:00
|
|
|
if report_section == "salt":
|
2023-10-05 09:57:50 +01:00
|
|
|
json_coverage_file = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "salt.json"
|
|
|
|
xml_coverage_file = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "salt.xml"
|
|
|
|
html_coverage_dir = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "html" / "salt"
|
2022-08-23 09:15:28 +01:00
|
|
|
cmd_args = [
|
2023-11-14 13:36:32 -07:00
|
|
|
"--omit=tests/*,tests/pytests/pkg/*",
|
2023-10-02 19:44:40 +01:00
|
|
|
"--include=salt/*",
|
2022-08-23 09:15:28 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
elif report_section == "tests":
|
2023-10-05 09:57:50 +01:00
|
|
|
json_coverage_file = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "tests.json"
|
|
|
|
xml_coverage_file = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "tests.xml"
|
|
|
|
html_coverage_dir = (
|
|
|
|
COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "html" / "tests"
|
2022-08-23 09:15:28 +01:00
|
|
|
)
|
|
|
|
cmd_args = [
|
2023-10-02 19:44:40 +01:00
|
|
|
"--omit=salt/*",
|
2023-11-14 13:36:32 -07:00
|
|
|
"--include=tests/*,tests/pytests/pkg/*",
|
2022-08-23 09:15:28 +01:00
|
|
|
]
|
|
|
|
else:
|
|
|
|
json_coverage_file = (
|
|
|
|
COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "coverage.json"
|
|
|
|
)
|
2023-10-05 09:57:50 +01:00
|
|
|
xml_coverage_file = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "coverage.xml"
|
|
|
|
html_coverage_dir = COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "html" / "full"
|
2022-08-23 09:15:28 +01:00
|
|
|
cmd_args = [
|
2023-11-14 13:36:32 -07:00
|
|
|
"--include=salt/*,tests/*,tests/pytests/pkg/*",
|
2022-08-23 09:15:28 +01:00
|
|
|
]
|
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
if cli_report:
|
|
|
|
session.run(
|
|
|
|
"coverage",
|
|
|
|
"report",
|
|
|
|
"--precision=2",
|
|
|
|
*cmd_args,
|
|
|
|
env=env,
|
|
|
|
)
|
2023-10-02 19:44:40 +01:00
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
if html_report:
|
|
|
|
session.run(
|
|
|
|
"coverage",
|
|
|
|
"html",
|
|
|
|
"-d",
|
|
|
|
str(html_coverage_dir),
|
|
|
|
"--show-contexts",
|
|
|
|
"--precision=2",
|
|
|
|
*cmd_args,
|
|
|
|
env=env,
|
|
|
|
)
|
|
|
|
|
|
|
|
if xml_report:
|
|
|
|
try:
|
|
|
|
session.run(
|
|
|
|
"coverage",
|
|
|
|
"xml",
|
|
|
|
"-o",
|
|
|
|
str(xml_coverage_file),
|
|
|
|
*cmd_args,
|
|
|
|
env=env,
|
|
|
|
)
|
|
|
|
except CommandFailed:
|
|
|
|
session_warn(
|
|
|
|
session, "Failed to generate the source XML code coverage report"
|
|
|
|
)
|
|
|
|
|
|
|
|
if json_report:
|
|
|
|
session.run(
|
|
|
|
"coverage",
|
|
|
|
"json",
|
|
|
|
"-o",
|
|
|
|
str(json_coverage_file),
|
|
|
|
"--show-contexts",
|
|
|
|
*cmd_args,
|
|
|
|
env=env,
|
|
|
|
)
|
2022-08-23 09:15:28 +01:00
|
|
|
|
2019-02-20 16:40:10 +00:00
|
|
|
|
2022-08-23 07:31:42 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-parametrized")
|
2019-02-20 16:40:10 +00:00
|
|
|
@nox.parametrize("coverage", [False, True])
|
2019-10-07 17:56:46 +01:00
|
|
|
@nox.parametrize("transport", ["zeromq", "tcp"])
|
2020-04-23 09:32:34 +01:00
|
|
|
@nox.parametrize("crypto", [None, "m2crypto", "pycryptodome"])
|
2022-08-23 07:31:42 +01:00
|
|
|
def test_parametrized(session, coverage, transport, crypto):
|
2020-06-08 09:14:07 +01:00
|
|
|
"""
|
|
|
|
DO NOT CALL THIS NOX SESSION DIRECTLY
|
|
|
|
"""
|
2019-02-20 16:40:10 +00:00
|
|
|
# Install requirements
|
2023-09-26 12:27:28 +01:00
|
|
|
if _install_requirements(session):
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
|
|
|
|
if crypto:
|
2022-08-23 07:31:42 +01:00
|
|
|
session_run_always(
|
|
|
|
session,
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
"pip",
|
|
|
|
"uninstall",
|
|
|
|
"-y",
|
|
|
|
"m2crypto",
|
|
|
|
"pycrypto",
|
|
|
|
"pycryptodome",
|
|
|
|
"pycryptodomex",
|
|
|
|
silent=True,
|
|
|
|
)
|
|
|
|
install_command = [
|
|
|
|
"--progress-bar=off",
|
|
|
|
"--constraint",
|
2023-09-26 12:27:28 +01:00
|
|
|
_get_pip_requirements_file(session, crypto=True),
|
Merge 3003.3 into master (#60924)
* Merge 3002.6 bugfix changes (#59822)
* Pass `CI_RUN` as an environment variable to the test run.
This allows us to know if we're running the test suite under a CI
environment or not and adapt/adjust if needed
* Migrate `unit.setup` to PyTest
* Backport ae36b15 just for test_install.py
* Only skip tests on CI runs
* Always store git sha in _version.py during installation
* Fix PEP440 compliance.
The wheel metadata version 1.2 states that the package version MUST be
PEP440 compliant.
This means that instead of `3002.2-511-g033c53eccb`, the salt version
string should look like `3002.2+511.g033c53eccb`, a post release of
`3002.2` ahead by 511 commits with the git sha `033c53eccb`
* Fix and migrate `tests/unit/test_version.py` to PyTest
* Skip test if `easy_install` is not available
* We also need to be PEP440 compliant when there's no git history
* Allow extra_filerefs as sanitized kwargs for SSH client
* Fix regression on cmd.run when passing tuples as cmd
Co-authored-by: Alexander Graul <agraul@suse.com>
* Add unit tests to ensure cmd.run accepts tuples
* Add unit test to check for extra_filerefs on SSH opts
* Add changelog file
* Fix comment for test case
* Fix unit test to avoid failing on Windows
* Skip failing test on windows
* Fix test to work on Windows
* Add all ssh kwargs to sanitize_kwargs method
* Run pre-commit
* Fix pylint
* Fix cmdmod loglevel and module_names tests
* Fix pre-commit
* Skip ssh tests if binary does not exist
* Use setup_loader for cmdmod test
* Prevent argument injection in restartcheck
* Add changelog for restartcheck fix
* docs_3002.6
* Add back tests removed in merge
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
* Remove glance state module in favor of glance_image
* update wording in changelog
* bump deprecation warning to Silicon.
* Updating warnutil version to Phosphorous.
* Update salt/modules/keystone.py
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Check $HOMEBREW_PREFIX when linking against libcrypto
When loading `libcrypto`, Salt checks for a Homebrew installation of `openssl`
at Homebrew's default prefix of `/usr/local`. However, on Apple Silicon Macs,
Homebrew's default installation prefix is `/opt/homebrew`. On all platforms,
the prefix is configurable. If Salt doesn't find one of those `libcrypto`s,
it will fall back on the un-versioned `/usr/lib/libcrypto.dylib`, which will
cause the following crash:
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
This commit checks $HOMEBREW_PREFIX instead of hard-coding `/usr/local`.
* Add test case
* Add changelog for 59808
* Add changelog entry
* Make _find_libcrypto fail on Big Sur if it can't find a library
Right now, if `_find_libcrypto` can't find any externally-managed versions of
libcrypto, it will fall back on the pre-Catalina un-versioned system libcrypto.
This does not exist on Big Sur and it would be better to raise an exception
here rather than crashing later when trying to open it.
* Update _find_libcrypto tests
This commit simplifies the unit tests for _find_libcrypto by mocking out the
host's filesystem and testing the common libcrypto installations (brew, ports,
etc.) on Big Sur. It simplifies the tests for falling back on system versions
of libcrypto on previous versions of macOS.
* Fix description of test_find_libcrypto_with_system_before_catalina
* Patch sys.platform for test_rsax931 tests
* modules/match: add missing "minion_id" in Pillar example
The documented Pillar example for `match.filter_by` lacks the `minion_id` parameter. Without it, the assignment won't work as expected.
- fix documentation
- add tests:
- to prove the misbehavior of the documented example
- to prove the proper behaviour when supplying `minion_id`
- to ensure some misbehaviour observed with compound matchers doesn't occur
* Fix for issue #59773
- When instantiating the loader grab values of grains and pillars if
they are NamedLoaderContext instances.
- The loader uses a copy of opts.
- Impliment deepcopy on NamedLoaderContext instances.
* Add changelog for #59773
* _get_initial_pillar function returns pillar
* Fix linter issues
* Clean up test
* Bump deprecation release for neutron
* Uncomment Sulfur release name
* Removing the _ext_nodes deprecation warning and alias.
* Adding changelog.
* Renaming changelog file.
* Update 59804.removed
* Initial pass at fips_mode config option
* Fix pre-commit
* Fix tests and add changelog
* update docs 3003
* update docs 3003 - newline
* Fix warts in changelog
* update releasenotes 3003
* add ubuntu-2004-amd64 m2crypto pycryptodome and tcp tests
* add distro_arch
* changing the cloud platforms file missed in 1a9b7be0e2f300d87924731dc5816fd1000cd22b
* Update __utils__ calls to import utils in azure
* Add changelog for 59744
* Fix azure unit tests and move to pytest
* Use contextvars from site-packages for thin
If a contextvars package exists one of the site-packages locations use
it for the generated thin tarball. This overrides python's builtin
contextvars and allows salt-ssh to work with python <=3.6 even when the
master's python is >3.6 (Fixes #59942)
* Add regression test for #59942
* Add changelog for #59942
* Update filemap to include test_py_versions
* Fix broken thin tests
* Always install the `contextvars` backport, even on Py3.7+
Without this change, salt-ssh cannot target systems with Python <= 3.6
* Use salt-factories to handle the container. Don't override default roster
* Fix thin tests on windows
* No need to use warn log level here
* Fix getsitepackages for old virtualenv versions
* Add explicit pyobjc reqs
* Add back the passthrough stuff
* Remove a line so pre-commit will run
* Bugfix release docs
* Bugfix release docs
* Removing pip-compile log files
* Bump requirements to address a few security issues
* Address traceback on macOS
```
Traceback (most recent call last):
File "setup.py", line 1448, in <module>
setup(distclass=SaltDistribution)
File "/Users/jenkins/setup-tests/.venv/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/opt/salt/lib/python3.7/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "setup.py", line 1068, in __init__
self.update_metadata()
File "setup.py", line 1074, in update_metadata
attrvalue = getattr(self, attrname, None)
File "setup.py", line 1182, in _property_install_requires
install_requires += _parse_requirements_file(reqfile)
File "setup.py", line 270, in _parse_requirements_file
platform.python_version(), _parse_op(op), _parse_ver(ver)
File "setup.py", line 247, in _check_ver
return getattr(operator, "__{}__".format(op))(pyver, wanted)
File "/opt/salt/lib/python3.7/distutils/version.py", line 46, in __eq__
c = self._cmp(other)
File "/opt/salt/lib/python3.7/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'
```
* Replace `saltstack.com` with `saltproject.io` on URLs being tested
* Add back support to load old entrypoints by iterating instead of type checking
Fixes #59961
* Fix issue #59975
* Fix pillar serialization for jinja #60083
* Fix test
* Add changelog for #60083
* Update changelog and release for 3003.1
* Remove the changelog source refs
* Add connect to IPCMessageSubscriber's async_methods
Fixes #60049 by making sure an IPCMessageSubscriber that is wrapped by
SyncWrapper has a connect method that runs the coroutine rather than
returns a fugure.
* Add changelog for #60049
* Update 60049.fixed
* Fix coroutine spelling error
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
* IPC on windows cannot use socket paths
Fixes #60298
* Update Jinja2 and lxml due to security related bugfix releases
Jinja2
------
CVE-2020-28493
moderate severity
Vulnerable versions: < 2.11.3
Patched version: 2.11.3
This affects the package jinja2 from 0.0.0 and before 2.11.3. The ReDOS vulnerability of the regex is mainly due to the sub-pattern [a-zA-Z0-9.-]+.[a-zA-Z0-9.-]+ This issue can be mitigated by Markdown to format user content instead of the urlize filter, or by implementing request timeouts and limiting process memory.
lxml
----
CVE-2021-28957
moderate severity
Vulnerable versions: < 4.6.3
Patched version: 4.6.3
An XSS vulnerability was discovered in the python lxml clean module versions before 4.6.3. When disabling the safe_attrs_only and forms arguments, the Cleaner class does not remove the formaction attribute allowing for JS to bypass the sanitizer. A remote attacker could exploit this flaw to run arbitrary JS code on users who interact with incorrectly sanitized HTML. This issue is patched in lxml 4.6.3.
* fix github actions jobs on branch until bullseye comes out
* Upgrade to `six==1.16.0` to avoid problems on CI runs
```
13:59:02 nox > Session invoke-pre-commit was successful.
13:59:02 nox > Running session invoke-pre-commit
13:59:02 nox > pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt
13:59:02 Collecting blessings==1.7
13:59:02 Using cached blessings-1.7-py3-none-any.whl (18 kB)
13:59:02 Collecting invoke==1.4.1
13:59:02 Using cached invoke-1.4.1-py3-none-any.whl (210 kB)
13:59:02 Collecting pyyaml==5.3.1
13:59:02 Using cached PyYAML-5.3.1.tar.gz (269 kB)
13:59:02 Collecting six==1.15.0
13:59:02 Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
13:59:02 Building wheels for collected packages: pyyaml
13:59:02 Building wheel for pyyaml (setup.py) ... - \ | / - \ | done
13:59:02 Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=546391 sha256=e42e1d66cc32087f4d33ceb81268c86b59f1a97029b19459f91b8d6ad1430167
13:59:02 Stored in directory: /var/jenkins/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
13:59:02 Successfully built pyyaml
13:59:02 Installing collected packages: six, pyyaml, invoke, blessings
13:59:02 Attempting uninstall: six
13:59:02 Found existing installation: six 1.16.0
13:59:02 Uninstalling six-1.16.0:
13:59:02 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/var/jenkins/.cache/pre-commit/repomw8oee1s/py_env-python3/lib/python3.7/site-packages/__pycache__/six.cpython-37.pyc'
13:59:02
13:59:02 nox > Command pip install --progress-bar=off -r requirements/static/ci/py3.7/invoke.txt failed with exit code 1
13:59:02 nox > Session invoke-pre-commit failed.
```
* add changelog for https://github.com/saltstack/salt/issues/59982
* Regression test for #56273
* Fix race condition in batch. #56273
* Add changelog for #56273
* Update salt/client/__init__.py
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
* Update doc for salt/client
* Update changelog/56273.fixed
Thoreau said, "Simplify, Simplify"
* Update docs
* Update docs
* Update CHANGELOG.md
* Update 3003.1.rst
* Ignore configuration for 'enable_fqdns_grains' for AIX, Solaris and Juniper
* Added changelog
* Let Mac OS Mojave run for 8 hours to avoid timeout
* Remove FreeBSD-12.2
* Use Popen for VT
* Still allow shell True
* Drop shlex split
* Add crypto re-init
* Fix pre-commit
* Do not call close in isalive
* Skip tests not valid on windows
* Cleanup things that are not really needed
* We do not support irix
* Fix pre-commit
* Remove commented out lines
* Add changelog for #60504
* Fix pre-commit issues
* pyupgrade does not remove six imports
* Fix OSErrors in some test cases
* Remove un-needed args processing
* Make state_running test more reliable
* Removing tmpfs from Fedora 33.
* Address leaks in fileserver caused by git backends
At this time we do not have the ability to fix the upstream memory leaks
in the gitfs backend providers. Work around their limitations by
periodically restarting the file server update proccess. This will at
least partially address #50313
* Remove un-used import
* Fix warts caused by black version
* Add changelog
* We don't need two changelogs
* Also pin the ``pip`` upgrade to be ``<21.2``
* Update the external ipaddress to the latest 3.9.5 version which has some security fixes. Updating the compat.p to use the vendored version if the python version is below 3.9.5 and only run the test_ipaddress.py tests if below 3.9.5.
* Adding changelog
* Requested changes.
* Add shh_timeout to ssh_kwargs
* move to with blocks
* one with block
* reight crypto
* add back test file
* add changelog
* change log file number
* add m2crypt support
* only check m2crpto
* Delete 60571.fixed
* add back log
* add newline
* add newline for log file
* Work around https://github.com/pypa/pip/pull/9450
See https://github.com/pypa/pip/issues/10212
* Drop six and Py2
* [3003.2] Add server alive (#60573)
* add server alive
* rename log
* change default alive time
* add requested changes
* format string
* reformat string again
* run pre
* customize
* space
* remove EOF dead space
* fix pre-commit
* run pre
Co-authored-by: Megan Wilhite <megan.wilhite@gmail.com>
* Changelog for 3003.2
* Man pages update for 3003.2
* Allow CVE entries in `changelog/`
* Add security type for towncrier changelog
* Add security type for changelog entries pre-commit check
* Pin to ``pip>=20.2.4,<21.2``
Refs https://github.com/pypa/pip/pull/9450
* Drop six and Py2
* Fix bug introduced in https://github.com/saltstack/salt/pull/59648
Fixes #60046
* Add changelog
* Fix doc builds
* fix release notes about dropping ubuntu 16.04
* update file client
* add changelog file
* update changelog
* Check permissions of minion config directory
* Fix some wording in the messagebox and in comments
* Add changelog
* Fix extension for changelog
* Add missing commas. It also worked, but now is better
* docs_3003.3
* fixing version numbers in man pages.
* removing newlines.
* removing newlines.
* Fixing release notes.
* Fix changelog file for 3003.2 release
* Fix test_state test using loader.context
* Re-add test_context test
* Allow Local System account, add timestamp
* swaping the git-source for vsphere-automation-sdk-python
* Remove destroy, handled in context manager
Co-authored-by: Daniel Wozniak <dwozniak@saltstack.com>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
Co-authored-by: Bryce Larson <brycel@vmware.com>
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>
Co-authored-by: Frode Gundersen <fgundersen@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@saltstack.com>
Co-authored-by: Gareth J. Greenaway <gareth@wiked.org>
Co-authored-by: Hoa-Long Tam <hoalong@apple.com>
Co-authored-by: krionbsd <krion@freebsd.org>
Co-authored-by: Elias Probst <e.probst@ssc-services.de>
Co-authored-by: Daniel A. Wozniak <dwozniak@vmware.com>
Co-authored-by: Frode Gundersen <frogunder@gmail.com>
Co-authored-by: twangboy <slee@saltstack.com>
Co-authored-by: twangboy <leesh@vmware.com>
Co-authored-by: ScriptAutomate <derek@icanteven.io>
Co-authored-by: Wayne Werner <waynejwerner@gmail.com>
Co-authored-by: David Murphy < dmurphy@saltstack.com>
Co-authored-by: Joe Eacott <jeacott@vmware.com>
Co-authored-by: cmcmarrow <charles.mcmarrow.4@gmail.com>
Co-authored-by: Twangboy <shane.d.lee@gmail.com>
2021-09-22 20:42:38 -04:00
|
|
|
]
|
|
|
|
install_command.append(crypto)
|
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2019-03-25 17:49:33 +00:00
|
|
|
|
2019-02-20 16:40:10 +00:00
|
|
|
cmd_args = [
|
2023-06-03 09:26:26 +01:00
|
|
|
f"--transport={transport}",
|
2019-02-20 16:40:10 +00:00
|
|
|
] + session.posargs
|
2023-03-10 06:56:54 +00:00
|
|
|
_pytest(session, coverage=coverage, cmd_args=cmd_args)
|
2019-03-25 15:07:39 +00:00
|
|
|
|
|
|
|
|
2019-03-25 17:49:33 +00:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS)
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
2022-08-23 07:31:42 +01:00
|
|
|
def test(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
pytest session with zeromq transport and default crypto
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
|
|
|
crypto=None,
|
|
|
|
transport="zeromq",
|
2019-03-25 17:49:33 +00:00
|
|
|
)
|
|
|
|
)
|
2019-03-25 15:07:39 +00:00
|
|
|
|
|
|
|
|
2022-08-23 07:31:42 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS)
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def pytest(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with zeromq transport and default crypto
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-tcp")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_tcp(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with TCP transport and default crypto
|
|
|
|
"""
|
|
|
|
session.notify(
|
|
|
|
find_session_runner(
|
|
|
|
session,
|
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
|
|
|
coverage=coverage,
|
|
|
|
crypto=None,
|
|
|
|
transport="tcp",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-04-05 15:57:30 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-tcp")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def pytest_tcp(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-04-05 15:57:30 +01:00
|
|
|
pytest session with TCP transport and default crypto
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-zeromq")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_zeromq(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with zeromq transport and default crypto
|
|
|
|
"""
|
2019-04-05 15:57:30 +01:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
|
|
|
crypto=None,
|
2022-08-23 07:31:42 +01:00
|
|
|
transport="zeromq",
|
2019-04-05 15:57:30 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-03-25 17:49:33 +00:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-zeromq")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def pytest_zeromq(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
pytest session with zeromq transport and default crypto
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-m2crypto")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_m2crypto(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with zeromq transport and m2crypto
|
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
2022-08-23 07:31:42 +01:00
|
|
|
crypto="m2crypto",
|
2020-06-08 09:14:07 +01:00
|
|
|
transport="zeromq",
|
2019-03-25 17:49:33 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-03-25 15:07:39 +00:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-m2crypto")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
2019-03-25 17:49:33 +00:00
|
|
|
def pytest_m2crypto(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
pytest session with zeromq transport and m2crypto
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-tcp-m2crypto")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_tcp_m2crypto(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with TCP transport and m2crypto
|
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
|
|
|
crypto="m2crypto",
|
2022-08-23 07:31:42 +01:00
|
|
|
transport="tcp",
|
2019-03-25 17:49:33 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-04-05 15:57:30 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-tcp-m2crypto")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def pytest_tcp_m2crypto(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-04-05 15:57:30 +01:00
|
|
|
pytest session with TCP transport and m2crypto
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-zeromq-m2crypto")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_zeromq_m2crypto(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with zeromq transport and m2crypto
|
|
|
|
"""
|
2019-04-05 15:57:30 +01:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
|
|
|
crypto="m2crypto",
|
2022-08-23 07:31:42 +01:00
|
|
|
transport="zeromq",
|
2019-04-05 15:57:30 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2019-03-25 17:49:33 +00:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-zeromq-m2crypto")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def pytest_zeromq_m2crypto(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
pytest session with zeromq transport and m2crypto
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-pycryptodome")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_pycryptodome(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with zeromq transport and pycryptodome
|
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
2022-08-23 07:31:42 +01:00
|
|
|
crypto="pycryptodome",
|
2020-06-08 09:14:07 +01:00
|
|
|
transport="zeromq",
|
2019-03-25 17:49:33 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-04-23 09:32:34 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-pycryptodome")
|
2019-03-25 15:07:39 +00:00
|
|
|
@nox.parametrize("coverage", [False, True])
|
2020-04-23 09:32:34 +01:00
|
|
|
def pytest_pycryptodome(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2020-04-23 09:32:34 +01:00
|
|
|
pytest session with zeromq transport and pycryptodome
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-tcp-pycryptodome")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_tcp_pycryptodome(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with TCP transport and pycryptodome
|
|
|
|
"""
|
2019-03-25 17:49:33 +00:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
|
|
|
crypto="pycryptodome",
|
2022-08-23 07:31:42 +01:00
|
|
|
transport="tcp",
|
2019-03-25 17:49:33 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-04-23 09:32:34 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-tcp-pycryptodome")
|
2019-04-05 15:57:30 +01:00
|
|
|
@nox.parametrize("coverage", [False, True])
|
2020-04-23 09:32:34 +01:00
|
|
|
def pytest_tcp_pycryptodome(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2020-04-23 09:32:34 +01:00
|
|
|
pytest session with TCP transport and pycryptodome
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-zeromq-pycryptodome")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_zeromq_pycryptodome(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest session with zeromq transport and pycryptodome
|
|
|
|
"""
|
2019-04-05 15:57:30 +01:00
|
|
|
session.notify(
|
2020-06-08 09:14:07 +01:00
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"test-parametrized",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
coverage=coverage,
|
|
|
|
crypto="pycryptodome",
|
2022-08-23 07:31:42 +01:00
|
|
|
transport="zeromq",
|
2019-04-05 15:57:30 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-04-23 09:32:34 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-zeromq-pycryptodome")
|
2019-03-25 17:49:33 +00:00
|
|
|
@nox.parametrize("coverage", [False, True])
|
2020-04-23 09:32:34 +01:00
|
|
|
def pytest_zeromq_pycryptodome(session, coverage):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2020-04-23 09:32:34 +01:00
|
|
|
pytest session with zeromq transport and pycryptodome
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2022-08-23 07:31:42 +01:00
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
2019-03-25 17:49:33 +00:00
|
|
|
)
|
2022-08-23 07:31:42 +01:00
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
2019-03-25 17:49:33 +00:00
|
|
|
|
|
|
|
|
2022-08-23 07:31:42 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-cloud")
|
2019-04-18 18:48:42 +01:00
|
|
|
@nox.parametrize("coverage", [False, True])
|
2022-08-23 07:31:42 +01:00
|
|
|
def test_cloud(session, coverage):
|
2020-06-08 09:14:07 +01:00
|
|
|
"""
|
|
|
|
pytest cloud tests session
|
|
|
|
"""
|
2021-09-23 14:42:44 +01:00
|
|
|
pydir = _get_pydir(session)
|
|
|
|
if pydir == "py3.5":
|
|
|
|
session.error(
|
|
|
|
"Due to conflicting and unsupported requirements the cloud tests only run on Py3.6+"
|
|
|
|
)
|
2019-04-18 18:48:42 +01:00
|
|
|
# Install requirements
|
2021-08-03 14:03:17 +01:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
2023-06-02 08:08:23 +01:00
|
|
|
linux_requirements_file = os.path.join(
|
|
|
|
"requirements", "static", "ci", pydir, "linux.txt"
|
|
|
|
)
|
|
|
|
cloud_requirements_file = os.path.join(
|
2021-09-23 14:42:44 +01:00
|
|
|
"requirements", "static", "ci", pydir, "cloud.txt"
|
2021-08-03 14:03:17 +01:00
|
|
|
)
|
2019-04-18 18:48:42 +01:00
|
|
|
|
2023-06-02 08:08:23 +01:00
|
|
|
install_command = [
|
|
|
|
"--progress-bar=off",
|
|
|
|
"-r",
|
|
|
|
linux_requirements_file,
|
|
|
|
"-r",
|
|
|
|
cloud_requirements_file,
|
|
|
|
]
|
2021-08-03 14:03:17 +01:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2020-04-27 09:09:05 +01:00
|
|
|
|
2019-04-18 18:48:42 +01:00
|
|
|
cmd_args = [
|
2020-04-09 11:32:38 +01:00
|
|
|
"--run-expensive",
|
|
|
|
"-k",
|
|
|
|
"cloud",
|
2019-04-18 18:48:42 +01:00
|
|
|
] + session.posargs
|
2023-03-10 06:56:54 +00:00
|
|
|
_pytest(session, coverage=coverage, cmd_args=cmd_args)
|
2019-04-18 18:48:42 +01:00
|
|
|
|
|
|
|
|
2022-08-23 07:31:42 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-cloud")
|
2019-04-18 18:52:27 +01:00
|
|
|
@nox.parametrize("coverage", [False, True])
|
2022-08-23 07:31:42 +01:00
|
|
|
def pytest_cloud(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest cloud tests session
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="test-tornado")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def test_tornado(session, coverage):
|
2020-06-08 09:14:07 +01:00
|
|
|
"""
|
|
|
|
pytest tornado tests session
|
|
|
|
"""
|
2019-04-18 18:52:27 +01:00
|
|
|
# Install requirements
|
2021-08-03 14:03:17 +01:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
2023-09-26 12:27:28 +01:00
|
|
|
_install_requirements(session)
|
2021-08-03 14:03:17 +01:00
|
|
|
session.install(
|
|
|
|
"--progress-bar=off", "tornado==5.0.2", silent=PIP_INSTALL_SILENT
|
|
|
|
)
|
|
|
|
session.install(
|
|
|
|
"--progress-bar=off", "pyzmq==17.0.0", silent=PIP_INSTALL_SILENT
|
|
|
|
)
|
2023-03-10 06:56:54 +00:00
|
|
|
_pytest(session, coverage=coverage, cmd_args=session.posargs)
|
2019-04-18 18:52:27 +01:00
|
|
|
|
2022-05-30 16:29:20 +01:00
|
|
|
|
2022-08-23 07:31:42 +01:00
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="pytest-tornado")
|
|
|
|
@nox.parametrize("coverage", [False, True])
|
|
|
|
def pytest_tornado(session, coverage):
|
|
|
|
"""
|
|
|
|
pytest tornado tests session
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
session_name = session.name
|
|
|
|
except AttributeError:
|
|
|
|
session_name = session._runner.friendly_name
|
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"This nox session is deprecated, please call {!r} instead".format(
|
|
|
|
session_name.replace("pytest-", "test-")
|
|
|
|
),
|
|
|
|
)
|
|
|
|
session.notify(session_name.replace("pytest-", "test-"))
|
|
|
|
|
|
|
|
|
2023-09-17 18:06:08 +01:00
|
|
|
def _pytest(session, coverage, cmd_args, env=None, on_rerun=False):
|
2022-05-30 16:29:20 +01:00
|
|
|
# Create required artifacts directories
|
|
|
|
_create_ci_directories()
|
|
|
|
|
2022-12-06 07:53:00 +00:00
|
|
|
if env is None:
|
|
|
|
env = {}
|
|
|
|
|
|
|
|
env["CI_RUN"] = "1" if CI_RUN else "0"
|
2022-05-30 16:29:20 +01:00
|
|
|
|
|
|
|
args = [
|
2019-04-18 18:52:27 +01:00
|
|
|
"--rootdir",
|
2022-02-21 06:47:57 +00:00
|
|
|
str(REPO_ROOT),
|
2019-06-08 18:19:01 +01:00
|
|
|
"--log-file-level=debug",
|
2020-05-22 16:18:55 +01:00
|
|
|
"--show-capture=no",
|
2019-04-18 18:52:27 +01:00
|
|
|
"-ra",
|
|
|
|
"-s",
|
2022-09-26 17:58:19 +01:00
|
|
|
"-vv",
|
2022-05-30 16:29:20 +01:00
|
|
|
"--showlocals",
|
|
|
|
]
|
2022-08-23 07:31:42 +01:00
|
|
|
for arg in cmd_args:
|
|
|
|
if arg == "--log-file" or arg.startswith("--log-file="):
|
|
|
|
break
|
|
|
|
else:
|
2023-06-03 09:26:26 +01:00
|
|
|
args.append(f"--log-file={RUNTESTS_LOGFILE}")
|
2022-05-30 16:29:20 +01:00
|
|
|
args.extend(cmd_args)
|
2019-11-12 17:25:30 +00:00
|
|
|
|
2024-01-23 12:46:21 +00:00
|
|
|
if PRINT_SYSTEM_INFO_ONLY and "--sys-info-and-exit" not in args:
|
|
|
|
args.append("--sys-info-and-exit")
|
|
|
|
session.run("python", "-m", "pytest", *args, env=env)
|
|
|
|
return
|
|
|
|
|
2022-09-26 17:58:19 +01:00
|
|
|
if PRINT_SYSTEM_INFO and "--sysinfo" not in args:
|
|
|
|
args.append("--sysinfo")
|
|
|
|
|
|
|
|
if PRINT_TEST_SELECTION:
|
2020-04-17 21:37:42 +01:00
|
|
|
# We'll print out the collected tests on CI runs.
|
|
|
|
# This will show a full list of what tests are going to run, in the right order, which, in case
|
|
|
|
# of a test suite hang, helps us pinpoint which test is hanging
|
|
|
|
session.run(
|
2022-05-30 16:29:20 +01:00
|
|
|
"python", "-m", "pytest", *(args + ["--collect-only", "-qqq"]), env=env
|
2020-04-17 21:37:42 +01:00
|
|
|
)
|
2022-12-06 07:53:00 +00:00
|
|
|
if PRINT_TEST_PLAN_ONLY:
|
|
|
|
return
|
2020-04-17 21:37:42 +01:00
|
|
|
|
2022-05-30 16:29:20 +01:00
|
|
|
if coverage is True:
|
2023-08-29 17:16:47 +01:00
|
|
|
_coverage_cmd_args = []
|
|
|
|
if "COVERAGE_CONTEXT" in os.environ:
|
|
|
|
_coverage_cmd_args.append(f"--context={os.environ['COVERAGE_CONTEXT']}")
|
2022-05-30 16:29:20 +01:00
|
|
|
_run_with_coverage(
|
|
|
|
session,
|
|
|
|
"python",
|
|
|
|
"-m",
|
|
|
|
"coverage",
|
|
|
|
"run",
|
2023-08-29 17:16:47 +01:00
|
|
|
*_coverage_cmd_args,
|
2022-05-30 16:29:20 +01:00
|
|
|
"-m",
|
|
|
|
"pytest",
|
|
|
|
*args,
|
|
|
|
env=env,
|
2023-09-17 18:06:08 +01:00
|
|
|
on_rerun=on_rerun,
|
2022-05-30 16:29:20 +01:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
session.run("python", "-m", "pytest", *args, env=env)
|
2019-04-01 19:41:26 +01:00
|
|
|
|
|
|
|
|
2023-01-17 04:50:55 +00:00
|
|
|
def _ci_test(session, transport, onedir=False):
|
2022-09-26 17:58:19 +01:00
|
|
|
# Install requirements
|
2023-09-26 12:27:28 +01:00
|
|
|
_install_requirements(session, onedir=onedir)
|
2023-01-23 11:47:03 +00:00
|
|
|
env = {}
|
|
|
|
if onedir:
|
|
|
|
env["ONEDIR_TESTRUN"] = "1"
|
2022-09-26 17:58:19 +01:00
|
|
|
chunks = {
|
2023-12-06 12:44:52 +00:00
|
|
|
"pkg": [
|
|
|
|
"tests/pytests/pkg",
|
|
|
|
],
|
2022-09-26 17:58:19 +01:00
|
|
|
"unit": [
|
|
|
|
"tests/unit",
|
|
|
|
"tests/pytests/unit",
|
|
|
|
],
|
|
|
|
"functional": [
|
|
|
|
"tests/pytests/functional",
|
|
|
|
],
|
2023-12-06 12:44:52 +00:00
|
|
|
"scenarios": [
|
|
|
|
"tests/pytests/scenarios",
|
|
|
|
],
|
2022-09-26 17:58:19 +01:00
|
|
|
}
|
|
|
|
|
2023-10-02 11:21:32 +01:00
|
|
|
test_group_number = os.environ.get("TEST_GROUP") or "1"
|
|
|
|
|
2022-09-26 17:58:19 +01:00
|
|
|
if not session.posargs:
|
|
|
|
chunk_cmd = []
|
|
|
|
junit_report_filename = "test-results"
|
|
|
|
runtests_log_filename = "runtests"
|
|
|
|
else:
|
|
|
|
chunk = session.posargs.pop(0)
|
|
|
|
if chunk in ["unit", "functional", "integration", "scenarios", "all"]:
|
|
|
|
if chunk == "all":
|
|
|
|
chunk_cmd = []
|
|
|
|
junit_report_filename = "test-results"
|
|
|
|
runtests_log_filename = "runtests"
|
|
|
|
elif chunk == "integration":
|
|
|
|
chunk_cmd = []
|
|
|
|
for values in chunks.values():
|
|
|
|
for value in values:
|
|
|
|
chunk_cmd.append(f"--ignore={value}")
|
2023-10-02 11:21:32 +01:00
|
|
|
junit_report_filename = f"test-results-{chunk}-grp{test_group_number}"
|
|
|
|
runtests_log_filename = f"runtests-{chunk}-grp{test_group_number}"
|
2022-09-26 17:58:19 +01:00
|
|
|
else:
|
|
|
|
chunk_cmd = chunks[chunk]
|
2023-10-02 11:21:32 +01:00
|
|
|
junit_report_filename = f"test-results-{chunk}-grp{test_group_number}"
|
|
|
|
runtests_log_filename = f"runtests-{chunk}-grp{test_group_number}"
|
2022-09-26 17:58:19 +01:00
|
|
|
if session.posargs:
|
|
|
|
if session.posargs[0] == "--":
|
|
|
|
session.posargs.pop(0)
|
|
|
|
chunk_cmd.extend(session.posargs)
|
|
|
|
else:
|
|
|
|
chunk_cmd = [chunk] + session.posargs
|
2023-10-02 11:21:32 +01:00
|
|
|
junit_report_filename = f"test-results-grp{test_group_number}"
|
|
|
|
runtests_log_filename = f"runtests-grp{test_group_number}"
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
rerun_failures = os.environ.get("RERUN_FAILURES", "0") == "1"
|
2022-10-04 07:36:14 +01:00
|
|
|
track_code_coverage = os.environ.get("SKIP_CODE_COVERAGE", "0") == "0"
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
common_pytest_args = [
|
|
|
|
"--color=yes",
|
|
|
|
"--ssh-tests",
|
|
|
|
"--sys-stats",
|
|
|
|
"--run-destructive",
|
2022-10-04 07:28:29 +01:00
|
|
|
f"--output-columns={os.environ.get('OUTPUT_COLUMNS') or 120}",
|
2022-09-26 17:58:19 +01:00
|
|
|
]
|
|
|
|
try:
|
|
|
|
pytest_args = (
|
|
|
|
common_pytest_args[:]
|
|
|
|
+ [
|
|
|
|
f"--junitxml=artifacts/xml-unittests-output/{junit_report_filename}.xml",
|
|
|
|
f"--log-file=artifacts/logs/{runtests_log_filename}.log",
|
|
|
|
]
|
|
|
|
+ chunk_cmd
|
|
|
|
)
|
2023-03-10 06:56:54 +00:00
|
|
|
_pytest(session, coverage=track_code_coverage, cmd_args=pytest_args, env=env)
|
2022-09-26 17:58:19 +01:00
|
|
|
except CommandFailed:
|
|
|
|
if rerun_failures is False:
|
|
|
|
raise
|
|
|
|
|
|
|
|
# Don't print the system information, not the test selection on reruns
|
|
|
|
global PRINT_TEST_SELECTION
|
|
|
|
global PRINT_SYSTEM_INFO
|
|
|
|
PRINT_TEST_SELECTION = False
|
|
|
|
PRINT_SYSTEM_INFO = False
|
|
|
|
|
|
|
|
pytest_args = (
|
|
|
|
common_pytest_args[:]
|
|
|
|
+ [
|
|
|
|
"--lf",
|
|
|
|
f"--junitxml=artifacts/xml-unittests-output/{junit_report_filename}-rerun.xml",
|
|
|
|
f"--log-file=artifacts/logs/{runtests_log_filename}-rerun.log",
|
|
|
|
]
|
|
|
|
+ chunk_cmd
|
|
|
|
)
|
2023-09-17 18:06:08 +01:00
|
|
|
_pytest(
|
|
|
|
session,
|
|
|
|
coverage=track_code_coverage,
|
|
|
|
cmd_args=pytest_args,
|
|
|
|
env=env,
|
|
|
|
on_rerun=True,
|
|
|
|
)
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="ci-test")
|
|
|
|
def ci_test(session):
|
2023-09-26 12:27:28 +01:00
|
|
|
transport = os.environ.get("SALT_TRANSPORT") or "zeromq"
|
|
|
|
valid_transports = ("zeromq", "tcp")
|
|
|
|
if transport not in valid_transports:
|
|
|
|
session.error(
|
|
|
|
"The value for the SALT_TRANSPORT environment variable can only be "
|
|
|
|
f"one of: {', '.join(valid_transports)}"
|
|
|
|
)
|
|
|
|
_ci_test(session, transport)
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=_PYTHON_VERSIONS, name="ci-test-tcp")
|
|
|
|
def ci_test_tcp(session):
|
|
|
|
_ci_test(session, "tcp")
|
|
|
|
|
|
|
|
|
2023-01-17 04:50:55 +00:00
|
|
|
@nox.session(
|
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
|
|
|
name="ci-test-onedir",
|
2023-03-23 06:37:47 +00:00
|
|
|
venv_params=["--system-site-packages"],
|
2023-01-17 04:50:55 +00:00
|
|
|
)
|
|
|
|
def ci_test_onedir(session):
|
|
|
|
if not ONEDIR_ARTIFACT_PATH.exists():
|
|
|
|
session.error(
|
|
|
|
"The salt onedir artifact, expected to be in '{}', was not found".format(
|
|
|
|
ONEDIR_ARTIFACT_PATH.relative_to(REPO_ROOT)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-09-30 18:31:44 +01:00
|
|
|
transport = os.environ.get("SALT_TRANSPORT") or "zeromq"
|
|
|
|
valid_transports = ("zeromq", "tcp")
|
|
|
|
if transport not in valid_transports:
|
|
|
|
session.error(
|
|
|
|
"The value for the SALT_TRANSPORT environment variable can only be "
|
|
|
|
f"one of: {', '.join(valid_transports)}"
|
|
|
|
)
|
|
|
|
|
2023-01-17 04:50:55 +00:00
|
|
|
_ci_test(session, "zeromq", onedir=True)
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(
|
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
|
|
|
name="ci-test-onedir-tcp",
|
2023-03-23 06:37:47 +00:00
|
|
|
venv_params=["--system-site-packages"],
|
2023-01-17 04:50:55 +00:00
|
|
|
)
|
|
|
|
def ci_test_onedir_tcp(session):
|
|
|
|
if not ONEDIR_ARTIFACT_PATH.exists():
|
|
|
|
session.error(
|
|
|
|
"The salt onedir artifact, expected to be in '{}', was not found".format(
|
|
|
|
ONEDIR_ARTIFACT_PATH.relative_to(REPO_ROOT)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
_ci_test(session, "tcp", onedir=True)
|
|
|
|
|
|
|
|
|
2022-08-23 09:15:28 +01:00
|
|
|
@nox.session(python="3", name="report-coverage")
|
|
|
|
def report_coverage(session):
|
2023-10-05 09:57:50 +01:00
|
|
|
_report_coverage(session, combine=True, cli_report=True)
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python="3", name="coverage-report")
|
|
|
|
def coverage_report(session):
|
|
|
|
_report_coverage(session, combine=True, cli_report=True)
|
2022-08-23 09:15:28 +01:00
|
|
|
|
|
|
|
|
2022-09-26 17:58:19 +01:00
|
|
|
@nox.session(python=False, name="decompress-dependencies")
|
|
|
|
def decompress_dependencies(session):
|
|
|
|
if not session.posargs:
|
|
|
|
session.error(
|
2024-01-02 09:45:10 +00:00
|
|
|
"The 'decompress-dependencies' session target needs "
|
|
|
|
"two arguments, '<platform> <arch>'."
|
2022-09-26 17:58:19 +01:00
|
|
|
)
|
2024-01-02 09:45:10 +00:00
|
|
|
try:
|
|
|
|
platform = session.posargs.pop(0)
|
|
|
|
arch = session.posargs.pop(0)
|
|
|
|
if session.posargs:
|
|
|
|
session.error(
|
|
|
|
"The 'decompress-dependencies' session target only accepts "
|
|
|
|
"two arguments, '<platform> <arch>'."
|
|
|
|
)
|
|
|
|
except IndexError:
|
|
|
|
session.error(
|
|
|
|
"The 'decompress-dependencies' session target needs "
|
|
|
|
"two arguments, '<platform> <arch>'."
|
|
|
|
)
|
|
|
|
if platform == "windows":
|
|
|
|
extension = "tar.gz"
|
|
|
|
scripts_dir_name = "Scripts"
|
2022-09-26 17:58:19 +01:00
|
|
|
else:
|
2024-01-02 09:45:10 +00:00
|
|
|
extension = "tar.xz"
|
|
|
|
scripts_dir_name = "bin"
|
|
|
|
nox_dependencies_tarball = f"nox.{platform}.{arch}.{extension}"
|
2022-09-26 17:58:19 +01:00
|
|
|
nox_dependencies_tarball_path = REPO_ROOT / nox_dependencies_tarball
|
|
|
|
if not nox_dependencies_tarball_path.exists():
|
|
|
|
session.error(
|
2023-09-19 13:48:17 +01:00
|
|
|
f"The {nox_dependencies_tarball} file "
|
2022-09-26 17:58:19 +01:00
|
|
|
"does not exist. Not decompressing anything."
|
|
|
|
)
|
|
|
|
|
|
|
|
session_run_always(session, "tar", "xpf", nox_dependencies_tarball)
|
2023-03-23 12:41:20 +00:00
|
|
|
if os.environ.get("DELETE_NOX_ARCHIVE", "0") == "1":
|
|
|
|
nox_dependencies_tarball_path.unlink()
|
|
|
|
|
|
|
|
session.log("Finding broken 'python' symlinks under '.nox/' ...")
|
|
|
|
for dirname in os.scandir(REPO_ROOT / ".nox"):
|
2024-01-02 09:45:10 +00:00
|
|
|
scan_path = REPO_ROOT.joinpath(".nox", dirname, scripts_dir_name)
|
2023-03-23 12:41:20 +00:00
|
|
|
script_paths = {str(p): p for p in os.scandir(scan_path)}
|
2023-10-09 21:09:27 +01:00
|
|
|
fixed_shebang = f"#!{scan_path / 'python'}"
|
2023-03-23 12:41:20 +00:00
|
|
|
for key in sorted(script_paths):
|
|
|
|
path = script_paths[key]
|
2023-10-09 21:09:27 +01:00
|
|
|
if path.is_symlink():
|
|
|
|
broken_link = pathlib.Path(path)
|
|
|
|
resolved_link = os.readlink(path)
|
|
|
|
if not os.path.isabs(resolved_link):
|
|
|
|
# Relative symlinks, resolve them
|
|
|
|
resolved_link = os.path.join(scan_path, resolved_link)
|
2024-11-04 13:09:17 -07:00
|
|
|
prefix_check = False
|
|
|
|
if platform == "windows":
|
|
|
|
prefix_check = resolved_link.startswith("\\\\?")
|
|
|
|
if not os.path.exists(resolved_link) or prefix_check:
|
2023-10-09 21:09:27 +01:00
|
|
|
session.log("The symlink %r looks to be broken", resolved_link)
|
|
|
|
# This is a broken link, fix it
|
|
|
|
resolved_link_suffix = resolved_link.split(
|
|
|
|
f"artifacts{os.sep}salt{os.sep}"
|
|
|
|
)[-1]
|
|
|
|
fixed_link = REPO_ROOT.joinpath(
|
|
|
|
"artifacts", "salt", resolved_link_suffix
|
|
|
|
)
|
|
|
|
session.log(
|
|
|
|
"Fixing broken symlink in nox virtualenv %r, from %r to %r",
|
|
|
|
dirname.name,
|
|
|
|
resolved_link,
|
|
|
|
str(fixed_link.relative_to(REPO_ROOT)),
|
|
|
|
)
|
|
|
|
broken_link.unlink()
|
|
|
|
broken_link.symlink_to(fixed_link)
|
|
|
|
continue
|
|
|
|
if not path.is_file():
|
2023-03-23 12:41:20 +00:00
|
|
|
continue
|
2024-01-02 09:45:10 +00:00
|
|
|
if platform != "windows":
|
2023-10-09 21:09:27 +01:00
|
|
|
# Let's try to fix shebang's
|
|
|
|
try:
|
|
|
|
fpath = pathlib.Path(path)
|
2024-02-25 10:37:08 +00:00
|
|
|
contents = fpath.read_text(encoding="utf-8").splitlines()
|
2023-10-09 21:09:27 +01:00
|
|
|
if (
|
|
|
|
contents[0].startswith("#!")
|
|
|
|
and contents[0].endswith("python")
|
|
|
|
and contents[0] != fixed_shebang
|
|
|
|
):
|
|
|
|
session.log(
|
|
|
|
"Fixing broken shebang in %r",
|
|
|
|
str(fpath.relative_to(REPO_ROOT)),
|
|
|
|
)
|
2024-02-25 10:37:08 +00:00
|
|
|
fpath.write_text(
|
|
|
|
"\n".join([fixed_shebang] + contents[1:]), encoding="utf-8"
|
|
|
|
)
|
2023-10-09 21:09:27 +01:00
|
|
|
except UnicodeDecodeError:
|
|
|
|
pass
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=False, name="compress-dependencies")
|
|
|
|
def compress_dependencies(session):
|
|
|
|
if not session.posargs:
|
|
|
|
session.error(
|
2024-01-02 09:45:10 +00:00
|
|
|
"The 'compress-dependencies' session target needs "
|
|
|
|
"two arguments, '<platform> <arch>'."
|
2022-09-26 17:58:19 +01:00
|
|
|
)
|
2024-01-02 09:45:10 +00:00
|
|
|
try:
|
|
|
|
platform = session.posargs.pop(0)
|
|
|
|
arch = session.posargs.pop(0)
|
|
|
|
if session.posargs:
|
|
|
|
session.error(
|
|
|
|
"The 'compress-dependencies' session target only accepts "
|
|
|
|
"two arguments, '<platform> <arch>'."
|
|
|
|
)
|
|
|
|
except IndexError:
|
|
|
|
session.error(
|
|
|
|
"The 'compress-dependencies' session target needs "
|
|
|
|
"two arguments, '<platform> <arch>'."
|
|
|
|
)
|
|
|
|
if platform == "windows":
|
|
|
|
extension = "tar.gz"
|
2022-09-26 17:58:19 +01:00
|
|
|
else:
|
2024-01-02 09:45:10 +00:00
|
|
|
extension = "tar.xz"
|
|
|
|
nox_dependencies_tarball = f"nox.{platform}.{arch}.{extension}"
|
2022-09-26 17:58:19 +01:00
|
|
|
nox_dependencies_tarball_path = REPO_ROOT / nox_dependencies_tarball
|
|
|
|
if nox_dependencies_tarball_path.exists():
|
|
|
|
session_warn(
|
|
|
|
session, f"Found existing {nox_dependencies_tarball}. Deleting it."
|
|
|
|
)
|
|
|
|
nox_dependencies_tarball_path.unlink()
|
|
|
|
|
2023-01-15 11:16:42 +00:00
|
|
|
session_run_always(
|
|
|
|
session,
|
|
|
|
"tar",
|
|
|
|
"-caf",
|
|
|
|
nox_dependencies_tarball,
|
|
|
|
"--exclude=.nox/pre-archive-cleanup",
|
|
|
|
".nox",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(
|
2023-01-15 11:16:42 +00:00
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
2023-01-15 11:16:42 +00:00
|
|
|
name="pre-archive-cleanup",
|
|
|
|
)
|
2023-01-16 18:32:08 +00:00
|
|
|
@nox.parametrize("pkg", [False, True])
|
|
|
|
def pre_archive_cleanup(session, pkg):
|
2023-01-15 11:16:42 +00:00
|
|
|
"""
|
|
|
|
Call `tools pkg pre-archive-cleanup <path>`
|
|
|
|
"""
|
|
|
|
if session.posargs:
|
|
|
|
session.error("No additional arguments can be passed to 'pre-archive-cleanup'")
|
|
|
|
version_info = _get_session_python_version_info(session)
|
2023-03-13 10:42:02 +00:00
|
|
|
if version_info < (3, 10):
|
|
|
|
session.error(
|
|
|
|
"The nox session 'pre-archive-cleanup' needs Python 3.10+ to run."
|
|
|
|
)
|
2023-01-16 18:32:08 +00:00
|
|
|
|
2023-03-13 10:42:02 +00:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
|
|
|
requirements_file = os.path.join(
|
|
|
|
"requirements", "static", "ci", _get_pydir(session), "tools.txt"
|
|
|
|
)
|
|
|
|
install_command = ["--progress-bar=off", "-r", requirements_file]
|
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2023-01-16 18:32:08 +00:00
|
|
|
|
2023-03-13 10:42:02 +00:00
|
|
|
cmdline = [
|
|
|
|
"tools",
|
|
|
|
"pkg",
|
|
|
|
"pre-archive-cleanup",
|
|
|
|
]
|
2023-01-16 18:32:08 +00:00
|
|
|
if pkg:
|
2023-03-13 10:42:02 +00:00
|
|
|
cmdline.append("--pkg")
|
|
|
|
cmdline.append(".nox")
|
|
|
|
session_run_always(session, *cmdline)
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python="3", name="combine-coverage")
|
|
|
|
def combine_coverage(session):
|
2023-10-05 09:57:50 +01:00
|
|
|
_report_coverage(session, combine=True, cli_report=False)
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
|
2023-09-20 17:24:04 +01:00
|
|
|
@nox.session(
|
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
|
|
|
name="combine-coverage-onedir",
|
|
|
|
venv_params=["--system-site-packages"],
|
|
|
|
)
|
|
|
|
def combine_coverage_onedir(session):
|
2023-10-05 09:57:50 +01:00
|
|
|
_report_coverage(session, combine=True, cli_report=False)
|
2022-09-26 17:58:19 +01:00
|
|
|
|
|
|
|
|
2023-08-28 19:01:01 +01:00
|
|
|
@nox.session(python="3", name="create-html-coverage-report")
|
|
|
|
def create_html_coverage_report(session):
|
2023-10-05 09:57:50 +01:00
|
|
|
_report_coverage(session, combine=True, cli_report=False, html_report=True)
|
2023-08-28 19:01:01 +01:00
|
|
|
|
|
|
|
|
2023-09-29 18:38:31 +01:00
|
|
|
def _create_xml_coverage_reports(session):
|
2023-10-06 15:02:48 +01:00
|
|
|
if session.posargs:
|
|
|
|
session.error("No arguments are acceptable to this nox session.")
|
|
|
|
session.posargs.append("salt")
|
|
|
|
_report_coverage(session, combine=True, cli_report=False, xml_report=True)
|
|
|
|
session.posargs.append("tests")
|
|
|
|
_report_coverage(session, combine=True, cli_report=False, xml_report=True)
|
2023-09-17 12:45:01 +01:00
|
|
|
|
|
|
|
|
2023-09-29 18:38:31 +01:00
|
|
|
@nox.session(python="3", name="create-xml-coverage-reports")
|
|
|
|
def create_xml_coverage_reports(session):
|
|
|
|
_create_xml_coverage_reports(session)
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(
|
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
|
|
|
name="create-xml-coverage-reports-onedir",
|
|
|
|
venv_params=["--system-site-packages"],
|
|
|
|
)
|
|
|
|
def create_xml_coverage_reports_onedir(session):
|
|
|
|
_create_xml_coverage_reports(session)
|
|
|
|
|
|
|
|
|
2023-10-05 09:57:50 +01:00
|
|
|
@nox.session(python="3", name="create-json-coverage-reports")
|
|
|
|
def create_json_coverage_reports(session):
|
|
|
|
_report_coverage(session, combine=True, cli_report=False, json_report=True)
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(
|
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
|
|
|
name="create-json-coverage-reports-onedir",
|
|
|
|
venv_params=["--system-site-packages"],
|
|
|
|
)
|
|
|
|
def create_json_coverage_reports_onedir(session):
|
|
|
|
_report_coverage(session, combine=True, cli_report=False, json_report=True)
|
2023-09-29 18:38:31 +01:00
|
|
|
|
|
|
|
|
2019-12-03 12:24:05 +00:00
|
|
|
class Tee:
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-12-03 12:24:05 +00:00
|
|
|
Python class to mimic linux tee behaviour
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
|
|
|
|
2019-12-03 12:24:05 +00:00
|
|
|
def __init__(self, first, second):
|
|
|
|
self._first = first
|
|
|
|
self._second = second
|
|
|
|
|
|
|
|
def write(self, b):
|
|
|
|
wrote = self._first.write(b)
|
|
|
|
self._first.flush()
|
|
|
|
self._second.write(b)
|
|
|
|
self._second.flush()
|
|
|
|
|
|
|
|
def fileno(self):
|
|
|
|
return self._first.fileno()
|
|
|
|
|
|
|
|
|
2024-02-25 10:37:08 +00:00
|
|
|
def _lint(session, rcfile, flags, paths, upgrade_setuptools_and_pip=True):
|
2021-09-22 12:57:30 +01:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session, upgrade=upgrade_setuptools_and_pip):
|
2023-06-02 08:09:41 +01:00
|
|
|
linux_requirements_file = os.path.join(
|
|
|
|
"requirements", "static", "ci", _get_pydir(session), "linux.txt"
|
|
|
|
)
|
|
|
|
lint_requirements_file = os.path.join(
|
2021-08-03 14:03:17 +01:00
|
|
|
"requirements", "static", "ci", _get_pydir(session), "lint.txt"
|
|
|
|
)
|
2023-06-02 08:09:41 +01:00
|
|
|
install_command = [
|
|
|
|
"--progress-bar=off",
|
|
|
|
"-r",
|
|
|
|
linux_requirements_file,
|
|
|
|
"-r",
|
|
|
|
lint_requirements_file,
|
|
|
|
]
|
2021-08-03 14:03:17 +01:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2020-01-03 13:30:03 +00:00
|
|
|
|
2023-06-03 09:26:26 +01:00
|
|
|
cmd_args = ["pylint", f"--rcfile={rcfile}"] + list(flags) + list(paths)
|
2020-01-03 13:30:03 +00:00
|
|
|
cmd_kwargs = {"env": {"PYTHONUNBUFFERED": "1"}}
|
2024-02-25 10:37:08 +00:00
|
|
|
session.run(*cmd_args, **cmd_kwargs)
|
2020-01-03 13:30:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def _lint_pre_commit(session, rcfile, flags, paths):
|
|
|
|
if "VIRTUAL_ENV" not in os.environ:
|
|
|
|
session.error(
|
|
|
|
"This should be running from within a virtualenv and "
|
|
|
|
"'VIRTUAL_ENV' was not found as an environment variable."
|
|
|
|
)
|
|
|
|
if "pre-commit" not in os.environ["VIRTUAL_ENV"]:
|
|
|
|
session.error(
|
|
|
|
"This should be running from within a pre-commit virtualenv and "
|
|
|
|
"'VIRTUAL_ENV'({}) does not appear to be a pre-commit virtualenv.".format(
|
|
|
|
os.environ["VIRTUAL_ENV"]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from nox.virtualenv import VirtualEnv
|
2020-04-02 20:10:20 -05:00
|
|
|
|
2020-01-03 13:30:03 +00:00
|
|
|
# Let's patch nox to make it run inside the pre-commit virtualenv
|
2024-02-25 10:37:08 +00:00
|
|
|
session._runner.venv = VirtualEnv(
|
|
|
|
os.environ["VIRTUAL_ENV"],
|
|
|
|
interpreter=session._runner.func.python,
|
|
|
|
reuse_existing=True,
|
|
|
|
venv=True,
|
|
|
|
)
|
2021-09-22 12:57:30 +01:00
|
|
|
_lint(
|
|
|
|
session,
|
|
|
|
rcfile,
|
|
|
|
flags,
|
|
|
|
paths,
|
|
|
|
upgrade_setuptools_and_pip=False,
|
|
|
|
)
|
2019-04-01 19:41:26 +01:00
|
|
|
|
|
|
|
|
2019-12-03 10:57:49 +00:00
|
|
|
@nox.session(python="3")
|
2019-04-01 19:41:26 +01:00
|
|
|
def lint(session):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2024-02-25 10:37:08 +00:00
|
|
|
Run PyLint against Salt and it's test suite.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2023-06-03 09:26:26 +01:00
|
|
|
session.notify(f"lint-salt-{session.python}")
|
|
|
|
session.notify(f"lint-tests-{session.python}")
|
2019-04-01 19:41:26 +01:00
|
|
|
|
|
|
|
|
2019-12-03 10:57:49 +00:00
|
|
|
@nox.session(python="3", name="lint-salt")
|
2019-04-01 19:41:26 +01:00
|
|
|
def lint_salt(session):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2024-02-25 10:37:08 +00:00
|
|
|
Run PyLint against Salt.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-12-03 11:51:53 +00:00
|
|
|
flags = ["--disable=I"]
|
2019-04-01 19:41:26 +01:00
|
|
|
if session.posargs:
|
|
|
|
paths = session.posargs
|
|
|
|
else:
|
2022-12-12 19:04:48 -07:00
|
|
|
# TBD replace paths entries when implement pyproject.toml
|
2024-02-25 10:37:08 +00:00
|
|
|
paths = ["setup.py", "noxfile.py", "salt/", "tools/"]
|
2019-12-03 10:57:49 +00:00
|
|
|
_lint(session, ".pylintrc", flags, paths)
|
2019-04-01 19:41:26 +01:00
|
|
|
|
|
|
|
|
2019-12-03 10:57:49 +00:00
|
|
|
@nox.session(python="3", name="lint-tests")
|
2019-04-01 19:41:26 +01:00
|
|
|
def lint_tests(session):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2024-02-25 10:37:08 +00:00
|
|
|
Run PyLint against Salt and it's test suite.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-12-03 11:51:53 +00:00
|
|
|
flags = ["--disable=I"]
|
2019-04-01 19:41:26 +01:00
|
|
|
if session.posargs:
|
|
|
|
paths = session.posargs
|
|
|
|
else:
|
|
|
|
paths = ["tests/"]
|
2019-12-03 10:57:49 +00:00
|
|
|
_lint(session, ".pylintrc", flags, paths)
|
2019-04-02 17:16:49 +01:00
|
|
|
|
|
|
|
|
2020-01-03 13:30:03 +00:00
|
|
|
@nox.session(python=False, name="lint-salt-pre-commit")
|
|
|
|
def lint_salt_pre_commit(session):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2024-02-25 10:37:08 +00:00
|
|
|
Run PyLint against Salt.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2020-01-03 13:30:03 +00:00
|
|
|
flags = ["--disable=I"]
|
|
|
|
if session.posargs:
|
|
|
|
paths = session.posargs
|
|
|
|
else:
|
2024-02-25 10:37:08 +00:00
|
|
|
paths = ["setup.py", "noxfile.py", "salt/", "tools/"]
|
2020-01-03 13:30:03 +00:00
|
|
|
_lint_pre_commit(session, ".pylintrc", flags, paths)
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python=False, name="lint-tests-pre-commit")
|
|
|
|
def lint_tests_pre_commit(session):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2024-02-25 10:37:08 +00:00
|
|
|
Run PyLint against Salt and it's test suite.
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2020-01-03 13:30:03 +00:00
|
|
|
flags = ["--disable=I"]
|
|
|
|
if session.posargs:
|
|
|
|
paths = session.posargs
|
|
|
|
else:
|
|
|
|
paths = ["tests/"]
|
|
|
|
_lint_pre_commit(session, ".pylintrc", flags, paths)
|
|
|
|
|
|
|
|
|
2019-05-29 11:36:03 +01:00
|
|
|
@nox.session(python="3")
|
2020-08-07 16:16:08 -04:00
|
|
|
@nox.parametrize("clean", [False, True])
|
2019-10-28 14:17:49 +00:00
|
|
|
@nox.parametrize("update", [False, True])
|
|
|
|
@nox.parametrize("compress", [False, True])
|
2020-08-07 16:16:08 -04:00
|
|
|
def docs(session, compress, update, clean):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-04-02 17:16:49 +01:00
|
|
|
Build Salt's Documentation
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2023-06-03 09:26:26 +01:00
|
|
|
session.notify(f"docs-html-{session.python}(compress={compress})")
|
2020-06-08 09:14:07 +01:00
|
|
|
session.notify(
|
|
|
|
find_session_runner(
|
|
|
|
session,
|
2022-08-23 07:31:42 +01:00
|
|
|
"docs-man",
|
|
|
|
session.python,
|
2020-06-08 09:14:07 +01:00
|
|
|
compress=compress,
|
|
|
|
update=update,
|
2020-08-07 16:16:08 -04:00
|
|
|
clean=clean,
|
2020-06-08 09:14:07 +01:00
|
|
|
)
|
|
|
|
)
|
2019-10-28 14:17:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
@nox.session(name="docs-html", python="3")
|
2020-08-07 16:16:08 -04:00
|
|
|
@nox.parametrize("clean", [False, True])
|
2019-10-28 14:17:49 +00:00
|
|
|
@nox.parametrize("compress", [False, True])
|
2020-08-07 16:16:08 -04:00
|
|
|
def docs_html(session, compress, clean):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-10-28 14:17:49 +00:00
|
|
|
Build Salt's HTML Documentation
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2021-08-03 14:03:17 +01:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
2023-06-02 08:08:59 +01:00
|
|
|
linux_requirements_file = os.path.join(
|
|
|
|
"requirements", "static", "ci", _get_pydir(session), "linux.txt"
|
|
|
|
)
|
|
|
|
base_requirements_file = os.path.join("requirements", "base.txt")
|
|
|
|
zeromq_requirements_file = os.path.join("requirements", "zeromq.txt")
|
|
|
|
docs_requirements_file = os.path.join(
|
2021-08-03 14:03:17 +01:00
|
|
|
"requirements", "static", "ci", _get_pydir(session), "docs.txt"
|
|
|
|
)
|
2023-06-02 08:08:59 +01:00
|
|
|
install_command = [
|
|
|
|
"--progress-bar=off",
|
|
|
|
"--constraint",
|
|
|
|
linux_requirements_file,
|
|
|
|
"-r",
|
|
|
|
base_requirements_file,
|
|
|
|
"-r",
|
|
|
|
zeromq_requirements_file,
|
|
|
|
"-r",
|
|
|
|
docs_requirements_file,
|
|
|
|
]
|
2021-08-03 14:03:17 +01:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2019-04-02 17:16:49 +01:00
|
|
|
os.chdir("doc/")
|
2020-08-07 16:16:08 -04:00
|
|
|
if clean:
|
|
|
|
session.run("make", "clean", external=True)
|
2019-05-29 11:28:55 +01:00
|
|
|
session.run("make", "html", "SPHINXOPTS=-W", external=True)
|
2019-10-28 14:17:49 +00:00
|
|
|
if compress:
|
2019-12-01 15:19:51 -07:00
|
|
|
session.run("tar", "-cJvf", "html-archive.tar.xz", "_build/html", external=True)
|
2019-10-28 14:17:49 +00:00
|
|
|
os.chdir("..")
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(name="docs-man", python="3")
|
2020-08-07 16:16:08 -04:00
|
|
|
@nox.parametrize("clean", [False, True])
|
2019-10-28 14:17:49 +00:00
|
|
|
@nox.parametrize("update", [False, True])
|
|
|
|
@nox.parametrize("compress", [False, True])
|
2020-08-07 16:16:08 -04:00
|
|
|
def docs_man(session, compress, update, clean):
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2019-10-28 14:17:49 +00:00
|
|
|
Build Salt's Manpages Documentation
|
2020-04-02 20:10:20 -05:00
|
|
|
"""
|
2021-08-03 14:03:17 +01:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
2023-06-02 08:08:59 +01:00
|
|
|
linux_requirements_file = os.path.join(
|
|
|
|
"requirements", "static", "ci", _get_pydir(session), "linux.txt"
|
|
|
|
)
|
|
|
|
base_requirements_file = os.path.join("requirements", "base.txt")
|
|
|
|
zeromq_requirements_file = os.path.join("requirements", "zeromq.txt")
|
|
|
|
docs_requirements_file = os.path.join(
|
2021-08-03 14:03:17 +01:00
|
|
|
"requirements", "static", "ci", _get_pydir(session), "docs.txt"
|
|
|
|
)
|
2023-06-02 08:08:59 +01:00
|
|
|
install_command = [
|
|
|
|
"--progress-bar=off",
|
|
|
|
"--constraint",
|
|
|
|
linux_requirements_file,
|
|
|
|
"-r",
|
|
|
|
base_requirements_file,
|
|
|
|
"-r",
|
|
|
|
zeromq_requirements_file,
|
|
|
|
"-r",
|
|
|
|
docs_requirements_file,
|
|
|
|
]
|
2021-08-03 14:03:17 +01:00
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2019-10-28 14:17:49 +00:00
|
|
|
os.chdir("doc/")
|
2020-08-07 16:16:08 -04:00
|
|
|
if clean:
|
|
|
|
session.run("make", "clean", external=True)
|
2019-10-28 14:17:49 +00:00
|
|
|
session.run("make", "man", "SPHINXOPTS=-W", external=True)
|
|
|
|
if update:
|
|
|
|
session.run("rm", "-rf", "man/", external=True)
|
|
|
|
session.run("cp", "-Rp", "_build/man", "man/", external=True)
|
|
|
|
if compress:
|
2019-12-01 15:19:51 -07:00
|
|
|
session.run("tar", "-cJvf", "man-archive.tar.xz", "_build/man", external=True)
|
2019-04-02 17:16:49 +01:00
|
|
|
os.chdir("..")
|
2020-04-23 11:48:17 +01:00
|
|
|
|
|
|
|
|
2020-04-14 18:37:33 -04:00
|
|
|
@nox.session(name="changelog", python="3")
|
|
|
|
@nox.parametrize("draft", [False, True])
|
2021-10-12 09:01:23 -04:00
|
|
|
@nox.parametrize("force", [False, True])
|
|
|
|
def changelog(session, draft, force):
|
2020-04-14 18:37:33 -04:00
|
|
|
"""
|
|
|
|
Generate salt's changelog
|
|
|
|
"""
|
2023-02-16 03:38:46 +00:00
|
|
|
session_warn(
|
|
|
|
session,
|
|
|
|
"Please stop using this nox session and start using the 'tools' command shown below.",
|
|
|
|
)
|
2021-08-03 14:03:17 +01:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
|
|
|
requirements_file = os.path.join(
|
2023-02-16 03:38:46 +00:00
|
|
|
"requirements", "static", "ci", _get_pydir(session), "tools.txt"
|
2021-08-03 14:03:17 +01:00
|
|
|
)
|
|
|
|
install_command = ["--progress-bar=off", "-r", requirements_file]
|
|
|
|
session.install(*install_command, silent=PIP_INSTALL_SILENT)
|
2020-04-14 18:37:33 -04:00
|
|
|
|
2023-02-16 03:38:46 +00:00
|
|
|
cmd = ["tools", "changelog", "update-changelog-md"]
|
2020-04-14 18:37:33 -04:00
|
|
|
if draft:
|
2023-02-16 03:38:46 +00:00
|
|
|
cmd.append("--draft")
|
|
|
|
cmd.append(session.posargs[0])
|
|
|
|
session.run(*cmd)
|
2023-01-18 11:09:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Recompress:
|
|
|
|
"""
|
|
|
|
Helper class to re-compress a ``.tag.gz`` file to make it reproducible.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, mtime):
|
|
|
|
self.mtime = int(mtime)
|
|
|
|
|
|
|
|
def tar_reset(self, tarinfo):
|
|
|
|
"""
|
|
|
|
Reset user, group, mtime, and mode to create reproducible tar.
|
|
|
|
"""
|
|
|
|
tarinfo.uid = tarinfo.gid = 0
|
|
|
|
tarinfo.uname = tarinfo.gname = "root"
|
|
|
|
tarinfo.mtime = self.mtime
|
|
|
|
if tarinfo.type == tarfile.DIRTYPE:
|
|
|
|
tarinfo.mode = 0o755
|
|
|
|
else:
|
|
|
|
tarinfo.mode = 0o644
|
|
|
|
if tarinfo.pax_headers:
|
|
|
|
raise ValueError(tarinfo.name, tarinfo.pax_headers)
|
|
|
|
return tarinfo
|
|
|
|
|
|
|
|
def recompress(self, targz):
|
|
|
|
"""
|
|
|
|
Re-compress the passed path.
|
|
|
|
"""
|
|
|
|
tempd = pathlib.Path(tempfile.mkdtemp()).resolve()
|
|
|
|
d_src = tempd.joinpath("src")
|
|
|
|
d_src.mkdir()
|
|
|
|
d_tar = tempd.joinpath(targz.stem)
|
|
|
|
d_targz = tempd.joinpath(targz.name)
|
|
|
|
with tarfile.open(d_tar, "w|") as wfile:
|
|
|
|
with tarfile.open(targz, "r:gz") as rfile:
|
2024-02-27 10:24:22 +00:00
|
|
|
rfile.extractall(d_src) # nosec
|
2023-01-18 11:09:56 +00:00
|
|
|
extracted_dir = next(pathlib.Path(d_src).iterdir())
|
|
|
|
for name in sorted(extracted_dir.rglob("*")):
|
|
|
|
wfile.add(
|
|
|
|
str(name),
|
|
|
|
filter=self.tar_reset,
|
|
|
|
recursive=False,
|
|
|
|
arcname=str(name.relative_to(d_src)),
|
|
|
|
)
|
|
|
|
|
|
|
|
with open(d_tar, "rb") as rfh:
|
|
|
|
with gzip.GzipFile(
|
|
|
|
fileobj=open(d_targz, "wb"), mode="wb", filename="", mtime=self.mtime
|
|
|
|
) as gz: # pylint: disable=invalid-name
|
|
|
|
while True:
|
|
|
|
chunk = rfh.read(1024)
|
|
|
|
if not chunk:
|
|
|
|
break
|
|
|
|
gz.write(chunk)
|
|
|
|
targz.unlink()
|
|
|
|
shutil.move(str(d_targz), str(targz))
|
|
|
|
|
|
|
|
|
|
|
|
@nox.session(python="3")
|
|
|
|
def build(session):
|
|
|
|
"""
|
|
|
|
Build source and binary distributions based off the current commit author date UNIX timestamp.
|
|
|
|
|
|
|
|
The reason being, reproducible packages.
|
|
|
|
|
|
|
|
.. code-block: shell
|
|
|
|
|
|
|
|
git show -s --format=%at HEAD
|
|
|
|
"""
|
|
|
|
shutil.rmtree("dist/", ignore_errors=True)
|
|
|
|
if SKIP_REQUIREMENTS_INSTALL is False:
|
|
|
|
session.install(
|
|
|
|
"--progress-bar=off",
|
|
|
|
"-r",
|
|
|
|
"requirements/build.txt",
|
|
|
|
silent=PIP_INSTALL_SILENT,
|
|
|
|
)
|
|
|
|
|
|
|
|
timestamp = session.run(
|
|
|
|
"git",
|
|
|
|
"show",
|
|
|
|
"-s",
|
|
|
|
"--format=%at",
|
|
|
|
"HEAD",
|
|
|
|
silent=True,
|
|
|
|
log=False,
|
|
|
|
stderr=None,
|
|
|
|
).strip()
|
|
|
|
env = {"SOURCE_DATE_EPOCH": str(timestamp)}
|
|
|
|
session.run(
|
|
|
|
"python",
|
|
|
|
"-m",
|
|
|
|
"build",
|
|
|
|
"--sdist",
|
|
|
|
str(REPO_ROOT),
|
|
|
|
env=env,
|
|
|
|
)
|
|
|
|
# Recreate sdist to be reproducible
|
|
|
|
recompress = Recompress(timestamp)
|
|
|
|
for targz in REPO_ROOT.joinpath("dist").glob("*.tar.gz"):
|
|
|
|
session.log("Re-compressing %s...", targz.relative_to(REPO_ROOT))
|
|
|
|
recompress.recompress(targz)
|
|
|
|
|
|
|
|
sha256sum = shutil.which("sha256sum")
|
|
|
|
if sha256sum:
|
|
|
|
packages = [
|
|
|
|
str(pkg.relative_to(REPO_ROOT))
|
|
|
|
for pkg in REPO_ROOT.joinpath("dist").iterdir()
|
|
|
|
]
|
|
|
|
session.run("sha256sum", *packages, external=True)
|
|
|
|
session.run("python", "-m", "twine", "check", "dist/*")
|
2023-01-17 11:21:32 -07:00
|
|
|
|
|
|
|
|
2023-03-13 12:02:33 +00:00
|
|
|
@nox.session(
|
|
|
|
python=str(ONEDIR_PYTHON_PATH),
|
2023-09-27 13:02:01 +01:00
|
|
|
name="ci-test-onedir-pkgs",
|
2023-03-23 06:37:47 +00:00
|
|
|
venv_params=["--system-site-packages"],
|
2023-03-13 12:02:33 +00:00
|
|
|
)
|
2023-09-27 13:02:01 +01:00
|
|
|
def ci_test_onedir_pkgs(session):
|
|
|
|
from nox.virtualenv import VirtualEnv
|
|
|
|
|
|
|
|
session_warn(session, "Replacing VirtualEnv instance...")
|
|
|
|
|
|
|
|
ci_test_onedir_path = REPO_ROOT / ".nox" / "ci-test-onedir"
|
2024-12-07 01:52:45 -07:00
|
|
|
if hasattr(session._runner.venv, "venv_or_virtualenv"):
|
|
|
|
venv = session._runner.venv.venv_or_virtualenv == "venv"
|
|
|
|
session._runner.venv = VirtualEnv(
|
|
|
|
str(ci_test_onedir_path.relative_to(REPO_ROOT)),
|
|
|
|
interpreter=session._runner.func.python,
|
|
|
|
reuse_existing=True,
|
|
|
|
venv=venv,
|
|
|
|
venv_params=session._runner.venv.venv_params,
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
venv = session._runner.venv.venv_backend in ("venv", "virtualenv")
|
|
|
|
session._runner.venv = VirtualEnv( # pylint: disable=unexpected-keyword-arg
|
|
|
|
str(ci_test_onedir_path.relative_to(REPO_ROOT)),
|
|
|
|
interpreter=session._runner.func.python,
|
|
|
|
reuse_existing=True,
|
|
|
|
venv_backend=session._runner.venv.venv_backend,
|
|
|
|
venv_params=session._runner.venv.venv_params,
|
|
|
|
)
|
2023-09-27 13:02:01 +01:00
|
|
|
os.environ["VIRTUAL_ENV"] = session._runner.venv.location
|
|
|
|
session._runner.venv.create()
|
|
|
|
|
2023-03-13 12:02:33 +00:00
|
|
|
if not ONEDIR_ARTIFACT_PATH.exists():
|
|
|
|
session.error(
|
|
|
|
"The salt onedir artifact, expected to be in '{}', was not found".format(
|
|
|
|
ONEDIR_ARTIFACT_PATH.relative_to(REPO_ROOT)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-12-10 09:44:21 +00:00
|
|
|
common_pytest_args = [
|
|
|
|
"--color=yes",
|
|
|
|
"--sys-stats",
|
|
|
|
"--run-destructive",
|
|
|
|
f"--output-columns={os.environ.get('OUTPUT_COLUMNS') or 120}",
|
|
|
|
"--pkg-system-service",
|
|
|
|
]
|
|
|
|
|
2023-03-13 12:02:33 +00:00
|
|
|
chunks = {
|
2024-05-08 10:10:56 +01:00
|
|
|
"install": [],
|
2023-03-13 12:02:33 +00:00
|
|
|
"upgrade": [
|
|
|
|
"--upgrade",
|
|
|
|
"--no-uninstall",
|
|
|
|
],
|
2023-07-31 18:08:38 -04:00
|
|
|
"downgrade": [
|
|
|
|
"--downgrade",
|
|
|
|
"--no-uninstall",
|
|
|
|
],
|
2023-03-13 12:02:33 +00:00
|
|
|
"download-pkgs": [
|
2023-03-14 17:35:20 +00:00
|
|
|
"--download-pkgs",
|
2023-03-13 12:02:33 +00:00
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
if not session.posargs or session.posargs[0] not in chunks:
|
|
|
|
chunk = "install"
|
|
|
|
session.log("Choosing default 'install' test type")
|
|
|
|
else:
|
|
|
|
chunk = session.posargs.pop(0)
|
|
|
|
|
|
|
|
cmd_args = chunks[chunk]
|
2024-01-15 18:07:28 +00:00
|
|
|
for arg in session.posargs:
|
|
|
|
if arg.startswith("tests/pytests/pkg/"):
|
|
|
|
# The user is passing test paths
|
|
|
|
cmd_args.pop()
|
|
|
|
break
|
2023-03-13 12:02:33 +00:00
|
|
|
|
|
|
|
if IS_LINUX:
|
|
|
|
# Fetch the toolchain
|
2023-03-08 15:23:57 +00:00
|
|
|
session_run_always(session, "python3", "-m", "relenv", "toolchain", "fetch")
|
2023-03-13 12:02:33 +00:00
|
|
|
|
|
|
|
# Install requirements
|
2023-11-21 13:42:41 +00:00
|
|
|
if _upgrade_pip_setuptools_and_wheel(session):
|
2023-10-11 11:53:19 -04:00
|
|
|
_install_requirements(session, "pyzmq")
|
2023-03-13 12:02:33 +00:00
|
|
|
env = {
|
|
|
|
"ONEDIR_TESTRUN": "1",
|
2023-04-15 17:28:31 +01:00
|
|
|
"PKG_TEST_TYPE": chunk,
|
2023-03-13 12:02:33 +00:00
|
|
|
}
|
|
|
|
|
2023-02-03 21:29:32 -05:00
|
|
|
pytest_args = (
|
2023-12-10 09:44:21 +00:00
|
|
|
common_pytest_args[:]
|
|
|
|
+ cmd_args[:]
|
2023-02-03 21:29:32 -05:00
|
|
|
+ [
|
2023-11-21 08:32:59 +00:00
|
|
|
f"--junitxml=artifacts/xml-unittests-output/test-results-{chunk}.xml",
|
|
|
|
f"--log-file=artifacts/logs/runtests-{chunk}.log",
|
2023-02-03 21:29:32 -05:00
|
|
|
]
|
|
|
|
+ session.posargs
|
|
|
|
)
|
2024-05-08 10:10:56 +01:00
|
|
|
append_tests_path = True
|
|
|
|
test_paths = (
|
|
|
|
"tests/pytests/pkg/",
|
|
|
|
str(REPO_ROOT / "tests" / "pytests" / "pkg"),
|
|
|
|
)
|
|
|
|
for arg in session.posargs:
|
|
|
|
if arg.startswith(test_paths):
|
|
|
|
append_tests_path = False
|
|
|
|
break
|
|
|
|
if append_tests_path:
|
|
|
|
pytest_args.append("tests/pytests/pkg/")
|
2023-11-21 08:32:59 +00:00
|
|
|
try:
|
|
|
|
_pytest(session, coverage=False, cmd_args=pytest_args, env=env)
|
|
|
|
except CommandFailed:
|
2023-12-07 11:44:45 +00:00
|
|
|
if os.environ.get("RERUN_FAILURES", "0") == "0":
|
|
|
|
# Don't rerun on failures
|
|
|
|
return
|
2023-11-21 08:32:59 +00:00
|
|
|
|
|
|
|
# Don't print the system information, not the test selection on reruns
|
|
|
|
global PRINT_TEST_SELECTION
|
|
|
|
global PRINT_SYSTEM_INFO
|
|
|
|
PRINT_TEST_SELECTION = False
|
|
|
|
PRINT_SYSTEM_INFO = False
|
|
|
|
|
|
|
|
pytest_args = (
|
2023-12-10 09:44:21 +00:00
|
|
|
common_pytest_args[:]
|
|
|
|
+ cmd_args[:]
|
2023-11-21 08:32:59 +00:00
|
|
|
+ [
|
|
|
|
f"--junitxml=artifacts/xml-unittests-output/test-results-{chunk}-rerun.xml",
|
|
|
|
f"--log-file=artifacts/logs/runtests-{chunk}-rerun.log",
|
|
|
|
"--lf",
|
|
|
|
]
|
|
|
|
+ session.posargs
|
|
|
|
)
|
2024-05-08 10:10:56 +01:00
|
|
|
if append_tests_path:
|
|
|
|
pytest_args.append("tests/pytests/pkg/")
|
2023-11-21 08:32:59 +00:00
|
|
|
_pytest(
|
|
|
|
session,
|
|
|
|
coverage=False,
|
|
|
|
cmd_args=pytest_args,
|
|
|
|
env=env,
|
|
|
|
on_rerun=True,
|
|
|
|
)
|
2023-08-02 17:33:37 -04:00
|
|
|
|
2023-03-13 12:02:33 +00:00
|
|
|
if chunk not in ("install", "download-pkgs"):
|
2024-09-18 18:05:24 -07:00
|
|
|
cmd_args = chunks[chunk]
|
2023-03-13 12:02:33 +00:00
|
|
|
pytest_args = (
|
2023-12-10 09:44:21 +00:00
|
|
|
common_pytest_args[:]
|
|
|
|
+ cmd_args[:]
|
2023-03-13 12:02:33 +00:00
|
|
|
+ [
|
2024-02-25 10:37:08 +00:00
|
|
|
"--junitxml=artifacts/xml-unittests-output/test-results-install.xml",
|
|
|
|
"--log-file=artifacts/logs/runtests-install.log",
|
2023-03-13 12:02:33 +00:00
|
|
|
]
|
|
|
|
+ session.posargs
|
2023-03-08 15:23:57 +00:00
|
|
|
)
|
2023-08-02 17:33:37 -04:00
|
|
|
if "downgrade" in chunk:
|
|
|
|
pytest_args.append("--use-prev-version")
|
2024-05-08 10:10:56 +01:00
|
|
|
if append_tests_path:
|
|
|
|
pytest_args.append("tests/pytests/pkg/")
|
2023-11-21 08:32:59 +00:00
|
|
|
try:
|
|
|
|
_pytest(session, coverage=False, cmd_args=pytest_args, env=env)
|
|
|
|
except CommandFailed:
|
2024-05-07 11:21:48 +01:00
|
|
|
if os.environ.get("RERUN_FAILURES", "0") == "0":
|
|
|
|
# Don't rerun on failures
|
|
|
|
return
|
2024-09-18 18:05:24 -07:00
|
|
|
cmd_args = chunks[chunk]
|
2023-11-21 08:32:59 +00:00
|
|
|
pytest_args = (
|
2023-12-10 09:44:21 +00:00
|
|
|
common_pytest_args[:]
|
|
|
|
+ cmd_args[:]
|
2023-11-21 08:32:59 +00:00
|
|
|
+ [
|
2024-02-25 10:37:08 +00:00
|
|
|
"--junitxml=artifacts/xml-unittests-output/test-results-install-rerun.xml",
|
|
|
|
"--log-file=artifacts/logs/runtests-install-rerun.log",
|
2023-11-21 08:32:59 +00:00
|
|
|
"--lf",
|
|
|
|
]
|
|
|
|
+ session.posargs
|
|
|
|
)
|
|
|
|
if "downgrade" in chunk:
|
|
|
|
pytest_args.append("--use-prev-version")
|
2024-05-08 10:10:56 +01:00
|
|
|
if append_tests_path:
|
|
|
|
pytest_args.append("tests/pytests/pkg/")
|
2023-11-21 08:32:59 +00:00
|
|
|
_pytest(
|
|
|
|
session,
|
|
|
|
coverage=False,
|
|
|
|
cmd_args=pytest_args,
|
|
|
|
env=env,
|
|
|
|
on_rerun=True,
|
|
|
|
)
|
2023-03-13 12:02:33 +00:00
|
|
|
sys.exit(0)
|