From 28d144aa46064505250f5f1896c6a3fff2a84cca Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Wed, 26 Jun 2024 18:24:33 -0600 Subject: [PATCH 001/157] Remove deprecated pyvenv --- salt/modules/virtualenv_mod.py | 127 +++++++++------------------------ salt/states/virtualenv_mod.py | 4 +- 2 files changed, 36 insertions(+), 95 deletions(-) diff --git a/salt/modules/virtualenv_mod.py b/salt/modules/virtualenv_mod.py index 042847fde40..cb0a6322e7d 100644 --- a/salt/modules/virtualenv_mod.py +++ b/salt/modules/virtualenv_mod.py @@ -82,8 +82,6 @@ def create( never_download=None, prompt=None, pip=False, - symlinks=None, - upgrade=None, user=None, use_vt=False, saltenv="base", @@ -101,7 +99,7 @@ def create( Defaults to ``virtualenv``. system_site_packages : False - Passthrough argument given to virtualenv or pyvenv + Passthrough argument given to virtualenv distribute : False Passthrough argument given to virtualenv @@ -111,7 +109,7 @@ def create( ``distribute=True`` clear : False - Passthrough argument given to virtualenv or pyvenv + Passthrough argument given to virtualenv python : None (default) Passthrough argument given to virtualenv @@ -125,12 +123,6 @@ def create( prompt : None (default) Passthrough argument given to virtualenv if not None - symlinks : None - Passthrough argument given to pyvenv if True - - upgrade : None - Passthrough argument given to pyvenv if True - user : None Set ownership for the virtualenv @@ -173,98 +165,47 @@ def create( - env: - VIRTUALENV_ALWAYS_COPY: 1 """ + # TODO venv_bin can be "sys.executable -m venv" if venv_bin is None: venv_bin = __opts__.get("venv_bin") or __pillar__.get("venv_bin") cmd = [venv_bin] - if "pyvenv" not in venv_bin: - # ----- Stop the user if pyvenv only options are used ---------------> - # If any of the following values are not None, it means that the user - # is actually passing a True or False value. Stop Him! - if upgrade is not None: - raise CommandExecutionError( - "The `upgrade`(`--upgrade`) option is not supported by '{}'".format( - venv_bin - ) - ) - elif symlinks is not None: - raise CommandExecutionError( - "The `symlinks`(`--symlinks`) option is not supported by '{}'".format( - venv_bin - ) - ) - # <---- Stop the user if pyvenv only options are used ---------------- + virtualenv_version_info = virtualenv_ver(venv_bin, user=user, **kwargs) - virtualenv_version_info = virtualenv_ver(venv_bin, user=user, **kwargs) - - if distribute: - if virtualenv_version_info >= (1, 10): - log.info( - "The virtualenv '--distribute' option has been " - "deprecated in virtualenv(>=1.10), as such, the " - "'distribute' option to `virtualenv.create()` has " - "also been deprecated and it's not necessary anymore." - ) - else: - cmd.append("--distribute") - - if python is not None and python.strip() != "": - if not salt.utils.path.which(python): - raise CommandExecutionError(f"Cannot find requested python ({python}).") - cmd.append(f"--python={python}") - if extra_search_dir is not None: - if isinstance(extra_search_dir, str) and extra_search_dir.strip() != "": - extra_search_dir = [e.strip() for e in extra_search_dir.split(",")] - for entry in extra_search_dir: - cmd.append(f"--extra-search-dir={entry}") - if never_download is True: - if (1, 10) <= virtualenv_version_info < (14, 0, 0): - log.info( - "--never-download was deprecated in 1.10.0, but reimplemented in" - " 14.0.0. If this feature is needed, please install a supported" - " virtualenv version." - ) - else: - cmd.append("--never-download") - if prompt is not None and prompt.strip() != "": - cmd.append(f"--prompt='{prompt}'") - else: - # venv module from the Python >= 3.3 standard library - - # ----- Stop the user if virtualenv only options are being used -----> - # If any of the following values are not None, it means that the user - # is actually passing a True or False value. Stop Him! - if python is not None and python.strip() != "": - raise CommandExecutionError( - "The `python`(`--python`) option is not supported by '{}'".format( - venv_bin - ) + if distribute: + if virtualenv_version_info >= (1, 10): + log.info( + "The virtualenv '--distribute' option has been " + "deprecated in virtualenv(>=1.10), as such, the " + "'distribute' option to `virtualenv.create()` has " + "also been deprecated and it's not necessary anymore." ) - elif extra_search_dir is not None and extra_search_dir.strip() != "": - raise CommandExecutionError( - "The `extra_search_dir`(`--extra-search-dir`) option is not " - "supported by '{}'".format(venv_bin) - ) - elif never_download is not None: - raise CommandExecutionError( - "The `never_download`(`--never-download`) option is not " - "supported by '{}'".format(venv_bin) - ) - elif prompt is not None and prompt.strip() != "": - raise CommandExecutionError( - "The `prompt`(`--prompt`) option is not supported by '{}'".format( - venv_bin - ) - ) - # <---- Stop the user if virtualenv only options are being used ------ + else: + cmd.append("--distribute") - if upgrade is True: - cmd.append("--upgrade") - if symlinks is True: - cmd.append("--symlinks") + if python is not None and python.strip() != "": + if not salt.utils.path.which(python): + raise CommandExecutionError(f"Cannot find requested python ({python}).") + cmd.append(f"--python={python}") + if extra_search_dir is not None: + if isinstance(extra_search_dir, str) and extra_search_dir.strip() != "": + extra_search_dir = [e.strip() for e in extra_search_dir.split(",")] + for entry in extra_search_dir: + cmd.append(f"--extra-search-dir={entry}") + if never_download is True: + if (1, 10) <= virtualenv_version_info < (14, 0, 0): + log.info( + "--never-download was deprecated in 1.10.0, but reimplemented in" + " 14.0.0. If this feature is needed, please install a supported" + " virtualenv version." + ) + else: + cmd.append("--never-download") + if prompt is not None and prompt.strip() != "": + cmd.append(f"--prompt='{prompt}'") - # Common options to virtualenv and pyvenv + # Common options to virtualenv if clear is True: cmd.append("--clear") if system_site_packages is True: diff --git a/salt/states/virtualenv_mod.py b/salt/states/virtualenv_mod.py index 7dadfa23fd5..ceb25effb66 100644 --- a/salt/states/virtualenv_mod.py +++ b/salt/states/virtualenv_mod.py @@ -137,8 +137,8 @@ def managed( Current versions of Salt use onedir packages and will use onedir python interpreter by default. If you've installed Salt via out package repository. You will likely want to provide the path to the interpreter - with wich you would like to be used to create the virtual envrionment. The - interperter can be specified by providing the `python` option. + with which you would like to be used to create the virtual environment. The + interpreter can be specified by providing the `python` option. """ ret = {"name": name, "result": True, "comment": "", "changes": {}} From bb26d8c97c1bd2da85ac6b995d8598b0f1e05ff3 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Thu, 27 Jun 2024 16:25:53 -0600 Subject: [PATCH 002/157] replace pyvenv with builtin venv --- salt/modules/virtualenv_mod.py | 136 ++++++++++++++++------ tests/unit/modules/test_virtualenv_mod.py | 34 +++--- 2 files changed, 117 insertions(+), 53 deletions(-) diff --git a/salt/modules/virtualenv_mod.py b/salt/modules/virtualenv_mod.py index cb0a6322e7d..0e07263d3ff 100644 --- a/salt/modules/virtualenv_mod.py +++ b/salt/modules/virtualenv_mod.py @@ -27,7 +27,10 @@ KNOWN_BINARY_NAMES = frozenset( log = logging.getLogger(__name__) -__opts__ = {"venv_bin": salt.utils.path.which_bin(KNOWN_BINARY_NAMES) or "virtualenv"} +__opts__ = { + "venv_bin": salt.utils.path.which_bin(KNOWN_BINARY_NAMES) + or f"{sys.executable} -m venv" +} __pillar__ = {} @@ -82,6 +85,8 @@ def create( never_download=None, prompt=None, pip=False, + symlinks=None, + upgrade=None, user=None, use_vt=False, saltenv="base", @@ -99,7 +104,7 @@ def create( Defaults to ``virtualenv``. system_site_packages : False - Passthrough argument given to virtualenv + Passthrough argument given to virtualenv or venv distribute : False Passthrough argument given to virtualenv @@ -109,7 +114,7 @@ def create( ``distribute=True`` clear : False - Passthrough argument given to virtualenv + Passthrough argument given to virtualenv or venv python : None (default) Passthrough argument given to virtualenv @@ -123,6 +128,12 @@ def create( prompt : None (default) Passthrough argument given to virtualenv if not None + symlinks : None + Passthrough argument given to venv if True + + upgrade : None + Passthrough argument given to venv if True + user : None Set ownership for the virtualenv @@ -165,47 +176,98 @@ def create( - env: - VIRTUALENV_ALWAYS_COPY: 1 """ - # TODO venv_bin can be "sys.executable -m venv" if venv_bin is None: - venv_bin = __opts__.get("venv_bin") or __pillar__.get("venv_bin") + venv_bin = __pillar__.get("venv_bin") or __opts__.get("venv_bin") cmd = [venv_bin] - virtualenv_version_info = virtualenv_ver(venv_bin, user=user, **kwargs) - - if distribute: - if virtualenv_version_info >= (1, 10): - log.info( - "The virtualenv '--distribute' option has been " - "deprecated in virtualenv(>=1.10), as such, the " - "'distribute' option to `virtualenv.create()` has " - "also been deprecated and it's not necessary anymore." + if "venv" not in venv_bin: + # ----- Stop the user if venv only options are used -----------------> + # If any of the following values are not None, it means that the user + # is actually passing a True or False value. Stop Him! + if upgrade is not None: + raise CommandExecutionError( + "The `upgrade`(`--upgrade`) option is not supported by '{}'".format( + venv_bin + ) ) - else: - cmd.append("--distribute") - - if python is not None and python.strip() != "": - if not salt.utils.path.which(python): - raise CommandExecutionError(f"Cannot find requested python ({python}).") - cmd.append(f"--python={python}") - if extra_search_dir is not None: - if isinstance(extra_search_dir, str) and extra_search_dir.strip() != "": - extra_search_dir = [e.strip() for e in extra_search_dir.split(",")] - for entry in extra_search_dir: - cmd.append(f"--extra-search-dir={entry}") - if never_download is True: - if (1, 10) <= virtualenv_version_info < (14, 0, 0): - log.info( - "--never-download was deprecated in 1.10.0, but reimplemented in" - " 14.0.0. If this feature is needed, please install a supported" - " virtualenv version." + elif symlinks is not None: + raise CommandExecutionError( + "The `symlinks`(`--symlinks`) option is not supported by '{}'".format( + venv_bin + ) ) - else: - cmd.append("--never-download") - if prompt is not None and prompt.strip() != "": - cmd.append(f"--prompt='{prompt}'") + # <---- Stop the user if venv only options are used ------------------ - # Common options to virtualenv + virtualenv_version_info = virtualenv_ver(venv_bin, user=user, **kwargs) + + if distribute: + if virtualenv_version_info >= (1, 10): + log.info( + "The virtualenv '--distribute' option has been " + "deprecated in virtualenv(>=1.10), as such, the " + "'distribute' option to `virtualenv.create()` has " + "also been deprecated and it's not necessary anymore." + ) + else: + cmd.append("--distribute") + + if python is not None and python.strip() != "": + if not salt.utils.path.which(python): + raise CommandExecutionError(f"Cannot find requested python ({python}).") + cmd.append(f"--python={python}") + if extra_search_dir is not None: + if isinstance(extra_search_dir, str) and extra_search_dir.strip() != "": + extra_search_dir = [e.strip() for e in extra_search_dir.split(",")] + for entry in extra_search_dir: + cmd.append(f"--extra-search-dir={entry}") + if never_download is True: + if (1, 10) <= virtualenv_version_info < (14, 0, 0): + log.info( + "--never-download was deprecated in 1.10.0, but reimplemented in" + " 14.0.0. If this feature is needed, please install a supported" + " virtualenv version." + ) + else: + cmd.append("--never-download") + if prompt is not None and prompt.strip() != "": + cmd.append(f"--prompt='{prompt}'") + else: + # venv module from the Python >= 3.3 standard library + + # ----- Stop the user if virtualenv only options are being used -----> + # If any of the following values are not None, it means that the user + # is actually passing a True or False value. Stop Him! + if python is not None and python.strip() != "": + raise CommandExecutionError( + "The `python`(`--python`) option is not supported by '{}'".format( + venv_bin + ) + ) + elif extra_search_dir is not None and extra_search_dir.strip() != "": + raise CommandExecutionError( + "The `extra_search_dir`(`--extra-search-dir`) option is not " + "supported by '{}'".format(venv_bin) + ) + elif never_download is not None: + raise CommandExecutionError( + "The `never_download`(`--never-download`) option is not " + "supported by '{}'".format(venv_bin) + ) + elif prompt is not None and prompt.strip() != "": + raise CommandExecutionError( + "The `prompt`(`--prompt`) option is not supported by '{}'".format( + venv_bin + ) + ) + # <---- Stop the user if virtualenv only options are being used ------ + + if upgrade is True: + cmd.append("--upgrade") + if symlinks is True: + cmd.append("--symlinks") + + # Common options to virtualenv and venv if clear is True: cmd.append("--clear") if system_site_packages is True: diff --git a/tests/unit/modules/test_virtualenv_mod.py b/tests/unit/modules/test_virtualenv_mod.py index 552a93264b2..bd682b6a22a 100644 --- a/tests/unit/modules/test_virtualenv_mod.py +++ b/tests/unit/modules/test_virtualenv_mod.py @@ -17,6 +17,8 @@ from tests.support.mixins import LoaderModuleMockMixin from tests.support.mock import MagicMock, patch from tests.support.unit import TestCase +VENV_BIN = f"{sys.executable} -m venv" + class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): def setup_loader_modules(self): @@ -146,7 +148,7 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): ) def test_unapplicable_options(self): - # ----- Virtualenv using pyvenv options -----------------------------> + # ----- Virtualenv using venv options -------------------------------> mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(virtualenv_mod.__salt__, {"cmd.run_all": mock}): self.assertRaises( @@ -166,19 +168,19 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): venv_bin="virtualenv", symlinks=True, ) - # <---- Virtualenv using pyvenv options ------------------------------ + # <---- Virtualenv using venv options -------------------------------- - # ----- pyvenv using virtualenv options -----------------------------> + # ----- venv using virtualenv options -------------------------------> mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict( virtualenv_mod.__salt__, - {"cmd.run_all": mock, "cmd.which_bin": lambda _: "pyvenv"}, + {"cmd.run_all": mock, "cmd.which_bin": lambda _: VENV_BIN}, ): self.assertRaises( CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin="pyvenv", + venv_bin=VENV_BIN, python="python2.7", ) @@ -187,7 +189,7 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin="pyvenv", + venv_bin=VENV_BIN, prompt="PY Prompt", ) @@ -196,7 +198,7 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin="pyvenv", + venv_bin=VENV_BIN, never_download=True, ) @@ -205,10 +207,10 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin="pyvenv", + venv_bin=VENV_BIN, extra_search_dir="/tmp/bar", ) - # <---- pyvenv using virtualenv options ------------------------------ + # <---- venv using virtualenv options -------------------------------- def test_get_virtualenv_version_from_shell(self): with ForceImportErrorOn("virtualenv"): @@ -321,30 +323,30 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): ) def test_upgrade_argument(self): - # We test for pyvenv only because with virtualenv this is un + # We test for venv only because with virtualenv this is un # unsupported option. mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(virtualenv_mod.__salt__, {"cmd.run_all": mock}): - virtualenv_mod.create("/tmp/foo", venv_bin="pyvenv", upgrade=True) + virtualenv_mod.create("/tmp/foo", venv_bin=VENV_BIN, upgrade=True) mock.assert_called_once_with( - ["pyvenv", "--upgrade", "/tmp/foo"], runas=None, python_shell=False + [VENV_BIN, "--upgrade", "/tmp/foo"], runas=None, python_shell=False ) def test_symlinks_argument(self): - # We test for pyvenv only because with virtualenv this is un + # We test for venv only because with virtualenv this is un # unsupported option. mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(virtualenv_mod.__salt__, {"cmd.run_all": mock}): - virtualenv_mod.create("/tmp/foo", venv_bin="pyvenv", symlinks=True) + virtualenv_mod.create("/tmp/foo", venv_bin=VENV_BIN, symlinks=True) mock.assert_called_once_with( - ["pyvenv", "--symlinks", "/tmp/foo"], runas=None, python_shell=False + [VENV_BIN, "--symlinks", "/tmp/foo"], runas=None, python_shell=False ) def test_virtualenv_ver(self): """ test virtualenv_ver when there is no ImportError """ - ret = virtualenv_mod.virtualenv_ver(venv_bin="pyvenv") + ret = virtualenv_mod.virtualenv_ver(venv_bin=VENV_BIN) assert ret == (1, 9, 1) def test_virtualenv_ver_importerror(self): From 1075ec077c2311af95a78aeecf896c4677848e52 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Fri, 28 Jun 2024 09:23:22 -0600 Subject: [PATCH 003/157] replace 'venv' with the module --- salt/modules/virtualenv_mod.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/salt/modules/virtualenv_mod.py b/salt/modules/virtualenv_mod.py index 0e07263d3ff..cd52435e6f5 100644 --- a/salt/modules/virtualenv_mod.py +++ b/salt/modules/virtualenv_mod.py @@ -27,10 +27,7 @@ KNOWN_BINARY_NAMES = frozenset( log = logging.getLogger(__name__) -__opts__ = { - "venv_bin": salt.utils.path.which_bin(KNOWN_BINARY_NAMES) - or f"{sys.executable} -m venv" -} +__opts__ = {"venv_bin": salt.utils.path.which_bin(KNOWN_BINARY_NAMES) or "venv"} __pillar__ = {} @@ -179,7 +176,10 @@ def create( if venv_bin is None: venv_bin = __pillar__.get("venv_bin") or __opts__.get("venv_bin") - cmd = [venv_bin] + if venv_bin == "venv": + cmd = [sys.executable, "-m", "venv"] + else: + cmd = [venv_bin] if "venv" not in venv_bin: # ----- Stop the user if venv only options are used -----------------> From a7381119cd3032dcc48fcc5498e5d28d09e9f4d6 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Fri, 28 Jun 2024 09:24:38 -0600 Subject: [PATCH 004/157] added changelog --- changelog/66132.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/66132.fixed.md diff --git a/changelog/66132.fixed.md b/changelog/66132.fixed.md new file mode 100644 index 00000000000..7a64fee8c1e --- /dev/null +++ b/changelog/66132.fixed.md @@ -0,0 +1 @@ +Replaced pyvenv with builtin venv for virtualenv_mod From eb723cdc7ef7bfd8dc0b215aaa157e22572e699b Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Mon, 1 Jul 2024 09:43:30 -0600 Subject: [PATCH 005/157] Simplify tests to just use venv --- tests/unit/modules/test_virtualenv_mod.py | 34 +++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/unit/modules/test_virtualenv_mod.py b/tests/unit/modules/test_virtualenv_mod.py index bd682b6a22a..552a93264b2 100644 --- a/tests/unit/modules/test_virtualenv_mod.py +++ b/tests/unit/modules/test_virtualenv_mod.py @@ -17,8 +17,6 @@ from tests.support.mixins import LoaderModuleMockMixin from tests.support.mock import MagicMock, patch from tests.support.unit import TestCase -VENV_BIN = f"{sys.executable} -m venv" - class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): def setup_loader_modules(self): @@ -148,7 +146,7 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): ) def test_unapplicable_options(self): - # ----- Virtualenv using venv options -------------------------------> + # ----- Virtualenv using pyvenv options -----------------------------> mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(virtualenv_mod.__salt__, {"cmd.run_all": mock}): self.assertRaises( @@ -168,19 +166,19 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): venv_bin="virtualenv", symlinks=True, ) - # <---- Virtualenv using venv options -------------------------------- + # <---- Virtualenv using pyvenv options ------------------------------ - # ----- venv using virtualenv options -------------------------------> + # ----- pyvenv using virtualenv options -----------------------------> mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict( virtualenv_mod.__salt__, - {"cmd.run_all": mock, "cmd.which_bin": lambda _: VENV_BIN}, + {"cmd.run_all": mock, "cmd.which_bin": lambda _: "pyvenv"}, ): self.assertRaises( CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin=VENV_BIN, + venv_bin="pyvenv", python="python2.7", ) @@ -189,7 +187,7 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin=VENV_BIN, + venv_bin="pyvenv", prompt="PY Prompt", ) @@ -198,7 +196,7 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin=VENV_BIN, + venv_bin="pyvenv", never_download=True, ) @@ -207,10 +205,10 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): CommandExecutionError, virtualenv_mod.create, "/tmp/foo", - venv_bin=VENV_BIN, + venv_bin="pyvenv", extra_search_dir="/tmp/bar", ) - # <---- venv using virtualenv options -------------------------------- + # <---- pyvenv using virtualenv options ------------------------------ def test_get_virtualenv_version_from_shell(self): with ForceImportErrorOn("virtualenv"): @@ -323,30 +321,30 @@ class VirtualenvTestCase(TestCase, LoaderModuleMockMixin): ) def test_upgrade_argument(self): - # We test for venv only because with virtualenv this is un + # We test for pyvenv only because with virtualenv this is un # unsupported option. mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(virtualenv_mod.__salt__, {"cmd.run_all": mock}): - virtualenv_mod.create("/tmp/foo", venv_bin=VENV_BIN, upgrade=True) + virtualenv_mod.create("/tmp/foo", venv_bin="pyvenv", upgrade=True) mock.assert_called_once_with( - [VENV_BIN, "--upgrade", "/tmp/foo"], runas=None, python_shell=False + ["pyvenv", "--upgrade", "/tmp/foo"], runas=None, python_shell=False ) def test_symlinks_argument(self): - # We test for venv only because with virtualenv this is un + # We test for pyvenv only because with virtualenv this is un # unsupported option. mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(virtualenv_mod.__salt__, {"cmd.run_all": mock}): - virtualenv_mod.create("/tmp/foo", venv_bin=VENV_BIN, symlinks=True) + virtualenv_mod.create("/tmp/foo", venv_bin="pyvenv", symlinks=True) mock.assert_called_once_with( - [VENV_BIN, "--symlinks", "/tmp/foo"], runas=None, python_shell=False + ["pyvenv", "--symlinks", "/tmp/foo"], runas=None, python_shell=False ) def test_virtualenv_ver(self): """ test virtualenv_ver when there is no ImportError """ - ret = virtualenv_mod.virtualenv_ver(venv_bin=VENV_BIN) + ret = virtualenv_mod.virtualenv_ver(venv_bin="pyvenv") assert ret == (1, 9, 1) def test_virtualenv_ver_importerror(self): From 3b697d39a2210e56104e2a7da5cf9bebf3743765 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Tue, 9 Jul 2024 13:42:25 -0600 Subject: [PATCH 006/157] file.replace and file.search work properly with /proc files --- changelog/63102.fixed.md | 1 + salt/modules/file.py | 2 +- .../unit/modules/file/test_file_block_replace.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 changelog/63102.fixed.md diff --git a/changelog/63102.fixed.md b/changelog/63102.fixed.md new file mode 100644 index 00000000000..535e1a6c804 --- /dev/null +++ b/changelog/63102.fixed.md @@ -0,0 +1 @@ +file.replace and file.search work properly with /proc files diff --git a/salt/modules/file.py b/salt/modules/file.py index e7514091363..e2d2eabaae0 100644 --- a/salt/modules/file.py +++ b/salt/modules/file.py @@ -2539,7 +2539,7 @@ def replace( r_data = mmap.mmap(r_file.fileno(), 0, access=mmap.ACCESS_READ) except (ValueError, OSError): # size of file in /proc is 0, but contains data - r_data = salt.utils.stringutils.to_bytes("".join(r_file)) + r_data = b"".join(r_file) if search_only: # Just search; bail as early as a match is found if re.search(cpattern, r_data): diff --git a/tests/pytests/unit/modules/file/test_file_block_replace.py b/tests/pytests/unit/modules/file/test_file_block_replace.py index 8a05154f41c..8cc9b818b51 100644 --- a/tests/pytests/unit/modules/file/test_file_block_replace.py +++ b/tests/pytests/unit/modules/file/test_file_block_replace.py @@ -48,6 +48,7 @@ def configure_loader_modules(): "__grains__": grains, "__utils__": { "files.is_binary": MagicMock(return_value=False), + "files.is_text": salt.utils.files.is_text, "files.get_encoding": MagicMock(return_value="utf-8"), "stringutils.get_diff": salt.utils.stringutils.get_diff, }, @@ -546,3 +547,17 @@ def test_unfinished_block_exception(multiline_file): content="foobar", backup=False, ) + + +def test_search_proc_file(): + """ + Test that searching content in a /proc file does not raise a TypeError + and handles bytes correctly. + """ + proc_file_path = "/proc/cpuinfo" + + if not os.path.exists(proc_file_path): + pytest.skip(f"{proc_file_path} not available") + + match_found = filemod.search(proc_file_path, "processor") + assert match_found, "Failed to find 'processor' in /proc/cpuinfo" From f1d50c0ce2d15265820b420be20efbc11898bbb8 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sat, 13 Jul 2024 16:11:30 -0700 Subject: [PATCH 007/157] Fix pkg tests on arch --- tests/pytests/functional/states/test_pkg.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pytests/functional/states/test_pkg.py b/tests/pytests/functional/states/test_pkg.py index 01d6d5c7f5f..f1980abf20c 100644 --- a/tests/pytests/functional/states/test_pkg.py +++ b/tests/pytests/functional/states/test_pkg.py @@ -4,6 +4,7 @@ tests for pkg state import logging import os +import subprocess import time import pytest @@ -38,6 +39,16 @@ def refresh_db(grains, modules): pytest.fail("Package database locked after 60 seconds, bailing out") +@pytest.fixture(scope="module", autouse=True) +def refresh_keys(grains, modules): + if grains["os_family"] == "Arch": + # We should be running this periodically when building new test runner + # images, otherwise this could take several minuets to complete. + proc = subprocess.run(["pacman-key", "--refresh-keys"], check=False) + if proc.returncode != 0: + pytest.fail("pacman-key --refresh-keys command failed.") + + @pytest.fixture def PKG_TARGETS(grains): _PKG_TARGETS = ["figlet", "sl"] From 060b0d2e432314fbff33f5caca0e336cd1fe62e1 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Tue, 12 Mar 2024 16:22:38 -0600 Subject: [PATCH 008/157] Ensure on rpm systems, that user and group for existing Salt, is maintained on upgrade --- changelog/65264.fixed.md | 1 + pkg/rpm/salt.spec | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 changelog/65264.fixed.md diff --git a/changelog/65264.fixed.md b/changelog/65264.fixed.md new file mode 100644 index 00000000000..f12bad4e2db --- /dev/null +++ b/changelog/65264.fixed.md @@ -0,0 +1 @@ +Ensure on rpm systems, that user and group for existing Salt, is maintained on upgrade diff --git a/pkg/rpm/salt.spec b/pkg/rpm/salt.spec index d783f29c048..c7340e6a5a7 100644 --- a/pkg/rpm/salt.spec +++ b/pkg/rpm/salt.spec @@ -425,11 +425,24 @@ usermod -c "%{_SALT_NAME}" \ %{_SALT_USER} %pre master -# Reset permissions to fix previous installs -PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") -find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ - \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ - \( -user salt -o -group salt \) -exec chown root:root \{\} \; +if [ $1 -gt 1 ] ; then + # Reset permissions to match previous installs + PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") + _CUR_USER=$(command -v salt-master | xargs ls -l | cut -d ' ' -f 3) + _CUR_GROUP=$(command -v salt-master | xargs ls -l | cut -d ' ' -f 4) + find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ + \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ + \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; +fi + +%pre minion +if [ $1 -gt 1 ] ; then + # Reset permissions to match previous installs + _CUR_USER=$(command -v salt-minion | xargs ls -l | cut -d ' ' -f 3) + _CUR_GROUP=$(command -v salt-minion | xargs ls -l | cut -d ' ' -f 4) + find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ + \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; +fi # assumes systemd for RHEL 7 & 8 & 9 From cb6802b35d35259d9d5562280ffcdc56c9418501 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 25 Apr 2024 15:43:37 -0600 Subject: [PATCH 009/157] WIP - testing rpm solution for ownership on upgrade --- changelog/65264.fixed.md | 2 +- pkg/debian/salt-api.postinst | 13 ++++-- pkg/debian/salt-cloud.postinst | 10 ++++- pkg/debian/salt-master.config | 7 +++ pkg/debian/salt-master.postinst | 21 +++++---- pkg/debian/salt-master.preinst | 4 ++ pkg/debian/salt-master.templates | 5 +++ pkg/rpm/salt.spec | 77 ++++++++++++++++++++++++-------- 8 files changed, 105 insertions(+), 34 deletions(-) create mode 100644 pkg/debian/salt-master.config create mode 100644 pkg/debian/salt-master.templates diff --git a/changelog/65264.fixed.md b/changelog/65264.fixed.md index f12bad4e2db..42bb45ac968 100644 --- a/changelog/65264.fixed.md +++ b/changelog/65264.fixed.md @@ -1 +1 @@ -Ensure on rpm systems, that user and group for existing Salt, is maintained on upgrade +Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 9345d72bf2a..0624c297c85 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -1,10 +1,15 @@ +. /usr/share/debconf/confmodule + case "$1" in configure) - if [ ! -e "/var/log/salt/api" ]; then - touch /var/log/salt/api - chmod 640 /var/log/salt/api + db_get salt-master/user + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/api" ]; then + touch /var/log/salt/api + chmod 640 /var/log/salt/api + fi + chown $RET:$RET /var/log/salt/api fi - chown salt:salt /var/log/salt/api if command -v systemctl; then systemctl enable salt-api; fi ;; esac diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index a92551161da..8eb74eae0ed 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -1,6 +1,12 @@ +. /usr/share/debconf/confmodule + case "$1" in configure) - PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;") - chown -R salt:salt /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy + db_get salt-master/user + if [ "$RET" != "root" ]; then + PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;") + # TBD DGM what is this salt:salt doing here, should this be $RET:$RET + chown -R salt:salt /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy + fi ;; esac diff --git a/pkg/debian/salt-master.config b/pkg/debian/salt-master.config new file mode 100644 index 00000000000..d18163d0237 --- /dev/null +++ b/pkg/debian/salt-master.config @@ -0,0 +1,7 @@ +#!/bin/sh -e + +# Source debconf library. +. /usr/share/debconf/confmodule + +db_input medium salt-master/user || true +db_go || true diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index 4f7686d8ed9..e068d334e39 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -1,14 +1,19 @@ +. /usr/share/debconf/confmodule + case "$1" in configure) - if [ ! -e "/var/log/salt/master" ]; then - touch /var/log/salt/master - chmod 640 /var/log/salt/master + db_get salt-master/user + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/master" ]; then + touch /var/log/salt/master + chmod 640 /var/log/salt/master + fi + if [ ! -e "/var/log/salt/key" ]; then + touch /var/log/salt/key + chmod 640 /var/log/salt/key + fi + chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master fi - if [ ! -e "/var/log/salt/key" ]; then - touch /var/log/salt/key - chmod 640 /var/log/salt/key - fi - chown -R salt:salt /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master if command -v systemctl; then systemctl enable salt-master; fi ;; esac diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index f205423079c..fcf3fde21c4 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -7,10 +7,14 @@ case "$1" in PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") # Reset permissions to fix previous installs + # TBD DGM Need to check this code for root:root, doesn't seem correct, needs to be whatever the user is find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \ \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ \( -user ${SALT_USER} -o -group ${SALT_GROUP} \) -exec chown root:root \{\} \; + ;; + esac + # remove incorrectly installed ufw salt-master directory - issue 57712 test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true diff --git a/pkg/debian/salt-master.templates b/pkg/debian/salt-master.templates new file mode 100644 index 00000000000..70a1141e33b --- /dev/null +++ b/pkg/debian/salt-master.templates @@ -0,0 +1,5 @@ +Template: salt-master/user +Type: string +Default: salt +Description: User for salt-master + User to run the salt-master process as diff --git a/pkg/rpm/salt.spec b/pkg/rpm/salt.spec index c7340e6a5a7..f64884c9d58 100644 --- a/pkg/rpm/salt.spec +++ b/pkg/rpm/salt.spec @@ -15,10 +15,12 @@ %global __requires_exclude_from ^.*$ %define _source_payload w2.gzdio %define _binary_payload w2.gzdio -%define _SALT_GROUP salt -%define _SALT_USER salt -%define _SALT_NAME Salt -%define _SALT_HOME /opt/saltstack/salt +%global _SALT_GROUP salt +%global _SALT_USER salt +%global _SALT_NAME Salt +%global _SALT_HOME /opt/saltstack/salt +%global _CUR_USER %{_SALT_USER} +%global _CUR_GROUP %{_SALT_GROUP} # Disable debugsource template %define _debugsource_template %{nil} @@ -426,22 +428,37 @@ usermod -c "%{_SALT_NAME}" \ %pre master if [ $1 -gt 1 ] ; then - # Reset permissions to match previous installs - PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") - _CUR_USER=$(command -v salt-master | xargs ls -l | cut -d ' ' -f 3) - _CUR_GROUP=$(command -v salt-master | xargs ls -l | cut -d ' ' -f 4) - find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ - \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ - \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; + # Reset permissions to match previous installs - performing upgrade +# PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") +# _CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) +# _CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) +# # TBD DGM this find command will overwrite any ownership if a minion - user is preinstalled first +# find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ +# \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o \ +# -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ +# \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; + _LCUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) + _LCUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) + %global _CUR_USER %{_LCUR_USER} + %global _CUR_GROUP %{_LCUR_GROUP} fi %pre minion if [ $1 -gt 1 ] ; then - # Reset permissions to match previous installs - _CUR_USER=$(command -v salt-minion | xargs ls -l | cut -d ' ' -f 3) - _CUR_GROUP=$(command -v salt-minion | xargs ls -l | cut -d ' ' -f 4) - find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ - \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; + # Reset permissions to match previous installs - performing upgrade +# _CUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) +# _CUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) +# if [ ! -e "/var/log/salt/master" ]; then +# find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ +# \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; +# else +# # master exists, it takes precedence +# find /etc/salt/minion /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion \ +# \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; + _LCUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) + _LCUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) + %global _CUR_USER %{_LCUR_USER} + %global _CUR_GROUP %{_LCUR_GROUP} fi @@ -571,7 +588,14 @@ if [ ! -e "/var/log/salt/cloud" ]; then touch /var/log/salt/cloud chmod 640 /var/log/salt/cloud fi -chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/cloud.deploy.d /var/log/salt/cloud /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy +if [ $1 -gt 1 ] ; then + # Reset permissions to match previous installs - performing upgrade +# _CUR_USER=$(ls -dl /var/log/salt/cloud | cut -d ' ' -f 3) +# _CUR_GROUP=$(ls -dl /var/log/salt/cloud | cut -d ' ' -f 4) + chown -R %{_CUR_USER}:%{_CUR_GROUP} /etc/salt/cloud.deploy.d /var/log/salt/cloud /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy +else + chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/cloud.deploy.d /var/log/salt/cloud /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy +fi %posttrans master @@ -583,7 +607,14 @@ if [ ! -e "/var/log/salt/key" ]; then touch /var/log/salt/key chmod 640 /var/log/salt/key fi -chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master +if [ $1 -gt 1 ] ; then + # Reset permissions to match previous installs - performing upgrade +# _CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) +# _CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) + chown -R %{_CUR_USER}:%{_CUR_GROUP} /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master +else + chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master +fi %posttrans api @@ -591,7 +622,14 @@ if [ ! -e "/var/log/salt/api" ]; then touch /var/log/salt/api chmod 640 /var/log/salt/api fi -chown %{_SALT_USER}:%{_SALT_GROUP} /var/log/salt/api +if [ $1 -gt 1 ] ; then + # Reset permissions to match previous installs - performing upgrade +# _CUR_USER=$(ls -dl /var/log/salt/api | cut -d ' ' -f 3) +# _CUR_GROUP=$(ls -dl /var/log/salt/api | cut -d ' ' -f 4) + chown -R %{_CUR_USER}:%{_CUR_GROUP} /var/log/salt/api +else + chown -R %{_SALT_USER}:%{_SALT_GROUP} /var/log/salt/api +fi %preun @@ -748,6 +786,7 @@ fi # Fixed +- Fix issue with ownership on upgrade of master and minion files - Fix an issue with mac_shadow that was causing a command execution error when retrieving values that were not yet set. For example, retrieving last login before the user had logged in. [#34658](https://github.com/saltstack/salt/issues/34658) From 306e3ded4f2ccc8731934768f77be883c715f39a Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Mon, 29 Apr 2024 16:16:54 -0600 Subject: [PATCH 010/157] WIP - Testing salt-master maintain ownership fixes --- pkg/debian/salt-master.config | 14 ++++++------ pkg/debian/salt-master.preinst | 40 ++++++++++++++++++++++++++++++---- pkg/rpm/salt.spec | 18 +++++++++++++++ 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/pkg/debian/salt-master.config b/pkg/debian/salt-master.config index d18163d0237..c34e8b8e27c 100644 --- a/pkg/debian/salt-master.config +++ b/pkg/debian/salt-master.config @@ -1,7 +1,7 @@ -#!/bin/sh -e - -# Source debconf library. -. /usr/share/debconf/confmodule - -db_input medium salt-master/user || true -db_go || true +## TBD DGM #!/bin/sh -e +## TBD DGM +## TBD DGM # Source debconf library. +## TBD DGM . /usr/share/debconf/confmodule +## TBD DGM +## TBD DGM db_input medium salt-master/user || true +## TBD DGM db_go || true diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index fcf3fde21c4..85f18b47952 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -1,5 +1,11 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership + case "$1" in - install|upgrade) + install) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt [ -z "$SALT_USER" ] && SALT_USER=salt [ -z "$SALT_NAME" ] && SALT_NAME="Salt" @@ -7,10 +13,36 @@ case "$1" in PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") # Reset permissions to fix previous installs - # TBD DGM Need to check this code for root:root, doesn't seem correct, needs to be whatever the user is find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \ - \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ - \( -user ${SALT_USER} -o -group ${SALT_GROUP} \) -exec chown root:root \{\} \; + \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path \ + /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \( -user ${SALT_USER} \ + -o -group ${SALT_GROUP} \) -exec chown ${SALT_USER}:${SALT_GROUP} \{\} \; + + ;; + esac + + # remove incorrectly installed ufw salt-master directory - issue 57712 + test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true + + ;; + + upgrade) + [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt + [ -z "$SALT_USER" ] && SALT_USER=salt + [ -z "$SALT_NAME" ] && SALT_NAME="Salt" + [ -z "$SALT_GROUP" ] && SALT_GROUP=salt + PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") + + # Reset permissions to fix previous installs +## find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \ +## \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ +## \( -user ${SALT_USER} -o -group ${SALT_GROUP} \) -exec chown root:root \{\} \; + CUR_USER = $(ls -dl /run/salt/master | cur -d ' ' -f 3) + CUR_GROUP = $(ls -dl /run/salt/master | cur -d ' ' -f 4) + db_set salt-master/user $CUR_USER + chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ + /var/log/salt/key /var/cache/salt/master /var/run/salt/master + fi ;; esac diff --git a/pkg/rpm/salt.spec b/pkg/rpm/salt.spec index f64884c9d58..6c3a4a5e097 100644 --- a/pkg/rpm/salt.spec +++ b/pkg/rpm/salt.spec @@ -631,6 +631,24 @@ else chown -R %{_SALT_USER}:%{_SALT_GROUP} /var/log/salt/api fi +%posttrans minion +if [ ! -e "/var/log/salt/minion" ]; then + touch /var/log/salt/minion + chmod 640 /var/log/salt/minion +fi +if [ ! -e "/var/log/salt/key" ]; then + touch /var/log/salt/key + chmod 640 /var/log/salt/key +fi +if [ $1 -gt 1 ] ; then + # Reset permissions to match previous installs - performing upgrade +# _CUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) +# _CUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) + chown -R %{_CUR_USER}:%{_CUR_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion +else + chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion +fi + %preun if [ $1 -eq 0 ]; then From d3e0bf34374ae689b0124b2cea35aecbf0949163 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Tue, 30 Apr 2024 12:07:07 -0600 Subject: [PATCH 011/157] Fixed issues in pre and post install for salt-master --- pkg/debian/salt-master.postinst | 6 +++++- pkg/debian/salt-master.preinst | 22 +++++----------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index e068d334e39..472f591e8bc 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -1,3 +1,5 @@ +#!/bin/sh -x + . /usr/share/debconf/confmodule case "$1" in @@ -14,6 +16,8 @@ case "$1" in fi chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master fi - if command -v systemctl; then systemctl enable salt-master; fi + if command -v systemctl; then + systemctl enable salt-master + fi ;; esac diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index 85f18b47952..7b217bc8500 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh -x . /usr/share/debconf/confmodule @@ -17,14 +17,7 @@ case "$1" in \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path \ /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \( -user ${SALT_USER} \ -o -group ${SALT_GROUP} \) -exec chown ${SALT_USER}:${SALT_GROUP} \{\} \; - ;; - esac - - # remove incorrectly installed ufw salt-master directory - issue 57712 - test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true - - ;; upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt @@ -40,15 +33,10 @@ case "$1" in CUR_USER = $(ls -dl /run/salt/master | cur -d ' ' -f 3) CUR_GROUP = $(ls -dl /run/salt/master | cur -d ' ' -f 4) db_set salt-master/user $CUR_USER - chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ + chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master - fi - ;; - esac - - # remove incorrectly installed ufw salt-master directory - issue 57712 - test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true - - ;; esac + +# remove incorrectly installed ufw salt-master directory - issue 57712 +test -d /etc/ufw/applications.d/salt-master && rm -rf /etc/ufw/applications.d/salt-master || /bin/true From 949e30cc74db83b9188ef6b7fa36a1495c6edb31 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Tue, 30 Apr 2024 14:32:00 -0600 Subject: [PATCH 012/157] Fixed typo --- pkg/debian/salt-master.preinst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index 7b217bc8500..f7998dbb22d 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -30,8 +30,8 @@ case "$1" in ## find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \ ## \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ ## \( -user ${SALT_USER} -o -group ${SALT_GROUP} \) -exec chown root:root \{\} \; - CUR_USER = $(ls -dl /run/salt/master | cur -d ' ' -f 3) - CUR_GROUP = $(ls -dl /run/salt/master | cur -d ' ' -f 4) + CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) + CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) db_set salt-master/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master From 5ec86050ca5a7f1165c6bd77a5d983baa1249220 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Wed, 1 May 2024 13:27:27 -0600 Subject: [PATCH 013/157] Updated Debian and RPM to allow for correct ownership and systemd status --- pkg/debian/salt-api.postinst | 15 +++++++-- pkg/debian/salt-api.preinst | 30 +++++++++++++++++ pkg/debian/salt-cloud.postinst | 3 +- pkg/debian/salt-master.config | 7 ---- pkg/debian/salt-master.postinst | 11 +++++- pkg/debian/salt-master.preinst | 14 ++++++-- pkg/debian/salt-minion.postinst | 32 ++++++++++++++++++ pkg/debian/salt-minion.preinst | 32 ++++++++++++++++++ pkg/rpm/salt.spec | 59 +++++++++++---------------------- 9 files changed, 149 insertions(+), 54 deletions(-) create mode 100644 pkg/debian/salt-api.preinst delete mode 100644 pkg/debian/salt-master.config create mode 100644 pkg/debian/salt-minion.postinst create mode 100644 pkg/debian/salt-minion.preinst diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 0624c297c85..b784870624d 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -2,7 +2,7 @@ case "$1" in configure) - db_get salt-master/user + db_get salt-api/user if [ "$RET" != "root" ]; then if [ ! -e "/var/log/salt/api" ]; then touch /var/log/salt/api @@ -10,6 +10,17 @@ case "$1" in fi chown $RET:$RET /var/log/salt/api fi - if command -v systemctl; then systemctl enable salt-api; fi + if command -v systemctl; then + db_get salt-api/active + if [ "$RET" == "active" ]; then + systemctl restart salt-api + fi + db_get salt-api/enabled + if [ "$RET" == "enabled" ]; then + systemctl enable salt-api + else + systemctl disable salt-api + fi + fi ;; esac diff --git a/pkg/debian/salt-api.preinst b/pkg/debian/salt-api.preinst new file mode 100644 index 00000000000..5c8dd215326 --- /dev/null +++ b/pkg/debian/salt-api.preinst @@ -0,0 +1,30 @@ +#!/bin/sh -x + +. /usr/share/debconf/confmodule + +## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership + +case "$1" in + upgrade) + [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt + [ -z "$SALT_USER" ] && SALT_USER=salt + [ -z "$SALT_NAME" ] && SALT_NAME="Salt" + [ -z "$SALT_GROUP" ] && SALT_GROUP=salt + + # Reset permissions to fix previous installs + CUR_USER=$(ls -dl /run/salt-api.pid | cut -d ' ' -f 3) + CUR_GROUP=$(ls -dl /run/salt-api.pid | cut -d ' ' -f 4) + db_set salt-api/user $CUR_USER + chown -R $CUR_USER:$CUR_GROUP /var/log/salt/api + if command -v systemctl; then + SM_ENABLED=$(systemctl show salt-api | grep -w UnitFileState | cut -d '=' -f 2) + db_get salt-api/enabled $SM_ENABLED + SM_ACTIVE=$(systemctl is-active salt-api) + db_get salt-api/active $SM_ACTIVE + else + db_get salt-api/enabled enabled + db_get salt-api/active active + + fi + ;; +esac diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index 8eb74eae0ed..055528520cf 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -5,8 +5,7 @@ case "$1" in db_get salt-master/user if [ "$RET" != "root" ]; then PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush;") - # TBD DGM what is this salt:salt doing here, should this be $RET:$RET - chown -R salt:salt /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy + chown -R $RET:$RET /etc/salt/cloud.deploy.d /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy fi ;; esac diff --git a/pkg/debian/salt-master.config b/pkg/debian/salt-master.config deleted file mode 100644 index c34e8b8e27c..00000000000 --- a/pkg/debian/salt-master.config +++ /dev/null @@ -1,7 +0,0 @@ -## TBD DGM #!/bin/sh -e -## TBD DGM -## TBD DGM # Source debconf library. -## TBD DGM . /usr/share/debconf/confmodule -## TBD DGM -## TBD DGM db_input medium salt-master/user || true -## TBD DGM db_go || true diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index 472f591e8bc..7af9a42ea13 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -17,7 +17,16 @@ case "$1" in chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master fi if command -v systemctl; then - systemctl enable salt-master + db_get salt-master/active + if [ "$RET" == "active" ]; then + systemctl restart salt-master + fi + db_get salt-master/enabled + if [ "$RET" == "enabled" ]; then + systemctl enable salt-master + else + systemctl disable salt-master + fi fi ;; esac diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index f7998dbb22d..268fdab6b56 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -17,6 +17,7 @@ case "$1" in \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path \ /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \( -user ${SALT_USER} \ -o -group ${SALT_GROUP} \) -exec chown ${SALT_USER}:${SALT_GROUP} \{\} \; + ;; upgrade) @@ -27,14 +28,21 @@ case "$1" in PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") # Reset permissions to fix previous installs -## find ${SALT_HOME} /etc/salt /var/log/salt /var/cache/salt /var/run/salt \ -## \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ -## \( -user ${SALT_USER} -o -group ${SALT_GROUP} \) -exec chown root:root \{\} \; CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) db_set salt-master/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master + if command -v systemctl; then + SM_ENABLED=$(systemctl show salt-master | grep -w UnitFileState | cut -d '=' -f 2) + db_get salt-master/enabled $SM_ENABLED + SM_ACTIVE=$(systemctl is-active salt-master) + db_get salt-master/active $SM_ACTIVE + else + db_get salt-master/enabled enabled + db_get salt-master/active active + + fi ;; esac diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst new file mode 100644 index 00000000000..441d31b687a --- /dev/null +++ b/pkg/debian/salt-minion.postinst @@ -0,0 +1,32 @@ +#!/bin/sh -x + +. /usr/share/debconf/confmodule + +case "$1" in + configure) + db_get salt-minion/user + if [ "$RET" != "root" ]; then + if [ ! -e "/var/log/salt/minion" ]; then + touch /var/log/salt/minion + chmod 640 /var/log/salt/minion + fi + if [ ! -e "/var/log/salt/key" ]; then + touch /var/log/salt/key + chmod 640 /var/log/salt/key + fi + chown -R $RET:$RET /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion + fi + if command -v systemctl; then + db_get salt-minion/active + if [ "$RET" == "active" ]; then + systemctl restart salt-minion + fi + db_get salt-minion/enabled + if [ "$RET" == "enabled" ]; then + systemctl enable salt-minion + else + systemctl disable salt-minion + fi + fi + ;; +esac diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst new file mode 100644 index 00000000000..25bc26ac324 --- /dev/null +++ b/pkg/debian/salt-minion.preinst @@ -0,0 +1,32 @@ +#!/bin/sh -x + +. /usr/share/debconf/confmodule + +## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership + +case "$1" in + upgrade) + [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt + [ -z "$SALT_USER" ] && SALT_USER=salt + [ -z "$SALT_NAME" ] && SALT_NAME="Salt" + [ -z "$SALT_GROUP" ] && SALT_GROUP=salt + PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") + + # Reset permissions to fix previous installs + CUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) + CUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) + db_set salt-minion/user $CUR_USER + chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion \ + /var/cache/salt/minion /var/run/salt/minion + if command -v systemctl; then + SM_ENABLED=$(systemctl show salt-minion | grep -w UnitFileState | cut -d '=' -f 2) + db_get salt-minion/enabled $SM_ENABLED + SM_ACTIVE=$(systemctl is-active salt-minion) + db_get salt-minion/active $SM_ACTIVE + else + db_get salt-minion/enabled enabled + db_get salt-minion/active active + + fi + ;; +esac diff --git a/pkg/rpm/salt.spec b/pkg/rpm/salt.spec index 6c3a4a5e097..68872c76db2 100644 --- a/pkg/rpm/salt.spec +++ b/pkg/rpm/salt.spec @@ -19,8 +19,14 @@ %global _SALT_USER salt %global _SALT_NAME Salt %global _SALT_HOME /opt/saltstack/salt -%global _CUR_USER %{_SALT_USER} -%global _CUR_GROUP %{_SALT_GROUP} + +# salt-master current user and group +%global _MS_CUR_USER %{_SALT_USER} +%global _MS_CUR_GROUP %{_SALT_GROUP} + +# salt-minion current user and group +%global _MN_CUR_USER %{_SALT_USER} +%global _MN_CUR_GROUP %{_SALT_GROUP} # Disable debugsource template %define _debugsource_template %{nil} @@ -429,36 +435,19 @@ usermod -c "%{_SALT_NAME}" \ %pre master if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade -# PY_VER=$(/opt/saltstack/salt/bin/python3 -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info)); sys.stdout.flush();") -# _CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) -# _CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) -# # TBD DGM this find command will overwrite any ownership if a minion - user is preinstalled first -# find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ -# \! \( -path /etc/salt/cloud.deploy.d\* -o -path /var/log/salt/cloud -o \ -# -path /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy\* \) -a \ -# \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; - _LCUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) - _LCUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) - %global _CUR_USER %{_LCUR_USER} - %global _CUR_GROUP %{_LCUR_GROUP} + _MS_LCUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) + _MS_LCUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) + %global _MS_CUR_USER %{_MS_LCUR_USER} + %global _MS_CUR_GROUP %{_MS_LCUR_GROUP} fi %pre minion if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade -# _CUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) -# _CUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) -# if [ ! -e "/var/log/salt/master" ]; then -# find /etc/salt /opt/saltstack/salt /var/log/salt /var/cache/salt /var/run/salt \ -# \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; -# else -# # master exists, it takes precedence -# find /etc/salt/minion /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion \ -# \( -user salt -o -group salt \) -exec chown -R ${_CUR_USER}:${_CUR_GROUP} \{\} \; - _LCUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) - _LCUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) - %global _CUR_USER %{_LCUR_USER} - %global _CUR_GROUP %{_LCUR_GROUP} + _MN_LCUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) + _MN_LCUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) + %global _MN_CUR_USER %{_MN_LCUR_USER} + %global _MN_CUR_GROUP %{_MN_LCUR_GROUP} fi @@ -590,9 +579,7 @@ if [ ! -e "/var/log/salt/cloud" ]; then fi if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade -# _CUR_USER=$(ls -dl /var/log/salt/cloud | cut -d ' ' -f 3) -# _CUR_GROUP=$(ls -dl /var/log/salt/cloud | cut -d ' ' -f 4) - chown -R %{_CUR_USER}:%{_CUR_GROUP} /etc/salt/cloud.deploy.d /var/log/salt/cloud /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy + chown -R %{_MS_CUR_USER}:%{_MS_CUR_GROUP} /etc/salt/cloud.deploy.d /var/log/salt/cloud /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy else chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/cloud.deploy.d /var/log/salt/cloud /opt/saltstack/salt/lib/python${PY_VER}/site-packages/salt/cloud/deploy fi @@ -609,9 +596,7 @@ if [ ! -e "/var/log/salt/key" ]; then fi if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade -# _CUR_USER=$(ls -dl /run/salt/master | cut -d ' ' -f 3) -# _CUR_GROUP=$(ls -dl /run/salt/master | cut -d ' ' -f 4) - chown -R %{_CUR_USER}:%{_CUR_GROUP} /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master + chown -R %{_MS_CUR_USER}:%{_MS_CUR_GROUP} /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master else chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master fi @@ -624,9 +609,7 @@ if [ ! -e "/var/log/salt/api" ]; then fi if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade -# _CUR_USER=$(ls -dl /var/log/salt/api | cut -d ' ' -f 3) -# _CUR_GROUP=$(ls -dl /var/log/salt/api | cut -d ' ' -f 4) - chown -R %{_CUR_USER}:%{_CUR_GROUP} /var/log/salt/api + chown -R %{_MS_CUR_USER}:%{_MS_CUR_GROUP} /var/log/salt/api else chown -R %{_SALT_USER}:%{_SALT_GROUP} /var/log/salt/api fi @@ -642,9 +625,7 @@ if [ ! -e "/var/log/salt/key" ]; then fi if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade -# _CUR_USER=$(ls -dl /run/salt/minion | cut -d ' ' -f 3) -# _CUR_GROUP=$(ls -dl /run/salt/minion | cut -d ' ' -f 4) - chown -R %{_CUR_USER}:%{_CUR_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion + chown -R %{_MN_CUR_USER}:%{_MN_CUR_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion else chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion fi From f9bd4ad1b6de86a8bfa4236f496c2088acaeab95 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 2 May 2024 15:39:03 -0600 Subject: [PATCH 014/157] Updated preinst and initial downgrade and upgrade salt-master tests --- pkg/debian/salt-api.preinst | 2 +- pkg/debian/salt-master.preinst | 2 +- pkg/debian/salt-minion.preinst | 2 +- .../pkg/downgrade/test_salt_downgrade.py | 67 ++++++++++++++++++- .../pytests/pkg/upgrade/test_salt_upgrade.py | 61 ++++++++++++++++- 5 files changed, 127 insertions(+), 7 deletions(-) diff --git a/pkg/debian/salt-api.preinst b/pkg/debian/salt-api.preinst index 5c8dd215326..ddd28b1b533 100644 --- a/pkg/debian/salt-api.preinst +++ b/pkg/debian/salt-api.preinst @@ -17,7 +17,7 @@ case "$1" in db_set salt-api/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /var/log/salt/api if command -v systemctl; then - SM_ENABLED=$(systemctl show salt-api | grep -w UnitFileState | cut -d '=' -f 2) + SM_ENABLED=$(systemctl show -p UnitFileState salt-api | cut -d '=' -f 2) db_get salt-api/enabled $SM_ENABLED SM_ACTIVE=$(systemctl is-active salt-api) db_get salt-api/active $SM_ACTIVE diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index 268fdab6b56..fc9542dfbdb 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -34,7 +34,7 @@ case "$1" in chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master if command -v systemctl; then - SM_ENABLED=$(systemctl show salt-master | grep -w UnitFileState | cut -d '=' -f 2) + SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) db_get salt-master/enabled $SM_ENABLED SM_ACTIVE=$(systemctl is-active salt-master) db_get salt-master/active $SM_ACTIVE diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index 25bc26ac324..8eca2c59db4 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -19,7 +19,7 @@ case "$1" in chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion \ /var/cache/salt/minion /var/run/salt/minion if command -v systemctl; then - SM_ENABLED=$(systemctl show salt-minion | grep -w UnitFileState | cut -d '=' -f 2) + SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) db_get salt-minion/enabled $SM_ENABLED SM_ACTIVE=$(systemctl is-active salt-minion) db_get salt-minion/active $SM_ACTIVE diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index adba7c51272..46800952c85 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -3,9 +3,9 @@ import psutil from pytestskipmarkers.utils import platform -def test_salt_downgrade(salt_call_cli, install_salt): +def test_salt_downgrade_minion(salt_call_cli, install_salt): """ - Test an upgrade of Salt. + Test an downgrade of Salt Minion. """ is_downgrade_to_relenv = packaging.version.parse( install_salt.prev_version @@ -87,3 +87,66 @@ def test_salt_downgrade(salt_call_cli, install_salt): # test pip install after a downgrade use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_downgrade_master(salt_cli, install_salt): + """ + Test an downgrade of Salt Master. + """ + if not install_salt.downgrade: + pytest.skip("Not testing a downgrade, do not run") + + is_downgrade_to_relenv = packaging.version.parse( + install_salt.prev_version + ) >= packaging.version.parse("3006.0") + + if is_downgrade_to_relenv: + original_py_version = install_salt.package_python_version() + + # Verify current install version is setup correctly and works + ret = salt_cli.run("--version") + assert ret.returncode == 0 + assert packaging.version.parse(ret.data) == packaging.version.parse( + install_salt.artifact_version + ) + + # Verify there is a running master by getting its PID + salt_name = "salt" + process_name = "salt-master" + + old_pid = [] + + # psutil process name only returning first part of the command '/opt/saltstack/' + # need to check all of command line for salt-minion + # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] + # and psutil is only returning the salt-minion once + for proc in psutil.process_iter(): + if salt_name in proc.name(): + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + old_pid.append(proc.pid) + + assert old_pid + + # Downgrade Salt to the previous version and test + install_salt.install(downgrade=True) + bin_file = "salt" + + # Verify there is a new running master by getting its PID and comparing it + # with the PID from before the upgrade + new_pid = [] + for proc in psutil.process_iter(): + if salt_name in proc.name(): + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + new_pid.append(proc.pid) + + assert new_pid + assert new_pid != old_pid + + ret = install_salt.proc.run(bin_file, "--version") + assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) < packaging.version.parse(install_salt.artifact_version) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index fd883705c4a..b3aa8e8d6f1 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -21,9 +21,9 @@ def _get_running_salt_minion_pid(process_name): return pids -def test_salt_upgrade(salt_call_cli, install_salt): +def test_salt_upgrade_minion(salt_call_cli, install_salt): """ - Test an upgrade of Salt. + Test an upgrade of Salt Minion. """ if install_salt.relenv: original_py_version = install_salt.package_python_version() @@ -84,3 +84,60 @@ def test_salt_upgrade(salt_call_cli, install_salt): # test pip install after an upgrade use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_upgrade_master(salt_cli, install_salt): + """ + Test an upgrade of Salt Master. + """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + + if install_salt.relenv: + original_py_version = install_salt.package_python_version() + + # Verify previous install version is setup correctly and works + ret = salt_cli.run("--version") + assert ret.returncode == 0 + assert packaging.version.parse(ret.data) < packaging.version.parse( + install_salt.artifact_version + ) + + # Verify there is a running minion by getting its PID + salt_name = "salt" + process_name = "salt-master" + + old_pid = [] + + # psutil process name only returning first part of the command '/opt/saltstack/' + # need to check all of command line for salt-master + # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] + # and psutil is only returning the salt-minion once + for proc in psutil.process_iter(): + if salt_name in proc.name(): + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + old_pid.append(proc.pid) + + assert old_pid + + # Upgrade Salt from previous version and test + install_salt.install(upgrade=True) + ret = salt_cli.run("--version") + assert ret.returncode == 0 + assert packaging.version.parse(ret.data) == packaging.version.parse( + install_salt.artifact_version + ) + + # Verify there is a new running master by getting its PID and comparing it + # with the PID from before the upgrade + new_pid = [] + for proc in psutil.process_iter(): + if salt_name in proc.name(): + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + new_pid.append(proc.pid) + + assert new_pid + assert new_pid != old_pid From 72e414becc990ee04326a406b54935bbef3753e8 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 2 May 2024 16:57:35 -0600 Subject: [PATCH 015/157] Updated pkg upgrade and downgrade tests --- .../pkg/downgrade/test_salt_downgrade.py | 12 ++++++------ .../pytests/pkg/upgrade/test_salt_upgrade.py | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 46800952c85..98bf39b4256 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -90,7 +90,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -def test_salt_downgrade_master(salt_cli, install_salt): +def test_salt_downgrade_master(install_salt): """ Test an downgrade of Salt Master. """ @@ -105,11 +105,12 @@ def test_salt_downgrade_master(salt_cli, install_salt): original_py_version = install_salt.package_python_version() # Verify current install version is setup correctly and works - ret = salt_cli.run("--version") + bin_file = "salt" + ret = install_salt.proc.run(bin_file, "--version") assert ret.returncode == 0 - assert packaging.version.parse(ret.data) == packaging.version.parse( - install_salt.artifact_version - ) + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) == packaging.version.parse(install_salt.artifact_version) # Verify there is a running master by getting its PID salt_name = "salt" @@ -131,7 +132,6 @@ def test_salt_downgrade_master(salt_cli, install_salt): # Downgrade Salt to the previous version and test install_salt.install(downgrade=True) - bin_file = "salt" # Verify there is a new running master by getting its PID and comparing it # with the PID from before the upgrade diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index b3aa8e8d6f1..98f3c4b4f30 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -87,7 +87,7 @@ def test_salt_upgrade_minion(salt_call_cli, install_salt): @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -def test_salt_upgrade_master(salt_cli, install_salt): +def test_salt_upgrade_master(install_salt): """ Test an upgrade of Salt Master. """ @@ -98,11 +98,12 @@ def test_salt_upgrade_master(salt_cli, install_salt): original_py_version = install_salt.package_python_version() # Verify previous install version is setup correctly and works - ret = salt_cli.run("--version") + bin_file = "salt" + ret = install_salt.proc.run(bin_file, "--version") assert ret.returncode == 0 - assert packaging.version.parse(ret.data) < packaging.version.parse( - install_salt.artifact_version - ) + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) == packaging.version.parse(install_salt.artifact_version) # Verify there is a running minion by getting its PID salt_name = "salt" @@ -124,11 +125,11 @@ def test_salt_upgrade_master(salt_cli, install_salt): # Upgrade Salt from previous version and test install_salt.install(upgrade=True) - ret = salt_cli.run("--version") + ret = install_salt.proc.run(bin_file, "--version") assert ret.returncode == 0 - assert packaging.version.parse(ret.data) == packaging.version.parse( - install_salt.artifact_version - ) + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) == packaging.version.parse(install_salt.artifact_version) # Verify there is a new running master by getting its PID and comparing it # with the PID from before the upgrade From 6319f9c981606e364ab8b58377b00fffe6c7750e Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 3 May 2024 13:10:00 -0600 Subject: [PATCH 016/157] Adjusting install, upgrade scripts --- pkg/debian/salt-api.postinst | 20 ++++++++++++-------- pkg/debian/salt-api.preinst | 10 ++++++---- pkg/debian/salt-api.templates | 5 +++++ pkg/debian/salt-cloud.postinst | 2 ++ pkg/debian/salt-master.postinst | 20 ++++++++++++-------- pkg/debian/salt-master.preinst | 11 +++++++---- pkg/debian/salt-minion.postinst | 20 ++++++++++++-------- pkg/debian/salt-minion.preinst | 10 ++++++---- pkg/debian/salt-minion.templates | 5 +++++ pkg/rpm/salt.spec | 2 -- 10 files changed, 67 insertions(+), 38 deletions(-) create mode 100644 pkg/debian/salt-api.templates create mode 100644 pkg/debian/salt-minion.templates diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index b784870624d..b9c3b7cffaa 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -1,5 +1,7 @@ . /usr/share/debconf/confmodule +echo "DGM salt-api.postinst dollar $@" + case "$1" in configure) db_get salt-api/user @@ -12,14 +14,16 @@ case "$1" in fi if command -v systemctl; then db_get salt-api/active - if [ "$RET" == "active" ]; then - systemctl restart salt-api - fi - db_get salt-api/enabled - if [ "$RET" == "enabled" ]; then - systemctl enable salt-api - else - systemctl disable salt-api + if [ "$RET" != 10 ]; then + if [ "$RET" == "active" ]; then + systemctl restart salt-api + fi + db_get salt-api/enabled + if [ "$RET" == "enabled" ]; then + systemctl enable salt-api + else + systemctl disable salt-api + fi fi fi ;; diff --git a/pkg/debian/salt-api.preinst b/pkg/debian/salt-api.preinst index ddd28b1b533..70a7002b73b 100644 --- a/pkg/debian/salt-api.preinst +++ b/pkg/debian/salt-api.preinst @@ -4,6 +4,8 @@ ## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership +echo "DGM salt-api.preinst dollar $@" + case "$1" in upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt @@ -18,12 +20,12 @@ case "$1" in chown -R $CUR_USER:$CUR_GROUP /var/log/salt/api if command -v systemctl; then SM_ENABLED=$(systemctl show -p UnitFileState salt-api | cut -d '=' -f 2) - db_get salt-api/enabled $SM_ENABLED + db_set salt-api/enabled $SM_ENABLED SM_ACTIVE=$(systemctl is-active salt-api) - db_get salt-api/active $SM_ACTIVE + db_set salt-api/active $SM_ACTIVE else - db_get salt-api/enabled enabled - db_get salt-api/active active + db_set salt-api/enabled enabled + db_set salt-api/active active fi ;; diff --git a/pkg/debian/salt-api.templates b/pkg/debian/salt-api.templates new file mode 100644 index 00000000000..e24e496b719 --- /dev/null +++ b/pkg/debian/salt-api.templates @@ -0,0 +1,5 @@ +Template: salt-api/user +Type: string +Default: salt +Description: User for salt-api + User to run the salt-api process as diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index 055528520cf..e760e573bd1 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -1,5 +1,7 @@ . /usr/share/debconf/confmodule +echo "DGM salt-cloud.postinst dollar $@" + case "$1" in configure) db_get salt-master/user diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index 7af9a42ea13..a5c211d2070 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -2,6 +2,8 @@ . /usr/share/debconf/confmodule +echo "DGM salt-master.postinst dollar $@" + case "$1" in configure) db_get salt-master/user @@ -18,14 +20,16 @@ case "$1" in fi if command -v systemctl; then db_get salt-master/active - if [ "$RET" == "active" ]; then - systemctl restart salt-master - fi - db_get salt-master/enabled - if [ "$RET" == "enabled" ]; then - systemctl enable salt-master - else - systemctl disable salt-master + if [ "$RET" != 10 ]; then + if [ "$RET" == "active" ]; then + systemctl restart salt-master + fi + db_get salt-master/enabled + if [ "$RET" == "enabled" ]; then + systemctl enable salt-master + else + systemctl disable salt-master + fi fi fi ;; diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index fc9542dfbdb..d49664588de 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -4,6 +4,9 @@ ## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership +echo "DGM salt-master.preinst dollar $@" + + case "$1" in install) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt @@ -35,12 +38,12 @@ case "$1" in /var/log/salt/key /var/cache/salt/master /var/run/salt/master if command -v systemctl; then SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) - db_get salt-master/enabled $SM_ENABLED + db_set salt-master/enabled $SM_ENABLED SM_ACTIVE=$(systemctl is-active salt-master) - db_get salt-master/active $SM_ACTIVE + db_set salt-master/active $SM_ACTIVE else - db_get salt-master/enabled enabled - db_get salt-master/active active + db_set salt-master/enabled enabled + db_set salt-master/active active fi ;; diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 441d31b687a..3760d2e83ef 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -2,6 +2,8 @@ . /usr/share/debconf/confmodule +echo "DGM salt-minion.postinst dollar $@" + case "$1" in configure) db_get salt-minion/user @@ -18,14 +20,16 @@ case "$1" in fi if command -v systemctl; then db_get salt-minion/active - if [ "$RET" == "active" ]; then - systemctl restart salt-minion - fi - db_get salt-minion/enabled - if [ "$RET" == "enabled" ]; then - systemctl enable salt-minion - else - systemctl disable salt-minion + if [ "$RET" != 10 ]; then + if [ "$RET" == "active" ]; then + systemctl restart salt-minion + fi + db_get salt-minion/enabled + if [ "$RET" == "enabled" ]; then + systemctl enable salt-minion + else + systemctl disable salt-minion + fi fi fi ;; diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index 8eca2c59db4..b6281b6a56b 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -4,6 +4,8 @@ ## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership +echo "DGM salt-minion.preinst dollar $@" + case "$1" in upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt @@ -20,12 +22,12 @@ case "$1" in /var/cache/salt/minion /var/run/salt/minion if command -v systemctl; then SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) - db_get salt-minion/enabled $SM_ENABLED + db_set salt-minion/enabled $SM_ENABLED SM_ACTIVE=$(systemctl is-active salt-minion) - db_get salt-minion/active $SM_ACTIVE + db_set salt-minion/active $SM_ACTIVE else - db_get salt-minion/enabled enabled - db_get salt-minion/active active + db_set salt-minion/enabled enabled + db_set salt-minion/active active fi ;; diff --git a/pkg/debian/salt-minion.templates b/pkg/debian/salt-minion.templates new file mode 100644 index 00000000000..d08bb06da1d --- /dev/null +++ b/pkg/debian/salt-minion.templates @@ -0,0 +1,5 @@ +Template: salt-minion/user +Type: string +Default: root +Description: User for salt-minion + User to run the salt-minion process as diff --git a/pkg/rpm/salt.spec b/pkg/rpm/salt.spec index 68872c76db2..9a08cd93051 100644 --- a/pkg/rpm/salt.spec +++ b/pkg/rpm/salt.spec @@ -626,8 +626,6 @@ fi if [ $1 -gt 1 ] ; then # Reset permissions to match previous installs - performing upgrade chown -R %{_MN_CUR_USER}:%{_MN_CUR_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion -else - chown -R %{_SALT_USER}:%{_SALT_GROUP} /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion fi From 0b2eb2db8fdc91b95f3dcf39f60faad36f189082 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 3 May 2024 16:19:28 -0600 Subject: [PATCH 017/157] Install fixes --- pkg/debian/salt-api.postinst | 11 ++++++----- pkg/debian/salt-master.postinst | 11 ++++++----- pkg/debian/salt-minion.postinst | 11 ++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index b9c3b7cffaa..52eef2a2dab 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -14,15 +14,16 @@ case "$1" in fi if command -v systemctl; then db_get salt-api/active - if [ "$RET" != 10 ]; then - if [ "$RET" == "active" ]; then + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" != 10 ]; then + if [ "$RESLT" == "active" ]; then systemctl restart salt-api fi db_get salt-api/enabled - if [ "$RET" == "enabled" ]; then - systemctl enable salt-api - else + if [ "$RESLT" == "disabled" ]; then systemctl disable salt-api + else + systemctl enable salt-api fi fi fi diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index a5c211d2070..dbc855d25c6 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -20,15 +20,16 @@ case "$1" in fi if command -v systemctl; then db_get salt-master/active - if [ "$RET" != 10 ]; then - if [ "$RET" == "active" ]; then + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" != 10 ]; then + if [ "$RESLT" == "active" ]; then systemctl restart salt-master fi db_get salt-master/enabled - if [ "$RET" == "enabled" ]; then - systemctl enable salt-master + if [ "$RESLT" == "disabled" ]; then + systemctl disable salt-api else - systemctl disable salt-master + systemctl enable salt-api fi fi fi diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 3760d2e83ef..119a210b7c3 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -20,15 +20,16 @@ case "$1" in fi if command -v systemctl; then db_get salt-minion/active - if [ "$RET" != 10 ]; then - if [ "$RET" == "active" ]; then + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" != 10 ]; then + if [ "$RESLT" == "active" ]; then systemctl restart salt-minion fi db_get salt-minion/enabled - if [ "$RET" == "enabled" ]; then - systemctl enable salt-minion + if [ "$RESLT" == "disabled" ]; then + systemctl disable salt-api else - systemctl disable salt-minion + systemctl enable salt-api fi fi fi From 840e22c734d47b3f921e1a620716d048d0ebe5c0 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Mon, 6 May 2024 12:15:23 -0600 Subject: [PATCH 018/157] Further updates for Debian post install scripts --- pkg/debian/salt-api.postinst | 3 +++ pkg/debian/salt-master.postinst | 3 +++ pkg/debian/salt-minion.postinst | 3 +++ 3 files changed, 9 insertions(+) diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 52eef2a2dab..a9ba724d7ce 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -25,6 +25,9 @@ case "$1" in else systemctl enable salt-api fi + else + systemctl restart salt-api + systemctl enable salt-api fi fi ;; diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index dbc855d25c6..a098a0b7dc8 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -31,6 +31,9 @@ case "$1" in else systemctl enable salt-api fi + else + systemctl restart salt-master + systemctl enable salt-master fi fi ;; diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 119a210b7c3..36f89ca92bf 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -31,6 +31,9 @@ case "$1" in else systemctl enable salt-api fi + else + systemctl restart salt-minion + systemctl enable salt-minion fi fi ;; From 665451d3cf714bf3483c619c8d936b2a9681c57e Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Wed, 8 May 2024 14:01:52 -0600 Subject: [PATCH 019/157] Testing debconf with salt-minion --- pkg/debian/salt-minion.templates | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/debian/salt-minion.templates b/pkg/debian/salt-minion.templates index d08bb06da1d..583e027d5d7 100644 --- a/pkg/debian/salt-minion.templates +++ b/pkg/debian/salt-minion.templates @@ -3,3 +3,15 @@ Type: string Default: root Description: User for salt-minion User to run the salt-minion process as + +Template: salt-minion/enabled +Type: string +Default: enabled +Description: Systemd enable state for salt-minion + default enable state for salt-minion systemd state + +Template: salt-minion/active +Type: string +Default: active +Description: Systemd active state for salt-minion + default active state for salt-minion systemd state From 161e23f3e5f2dcdcd0b98b7721d939c45238e85f Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 9 May 2024 11:37:18 -0600 Subject: [PATCH 020/157] Testing some ideas --- pkg/debian/salt-minion.postinst | 36 ++++++++++++++++----------------- pkg/debian/salt-minion.preinst | 20 +++++++++--------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 36f89ca92bf..981ed65f200 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -18,23 +18,23 @@ case "$1" in fi chown -R $RET:$RET /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion fi - if command -v systemctl; then - db_get salt-minion/active - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" != 10 ]; then - if [ "$RESLT" == "active" ]; then - systemctl restart salt-minion - fi - db_get salt-minion/enabled - if [ "$RESLT" == "disabled" ]; then - systemctl disable salt-api - else - systemctl enable salt-api - fi - else - systemctl restart salt-minion - systemctl enable salt-minion - fi - fi +## if command -v systemctl; then +## db_get salt-minion/active +## RESLT=$(echo "$RET" | cut -d ' ' -f 1) +## if [ "$RESLT" != 10 ]; then +## if [ "$RESLT" == "active" ]; then +## systemctl restart salt-minion +## fi +## db_get salt-minion/enabled +## if [ "$RESLT" == "disabled" ]; then +## systemctl disable salt-api +## else +## systemctl enable salt-api +## fi +## else +## systemctl restart salt-minion +## systemctl enable salt-minion +## fi +## fi ;; esac diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index b6281b6a56b..45522a05065 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -20,15 +20,15 @@ case "$1" in db_set salt-minion/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion \ /var/cache/salt/minion /var/run/salt/minion - if command -v systemctl; then - SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) - db_set salt-minion/enabled $SM_ENABLED - SM_ACTIVE=$(systemctl is-active salt-minion) - db_set salt-minion/active $SM_ACTIVE - else - db_set salt-minion/enabled enabled - db_set salt-minion/active active - - fi +## if command -v systemctl; then +## SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) +## db_set salt-minion/enabled $SM_ENABLED +## SM_ACTIVE=$(systemctl is-active salt-minion) +## db_set salt-minion/active $SM_ACTIVE +## else +## db_set salt-minion/enabled enabled +## db_set salt-minion/active active +## +## fi ;; esac From ead4d3b90c970ff7f3c9ecc22ecb5b7042de4d99 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 9 May 2024 11:39:12 -0600 Subject: [PATCH 021/157] More idea testing --- pkg/debian/salt-master.postinst | 36 ++++++++++++++++----------------- pkg/debian/salt-master.preinst | 20 +++++++++--------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index a098a0b7dc8..c8c85278f11 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -18,23 +18,23 @@ case "$1" in fi chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master fi - if command -v systemctl; then - db_get salt-master/active - RESLT=$(echo "$RET" | cut -d ' ' -f 1) - if [ "$RESLT" != 10 ]; then - if [ "$RESLT" == "active" ]; then - systemctl restart salt-master - fi - db_get salt-master/enabled - if [ "$RESLT" == "disabled" ]; then - systemctl disable salt-api - else - systemctl enable salt-api - fi - else - systemctl restart salt-master - systemctl enable salt-master - fi - fi +## if command -v systemctl; then +## db_get salt-master/active +## RESLT=$(echo "$RET" | cut -d ' ' -f 1) +## if [ "$RESLT" != 10 ]; then +## if [ "$RESLT" == "active" ]; then +## systemctl restart salt-master +## fi +## db_get salt-master/enabled +## if [ "$RESLT" == "disabled" ]; then +## systemctl disable salt-api +## else +## systemctl enable salt-api +## fi +## else +## systemctl restart salt-master +## systemctl enable salt-master +## fi +## fi ;; esac diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index d49664588de..313b4518afa 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -36,16 +36,16 @@ case "$1" in db_set salt-master/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master - if command -v systemctl; then - SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) - db_set salt-master/enabled $SM_ENABLED - SM_ACTIVE=$(systemctl is-active salt-master) - db_set salt-master/active $SM_ACTIVE - else - db_set salt-master/enabled enabled - db_set salt-master/active active - - fi +## if command -v systemctl; then +## SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) +## db_set salt-master/enabled $SM_ENABLED +## SM_ACTIVE=$(systemctl is-active salt-master) +## db_set salt-master/active $SM_ACTIVE +## else +## db_set salt-master/enabled enabled +## db_set salt-master/active active +## +## fi ;; esac From 99f9f1827d7ec0da6776466395cbc23f895aa9e8 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 9 May 2024 11:56:12 -0600 Subject: [PATCH 022/157] Added pytest import to tests --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 1 + tests/pytests/pkg/upgrade/test_salt_upgrade.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 98bf39b4256..c48c1d4e7c7 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -1,5 +1,6 @@ import packaging.version import psutil +import pytest from pytestskipmarkers.utils import platform diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 98f3c4b4f30..5d4cd9f5411 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -2,6 +2,7 @@ import logging import packaging.version import psutil +import pytest from pytestskipmarkers.utils import platform log = logging.getLogger(__name__) From fc428ef22f245eaafe25ead355ba7cdf720b3427 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 9 May 2024 15:43:43 -0600 Subject: [PATCH 023/157] Updated templates for systemd api, master and minion --- pkg/debian/salt-api.templates | 12 +++++++++++ pkg/debian/salt-master.postinst | 36 ++++++++++++++++---------------- pkg/debian/salt-master.preinst | 20 +++++++++--------- pkg/debian/salt-master.templates | 12 +++++++++++ pkg/debian/salt-minion.postinst | 36 ++++++++++++++++---------------- pkg/debian/salt-minion.preinst | 20 +++++++++--------- 6 files changed, 80 insertions(+), 56 deletions(-) diff --git a/pkg/debian/salt-api.templates b/pkg/debian/salt-api.templates index e24e496b719..88e4b0823c7 100644 --- a/pkg/debian/salt-api.templates +++ b/pkg/debian/salt-api.templates @@ -3,3 +3,15 @@ Type: string Default: salt Description: User for salt-api User to run the salt-api process as + +Template: salt-api/enabled +Type: string +Default: enabled +Description: Systemd enable state for salt-api + default enable state for salt-api systemd state + +Template: salt-api/active +Type: string +Default: active +Description: Systemd active state for salt-api + default active state for salt-api systemd state diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index c8c85278f11..a96c0ce288c 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -18,23 +18,23 @@ case "$1" in fi chown -R $RET:$RET /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master /var/log/salt/key /var/cache/salt/master /var/run/salt/master fi -## if command -v systemctl; then -## db_get salt-master/active -## RESLT=$(echo "$RET" | cut -d ' ' -f 1) -## if [ "$RESLT" != 10 ]; then -## if [ "$RESLT" == "active" ]; then -## systemctl restart salt-master -## fi -## db_get salt-master/enabled -## if [ "$RESLT" == "disabled" ]; then -## systemctl disable salt-api -## else -## systemctl enable salt-api -## fi -## else -## systemctl restart salt-master -## systemctl enable salt-master -## fi -## fi + if command -v systemctl; then + db_get salt-master/active + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" != 10 ]; then + if [ "$RESLT" == "active" ]; then + systemctl restart salt-master + fi + db_get salt-master/enabled + if [ "$RESLT" == "disabled" ]; then + systemctl disable salt-master + else + systemctl enable salt-master + fi + else + systemctl restart salt-master + systemctl enable salt-master + fi + fi ;; esac diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index 313b4518afa..d49664588de 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -36,16 +36,16 @@ case "$1" in db_set salt-master/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/master /etc/salt/master.d /var/log/salt/master \ /var/log/salt/key /var/cache/salt/master /var/run/salt/master -## if command -v systemctl; then -## SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) -## db_set salt-master/enabled $SM_ENABLED -## SM_ACTIVE=$(systemctl is-active salt-master) -## db_set salt-master/active $SM_ACTIVE -## else -## db_set salt-master/enabled enabled -## db_set salt-master/active active -## -## fi + if command -v systemctl; then + SM_ENABLED=$(systemctl show -p UnitFileState salt-master | cut -d '=' -f 2) + db_set salt-master/enabled $SM_ENABLED + SM_ACTIVE=$(systemctl is-active salt-master) + db_set salt-master/active $SM_ACTIVE + else + db_set salt-master/enabled enabled + db_set salt-master/active active + + fi ;; esac diff --git a/pkg/debian/salt-master.templates b/pkg/debian/salt-master.templates index 70a1141e33b..c0ea8cfd69b 100644 --- a/pkg/debian/salt-master.templates +++ b/pkg/debian/salt-master.templates @@ -3,3 +3,15 @@ Type: string Default: salt Description: User for salt-master User to run the salt-master process as + +Template: salt-master/enabled +Type: string +Default: enabled +Description: Systemd enable state for salt-master + default enable state for salt-master systemd state + +Template: salt-master/active +Type: string +Default: active +Description: Systemd active state for salt-master + default active state for salt-master systemd state diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 981ed65f200..553cd26ad5d 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -18,23 +18,23 @@ case "$1" in fi chown -R $RET:$RET /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion /var/cache/salt/minion /var/run/salt/minion fi -## if command -v systemctl; then -## db_get salt-minion/active -## RESLT=$(echo "$RET" | cut -d ' ' -f 1) -## if [ "$RESLT" != 10 ]; then -## if [ "$RESLT" == "active" ]; then -## systemctl restart salt-minion -## fi -## db_get salt-minion/enabled -## if [ "$RESLT" == "disabled" ]; then -## systemctl disable salt-api -## else -## systemctl enable salt-api -## fi -## else -## systemctl restart salt-minion -## systemctl enable salt-minion -## fi -## fi + if command -v systemctl; then + db_get salt-minion/active + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" != 10 ]; then + if [ "$RESLT" == "active" ]; then + systemctl restart salt-minion + fi + db_get salt-minion/enabled + if [ "$RESLT" == "disabled" ]; then + systemctl disable salt-minion + else + systemctl enable salt-minion + fi + else + systemctl restart salt-minion + systemctl enable salt-minion + fi + fi ;; esac diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index 45522a05065..b6281b6a56b 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -20,15 +20,15 @@ case "$1" in db_set salt-minion/user $CUR_USER chown -R $CUR_USER:$CUR_GROUP /etc/salt/pki/minion /etc/salt/minion.d /var/log/salt/minion \ /var/cache/salt/minion /var/run/salt/minion -## if command -v systemctl; then -## SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) -## db_set salt-minion/enabled $SM_ENABLED -## SM_ACTIVE=$(systemctl is-active salt-minion) -## db_set salt-minion/active $SM_ACTIVE -## else -## db_set salt-minion/enabled enabled -## db_set salt-minion/active active -## -## fi + if command -v systemctl; then + SM_ENABLED=$(systemctl show -p UnitFileState salt-minion | cut -d '=' -f 2) + db_set salt-minion/enabled $SM_ENABLED + SM_ACTIVE=$(systemctl is-active salt-minion) + db_set salt-minion/active $SM_ACTIVE + else + db_set salt-minion/enabled enabled + db_set salt-minion/active active + + fi ;; esac From b44bd4be78ffe8662294c2fb3382b26073c2ac4f Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 10 May 2024 09:35:40 -0600 Subject: [PATCH 024/157] Fix typo's and parsing of RESLT --- pkg/debian/salt-api.postinst | 7 +++++-- pkg/debian/salt-cloud.postinst | 2 ++ pkg/debian/salt-master.postinst | 5 +++-- pkg/debian/salt-minion.postinst | 5 +++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index a9ba724d7ce..ab3cc05f566 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -1,3 +1,5 @@ +#!/bin/sh -x + . /usr/share/debconf/confmodule echo "DGM salt-api.postinst dollar $@" @@ -16,11 +18,12 @@ case "$1" in db_get salt-api/active RESLT=$(echo "$RET" | cut -d ' ' -f 1) if [ "$RESLT" != 10 ]; then - if [ "$RESLT" == "active" ]; then + if [ "$RESLT" = "active" ]; then systemctl restart salt-api fi db_get salt-api/enabled - if [ "$RESLT" == "disabled" ]; then + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" = "disabled" ]; then systemctl disable salt-api else systemctl enable salt-api diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index e760e573bd1..5e07309e14a 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -1,3 +1,5 @@ +#!/bin/sh -x + . /usr/share/debconf/confmodule echo "DGM salt-cloud.postinst dollar $@" diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index a96c0ce288c..cdeb880ae78 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -22,11 +22,12 @@ case "$1" in db_get salt-master/active RESLT=$(echo "$RET" | cut -d ' ' -f 1) if [ "$RESLT" != 10 ]; then - if [ "$RESLT" == "active" ]; then + if [ "$RESLT" = "active" ]; then systemctl restart salt-master fi db_get salt-master/enabled - if [ "$RESLT" == "disabled" ]; then + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" = "disabled" ]; then systemctl disable salt-master else systemctl enable salt-master diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 553cd26ad5d..6ee3ea33337 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -22,11 +22,12 @@ case "$1" in db_get salt-minion/active RESLT=$(echo "$RET" | cut -d ' ' -f 1) if [ "$RESLT" != 10 ]; then - if [ "$RESLT" == "active" ]; then + if [ "$RESLT" = "active" ]; then systemctl restart salt-minion fi db_get salt-minion/enabled - if [ "$RESLT" == "disabled" ]; then + RESLT=$(echo "$RET" | cut -d ' ' -f 1) + if [ "$RESLT" = "disabled" ]; then systemctl disable salt-minion else systemctl enable salt-minion From ac20d2fd7568a2f8fb1e68ba4df04f4be3fc0431 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 10 May 2024 14:53:11 -0600 Subject: [PATCH 025/157] Attempting to allow for upgrade and downgrade tests --- tools/ci.py | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/tools/ci.py b/tools/ci.py index c5cf22cc851..7d43cf54afc 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -770,13 +770,19 @@ def pkg_matrix( gh_event_path = os.environ.get("GITHUB_EVENT_PATH") or None if gh_event_path is None: ctx.warn("The 'GITHUB_EVENT_PATH' variable is not set.") - else: - try: - gh_event = json.loads(open(gh_event_path, encoding="utf-8").read()) - except Exception as exc: - ctx.error( - f"Could not load the GH Event payload from {gh_event_path!r}:\n", exc - ) + ctx.exit(1) + + if TYPE_CHECKING: + assert gh_event_path is not None + + try: + gh_event = json.loads(open(gh_event_path, encoding="utf-8").read()) + except Exception as exc: + ctx.error(f"Could not load the GH Event payload from {gh_event_path!r}:\n", exc) + ctx.exit(1) + + if TYPE_CHECKING: + assert gh_event is not None github_output = os.environ.get("GITHUB_OUTPUT") if github_output is None: @@ -859,16 +865,6 @@ def pkg_matrix( ] for version, backend in adjusted_versions: - if ( - distro_slug.startswith(("macos-", "debian-", "ubuntu-")) - or version.major < 3006 - ): - # XXX: Temporarily skip problematic tests - ctx.warn( - f"Temporary skip builds on {distro_slug} for version {version} with backend {backend}" - ) - continue - prefix = prefixes[backend] # TODO: Remove this after 3009.0 if backend == "relenv" and version >= tools.utils.Version("3006.5"): @@ -885,10 +881,9 @@ def pkg_matrix( # key_filter = f"Contents[?contains(Key, '{version}')] | [?ends_with(Key, '.msi')]" continue elif pkg_type == "NSIS": - # XXX: Temporarily skip problematic tests - # key_filter = ( - # f"Contents[?contains(Key, '{version}')] | [?ends_with(Key, '.exe')]" - # ) + key_filter = ( + f"Contents[?contains(Key, '{version}')] | [?ends_with(Key, '.exe')]" + ) continue objects = list(page_iterator.search(key_filter)) # Testing using `any` because sometimes the paginator returns `[None]` @@ -916,8 +911,7 @@ def pkg_matrix( ctx.print(" * ", entry, soft_wrap=True) if ( - gh_event is not None - and gh_event["repository"]["fork"] is True + gh_event["repository"]["fork"] is True and "macos" in distro_slug and "arm64" in distro_slug ): From 18a4dd8282427fc3e45a5628c51b9b4d73ad5ff0 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Mon, 13 May 2024 15:28:39 -0600 Subject: [PATCH 026/157] Update to allow for systemctl daemon-reload after installing new packages --- pkg/debian/salt-api.postinst | 2 + pkg/debian/salt-master.postinst | 2 + pkg/debian/salt-minion.postinst | 2 + .../pytests/pkg/upgrade/test_salt_upgrade.py | 46 +++++++++++++++++-- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index ab3cc05f566..3cf37a1675d 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -18,6 +18,7 @@ case "$1" in db_get salt-api/active RESLT=$(echo "$RET" | cut -d ' ' -f 1) if [ "$RESLT" != 10 ]; then + systemctl daemon-reload if [ "$RESLT" = "active" ]; then systemctl restart salt-api fi @@ -29,6 +30,7 @@ case "$1" in systemctl enable salt-api fi else + systemctl daemon-reload systemctl restart salt-api systemctl enable salt-api fi diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index cdeb880ae78..cdf85d13856 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -22,6 +22,7 @@ case "$1" in db_get salt-master/active RESLT=$(echo "$RET" | cut -d ' ' -f 1) if [ "$RESLT" != 10 ]; then + systemctl daemon-reload if [ "$RESLT" = "active" ]; then systemctl restart salt-master fi @@ -33,6 +34,7 @@ case "$1" in systemctl enable salt-master fi else + systemctl daemon-reload systemctl restart salt-master systemctl enable salt-master fi diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 6ee3ea33337..f6f7940e944 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -22,6 +22,7 @@ case "$1" in db_get salt-minion/active RESLT=$(echo "$RET" | cut -d ' ' -f 1) if [ "$RESLT" != 10 ]; then + systemctl daemon-reload if [ "$RESLT" = "active" ]; then systemctl restart salt-minion fi @@ -33,6 +34,7 @@ case "$1" in systemctl enable salt-minion fi else + systemctl daemon-reload systemctl restart salt-minion systemctl enable salt-minion fi diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 5d4cd9f5411..12faa065e4d 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -8,7 +8,10 @@ from pytestskipmarkers.utils import platform log = logging.getLogger(__name__) -def _get_running_salt_minion_pid(process_name): +def _get_running_salt_minion_pid( + process_name, +): # pylint: disable=logging-fstring-interpolation + # psutil process name only returning first part of the command '/opt/saltstack/' # need to check all of command line for salt-minion # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] @@ -19,13 +22,21 @@ def _get_running_salt_minion_pid(process_name): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) if process_name in cmdl_strg: pids.append(proc.pid) + + log.warning( + f"DGM _get_running_salt_minion_pid, returning for process_name '{process_name}', pids '{pids}'" + ) return pids -def test_salt_upgrade_minion(salt_call_cli, install_salt): +def test_salt_upgrade_minion( + salt_call_cli, install_salt +): # pylint: disable=logging-fstring-interpolation """ Test an upgrade of Salt Minion. """ + + log.warning("DGM test_salt_upgrade_minion entry") if install_salt.relenv: original_py_version = install_salt.package_python_version() @@ -33,6 +44,10 @@ def test_salt_upgrade_minion(salt_call_cli, install_salt): ret = salt_call_cli.run("--local", "test.version") assert ret.returncode == 0 installed_version = packaging.version.parse(ret.data) + dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) + log.warning( + f"DGM test_salt_upgrade_minion, installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) assert installed_version < packaging.version.parse(install_salt.artifact_version) # Test pip install before an upgrade @@ -60,8 +75,16 @@ def test_salt_upgrade_minion(salt_call_cli, install_salt): # Upgrade Salt from previous version and test install_salt.install(upgrade=True) ret = salt_call_cli.run("--local", "test.version") + log.warning(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") + assert ret.returncode == 0 installed_version = packaging.version.parse(ret.data) + + dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) + log.warning( + f"DGM test_salt_upgrade_minion, upgrade installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) + assert installed_version == packaging.version.parse(install_salt.artifact_version) # Verify there is a new running minion by getting its PID and comparing it @@ -88,10 +111,13 @@ def test_salt_upgrade_minion(salt_call_cli, install_salt): @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -def test_salt_upgrade_master(install_salt): +def test_salt_upgrade_master( + install_salt, +): # pylint: disable=logging-fstring-interpolation """ Test an upgrade of Salt Master. """ + log.warning("DGM test_salt_upgrade_master entry") if not install_salt.upgrade: pytest.skip("Not testing an upgrade, do not run") @@ -101,6 +127,13 @@ def test_salt_upgrade_master(install_salt): # Verify previous install version is setup correctly and works bin_file = "salt" ret = install_salt.proc.run(bin_file, "--version") + log.warning(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'") + dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) + dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) + log.warning( + f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) + assert ret.returncode == 0 assert packaging.version.parse( ret.stdout.strip().split()[1] @@ -127,6 +160,13 @@ def test_salt_upgrade_master(install_salt): # Upgrade Salt from previous version and test install_salt.install(upgrade=True) ret = install_salt.proc.run(bin_file, "--version") + log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") + dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) + dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) + log.warning( + f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) + assert ret.returncode == 0 assert packaging.version.parse( ret.stdout.strip().split()[1] From 7f8dbe2ed27cca38b1eac8047b1ff6451cbb537a Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Wed, 15 May 2024 10:46:44 -0600 Subject: [PATCH 027/157] Commented out new tests for salt-master, to check build --- .../pkg/downgrade/test_salt_downgrade.py | 125 +++++++-------- .../pytests/pkg/upgrade/test_salt_upgrade.py | 149 +++++++++--------- 2 files changed, 138 insertions(+), 136 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index c48c1d4e7c7..dcae34603b8 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -1,6 +1,7 @@ import packaging.version import psutil -import pytest + +## DGM import pytest from pytestskipmarkers.utils import platform @@ -90,64 +91,64 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): assert "Authentication information could" in use_lib.stderr -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -def test_salt_downgrade_master(install_salt): - """ - Test an downgrade of Salt Master. - """ - if not install_salt.downgrade: - pytest.skip("Not testing a downgrade, do not run") - - is_downgrade_to_relenv = packaging.version.parse( - install_salt.prev_version - ) >= packaging.version.parse("3006.0") - - if is_downgrade_to_relenv: - original_py_version = install_salt.package_python_version() - - # Verify current install version is setup correctly and works - bin_file = "salt" - ret = install_salt.proc.run(bin_file, "--version") - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) == packaging.version.parse(install_salt.artifact_version) - - # Verify there is a running master by getting its PID - salt_name = "salt" - process_name = "salt-master" - - old_pid = [] - - # psutil process name only returning first part of the command '/opt/saltstack/' - # need to check all of command line for salt-minion - # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] - # and psutil is only returning the salt-minion once - for proc in psutil.process_iter(): - if salt_name in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - old_pid.append(proc.pid) - - assert old_pid - - # Downgrade Salt to the previous version and test - install_salt.install(downgrade=True) - - # Verify there is a new running master by getting its PID and comparing it - # with the PID from before the upgrade - new_pid = [] - for proc in psutil.process_iter(): - if salt_name in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - new_pid.append(proc.pid) - - assert new_pid - assert new_pid != old_pid - - ret = install_salt.proc.run(bin_file, "--version") - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) < packaging.version.parse(install_salt.artifact_version) +## DGM @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +## DGM def test_salt_downgrade_master(install_salt): +## DGM """ +## DGM Test an downgrade of Salt Master. +## DGM """ +## DGM if not install_salt.downgrade: +## DGM pytest.skip("Not testing a downgrade, do not run") +## DGM +## DGM is_downgrade_to_relenv = packaging.version.parse( +## DGM install_salt.prev_version +## DGM ) >= packaging.version.parse("3006.0") +## DGM +## DGM if is_downgrade_to_relenv: +## DGM original_py_version = install_salt.package_python_version() +## DGM +## DGM # Verify current install version is setup correctly and works +## DGM bin_file = "salt" +## DGM ret = install_salt.proc.run(bin_file, "--version") +## DGM assert ret.returncode == 0 +## DGM assert packaging.version.parse( +## DGM ret.stdout.strip().split()[1] +## DGM ) == packaging.version.parse(install_salt.artifact_version) +## DGM +## DGM # Verify there is a running master by getting its PID +## DGM salt_name = "salt" +## DGM process_name = "salt-master" +## DGM +## DGM old_pid = [] +## DGM +## DGM # psutil process name only returning first part of the command '/opt/saltstack/' +## DGM # need to check all of command line for salt-minion +## DGM # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] +## DGM # and psutil is only returning the salt-minion once +## DGM for proc in psutil.process_iter(): +## DGM if salt_name in proc.name(): +## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) +## DGM if process_name in cmdl_strg: +## DGM old_pid.append(proc.pid) +## DGM +## DGM assert old_pid +## DGM +## DGM # Downgrade Salt to the previous version and test +## DGM install_salt.install(downgrade=True) +## DGM +## DGM # Verify there is a new running master by getting its PID and comparing it +## DGM # with the PID from before the upgrade +## DGM new_pid = [] +## DGM for proc in psutil.process_iter(): +## DGM if salt_name in proc.name(): +## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) +## DGM if process_name in cmdl_strg: +## DGM new_pid.append(proc.pid) +## DGM +## DGM assert new_pid +## DGM assert new_pid != old_pid +## DGM +## DGM ret = install_salt.proc.run(bin_file, "--version") +## DGM assert ret.returncode == 0 +## DGM assert packaging.version.parse( +## DGM ret.stdout.strip().split()[1] +## DGM ) < packaging.version.parse(install_salt.artifact_version) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 12faa065e4d..c00dfa639dd 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -2,7 +2,8 @@ import logging import packaging.version import psutil -import pytest + +## DGM import pytest from pytestskipmarkers.utils import platform log = logging.getLogger(__name__) @@ -110,76 +111,76 @@ def test_salt_upgrade_minion( assert "Authentication information could" in use_lib.stderr -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -def test_salt_upgrade_master( - install_salt, -): # pylint: disable=logging-fstring-interpolation - """ - Test an upgrade of Salt Master. - """ - log.warning("DGM test_salt_upgrade_master entry") - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # Verify previous install version is setup correctly and works - bin_file = "salt" - ret = install_salt.proc.run(bin_file, "--version") - log.warning(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'") - dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) - dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) - log.warning( - f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) == packaging.version.parse(install_salt.artifact_version) - - # Verify there is a running minion by getting its PID - salt_name = "salt" - process_name = "salt-master" - - old_pid = [] - - # psutil process name only returning first part of the command '/opt/saltstack/' - # need to check all of command line for salt-master - # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] - # and psutil is only returning the salt-minion once - for proc in psutil.process_iter(): - if salt_name in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - old_pid.append(proc.pid) - - assert old_pid - - # Upgrade Salt from previous version and test - install_salt.install(upgrade=True) - ret = install_salt.proc.run(bin_file, "--version") - log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") - dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) - dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) - log.warning( - f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) == packaging.version.parse(install_salt.artifact_version) - - # Verify there is a new running master by getting its PID and comparing it - # with the PID from before the upgrade - new_pid = [] - for proc in psutil.process_iter(): - if salt_name in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - new_pid.append(proc.pid) - - assert new_pid - assert new_pid != old_pid +## DGM @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +## DGM def test_salt_upgrade_master( +## DGM install_salt, +## DGM ): # pylint: disable=logging-fstring-interpolation +## DGM """ +## DGM Test an upgrade of Salt Master. +## DGM """ +## DGM log.warning("DGM test_salt_upgrade_master entry") +## DGM if not install_salt.upgrade: +## DGM pytest.skip("Not testing an upgrade, do not run") +## DGM +## DGM if install_salt.relenv: +## DGM original_py_version = install_salt.package_python_version() +## DGM +## DGM # Verify previous install version is setup correctly and works +## DGM bin_file = "salt" +## DGM ret = install_salt.proc.run(bin_file, "--version") +## DGM log.warning(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'") +## DGM dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) +## DGM dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) +## DGM log.warning( +## DGM f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" +## DGM ) +## DGM +## DGM assert ret.returncode == 0 +## DGM assert packaging.version.parse( +## DGM ret.stdout.strip().split()[1] +## DGM ) == packaging.version.parse(install_salt.artifact_version) +## DGM +## DGM # Verify there is a running minion by getting its PID +## DGM salt_name = "salt" +## DGM process_name = "salt-master" +## DGM +## DGM old_pid = [] +## DGM +## DGM # psutil process name only returning first part of the command '/opt/saltstack/' +## DGM # need to check all of command line for salt-master +## DGM # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] +## DGM # and psutil is only returning the salt-minion once +## DGM for proc in psutil.process_iter(): +## DGM if salt_name in proc.name(): +## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) +## DGM if process_name in cmdl_strg: +## DGM old_pid.append(proc.pid) +## DGM +## DGM assert old_pid +## DGM +## DGM # Upgrade Salt from previous version and test +## DGM install_salt.install(upgrade=True) +## DGM ret = install_salt.proc.run(bin_file, "--version") +## DGM log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") +## DGM dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) +## DGM dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) +## DGM log.warning( +## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" +## DGM ) +## DGM +## DGM assert ret.returncode == 0 +## DGM assert packaging.version.parse( +## DGM ret.stdout.strip().split()[1] +## DGM ) == packaging.version.parse(install_salt.artifact_version) +## DGM +## DGM # Verify there is a new running master by getting its PID and comparing it +## DGM # with the PID from before the upgrade +## DGM new_pid = [] +## DGM for proc in psutil.process_iter(): +## DGM if salt_name in proc.name(): +## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) +## DGM if process_name in cmdl_strg: +## DGM new_pid.append(proc.pid) +## DGM +## DGM assert new_pid +## DGM assert new_pid != old_pid From c5632c7d107b60736383bbe54d0ecde04646a428 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Wed, 15 May 2024 13:55:33 -0600 Subject: [PATCH 028/157] Disable classic upgrade - downgrade testing --- .github/workflows/test-packages-action-linux.yml | 10 +++++----- .github/workflows/test-packages-action-windows.yml | 10 +++++----- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 4 ++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index 432b8e04bb4..6b3b3d79713 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -192,11 +192,11 @@ jobs: run: | tools --timestamps vm decompress-dependencies ${{ inputs.distro-slug }} - - name: Downgrade importlib-metadata - if: ${{ contains(fromJSON('["amazonlinux-2", "centos-7"]'), inputs.distro-slug) && contains(fromJSON('["upgrade-classic", "downgrade-classic"]'), matrix.tests-chunk) }} - run: | - # This step can go away once we stop testing classic packages upgrade/downgrades to/from 3005.x - tools --timestamps vm ssh ${{ inputs.distro-slug }} -- "sudo python3 -m pip install -U 'importlib-metadata<=4.13.0' 'virtualenv<=20.21.1'" + ## DGM - name: Downgrade importlib-metadata + ## DGM if: ${{ contains(fromJSON('["amazonlinux-2", "centos-7"]'), inputs.distro-slug) && contains(fromJSON('["upgrade-classic", "downgrade-classic"]'), matrix.tests-chunk) }} + ## DGM run: | + ## DGM # This step can go away once we stop testing classic packages upgrade/downgrades to/from 3005.x + ## DGM tools --timestamps vm ssh ${{ inputs.distro-slug }} -- "sudo python3 -m pip install -U 'importlib-metadata<=4.13.0' 'virtualenv<=20.21.1'" - name: Show System Info run: | diff --git a/.github/workflows/test-packages-action-windows.yml b/.github/workflows/test-packages-action-windows.yml index c21100f4e69..1020c4ba15a 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -191,11 +191,11 @@ jobs: run: | tools --timestamps vm decompress-dependencies ${{ inputs.distro-slug }} - - name: Downgrade importlib-metadata - if: ${{ contains(fromJSON('["amazonlinux-2", "centos-7"]'), inputs.distro-slug) && contains(fromJSON('["upgrade-classic", "downgrade-classic"]'), matrix.tests-chunk) }} - run: | - # This step can go away once we stop testing classic packages upgrade/downgrades to/from 3005.x - tools --timestamps vm ssh ${{ inputs.distro-slug }} -- "sudo python3 -m pip install -U 'importlib-metadata<=4.13.0' 'virtualenv<=20.21.1'" + ## DGM - name: Downgrade importlib-metadata + ## DGM if: ${{ contains(fromJSON('["amazonlinux-2", "centos-7"]'), inputs.distro-slug) && contains(fromJSON('["upgrade-classic", "downgrade-classic"]'), matrix.tests-chunk) }} + ## DGM run: | + ## DGM # This step can go away once we stop testing classic packages upgrade/downgrades to/from 3005.x + ## DGM tools --timestamps vm ssh ${{ inputs.distro-slug }} -- "sudo python3 -m pip install -U 'importlib-metadata<=4.13.0' 'virtualenv<=20.21.1'" - name: Show System Info run: | diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index c00dfa639dd..a82be4e645c 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -19,8 +19,12 @@ def _get_running_salt_minion_pid( # and psutil is only returning the salt-minion once pids = [] for proc in psutil.process_iter(): + log.warning(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") if "salt" in proc.name(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + log.warning( + f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" + ) if process_name in cmdl_strg: pids.append(proc.pid) From f742ecda0e3ca577c4f0e83631ffb69ffdb0461d Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Wed, 15 May 2024 16:41:43 -0600 Subject: [PATCH 029/157] Futher removal of support for Salt 3005 --- tools/ci.py | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/tools/ci.py b/tools/ci.py index 7d43cf54afc..4920b351729 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -791,28 +791,29 @@ def pkg_matrix( if TYPE_CHECKING: assert testing_releases - still_testing_3005 = False - for release_version in testing_releases: - if still_testing_3005: - break - if release_version < tools.utils.Version("3006.0"): - still_testing_3005 = True + ## DGM still_testing_3005 = False + ## DGM for release_version in testing_releases: + ## DGM if still_testing_3005: + ## DGM break + ## DGM if release_version < tools.utils.Version("3006.0"): + ## DGM still_testing_3005 = True - if still_testing_3005 is False: - ctx.error( - f"No longer testing 3005.x releases please update {__file__} " - "and remove this error and the logic above the error. There may " - "be other places that need code removed as well." - ) - ctx.exit(1) + ## DGM if still_testing_3005 is False: + ## DGM ctx.error( + ## DGM f"No longer testing 3005.x releases please update {__file__} " + ## DGM "and remove this error and the logic above the error. There may " + ## DGM "be other places that need code removed as well." + ## DGM ) + ## DGM ctx.exit(1) adjusted_versions = [] for ver in testing_releases: - if ver < tools.utils.Version("3006.0"): - adjusted_versions.append((ver, "classic")) - adjusted_versions.append((ver, "tiamat")) - else: - adjusted_versions.append((ver, "relenv")) + ## DGM if ver < tools.utils.Version("3006.0"): + ## DGM adjusted_versions.append((ver, "classic")) + ## DGM adjusted_versions.append((ver, "tiamat")) + ## DGM else: + ## DGM adjusted_versions.append((ver, "relenv")) + adjusted_versions.append((ver, "relenv")) ctx.info(f"Will look for the following versions: {adjusted_versions}") # Filter out the prefixes to look under @@ -1329,13 +1330,18 @@ def get_testing_releases( majors = sorted( list( { + ## DGM version.major + ## DGM for version in releases + ## DGM # We aren't testing upgrades from anything before + ## DGM # 3006.0 except the latest 3005.x + ## DGM if version.major >= 3005 + ## DGM # We don't want to test 3007.? on the 3006.x branch + ## DGM and version.major <= parsed_salt_version.major + # We aren't testing upgrades from anything before 3006.0 + # and we don't want to test 3007.? on the 3006.x branch version.major for version in releases - # We aren't testing upgrades from anything before - # 3006.0 except the latest 3005.x - if version.major >= 3005 - # We don't want to test 3007.? on the 3006.x branch - and version.major <= parsed_salt_version.major + if version.major > 3005 and version.major <= parsed_salt_version.major } ) )[-num_major_versions:] From e2761de56b4b4620a684d1821c4d5d01afc4bd99 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 16 May 2024 08:21:55 -0600 Subject: [PATCH 030/157] Addition method to output debug info --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index a82be4e645c..dec1e22d6a0 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -20,17 +20,24 @@ def _get_running_salt_minion_pid( pids = [] for proc in psutil.process_iter(): log.warning(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") + print(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") if "salt" in proc.name(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) log.warning( f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" ) + print( + f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" + ) if process_name in cmdl_strg: pids.append(proc.pid) log.warning( f"DGM _get_running_salt_minion_pid, returning for process_name '{process_name}', pids '{pids}'" ) + print( + f"DGM _get_running_salt_minion_pid, returning for process_name '{process_name}', pids '{pids}'" + ) return pids @@ -42,6 +49,7 @@ def test_salt_upgrade_minion( """ log.warning("DGM test_salt_upgrade_minion entry") + print("DGM test_salt_upgrade_minion entry") if install_salt.relenv: original_py_version = install_salt.package_python_version() @@ -53,6 +61,9 @@ def test_salt_upgrade_minion( log.warning( f"DGM test_salt_upgrade_minion, installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" ) + print( + f"DGM test_salt_upgrade_minion, installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) assert installed_version < packaging.version.parse(install_salt.artifact_version) # Test pip install before an upgrade @@ -81,6 +92,7 @@ def test_salt_upgrade_minion( install_salt.install(upgrade=True) ret = salt_call_cli.run("--local", "test.version") log.warning(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") + print(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") assert ret.returncode == 0 installed_version = packaging.version.parse(ret.data) @@ -89,6 +101,9 @@ def test_salt_upgrade_minion( log.warning( f"DGM test_salt_upgrade_minion, upgrade installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" ) + print( + f"DGM test_salt_upgrade_minion, upgrade installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) assert installed_version == packaging.version.parse(install_salt.artifact_version) From 102afa6ac9b397ccdbd6cb996721bdc690eebba3 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 16 May 2024 09:00:35 -0600 Subject: [PATCH 031/157] Minor cleanup of commented out code --- .github/workflows/backport.yml | 2 ++ .../workflows/test-packages-action-linux.yml | 6 ----- .../test-packages-action-windows.yml | 6 ----- tools/ci.py | 27 ------------------- 4 files changed, 2 insertions(+), 39 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 0f61ba09040..31345a58b6e 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -20,12 +20,14 @@ jobs: github.event.pull_request.merged == true && ( contains(github.event.pull_request.labels.*.name, 'backport:master') || + contains(github.event.pull_request.labels.*.name, 'backport:3007.x') || contains(github.event.pull_request.labels.*.name, 'backport:3006.x') || contains(github.event.pull_request.labels.*.name, 'backport:3005.x') ) && ( (github.event.action == 'labeled' && ( contains(github.event.pull_request.labels.*.name, 'backport:master') || + contains(github.event.pull_request.labels.*.name, 'backport:3007.x') || contains(github.event.pull_request.labels.*.name, 'backport:3006.x') || contains(github.event.pull_request.labels.*.name, 'backport:3005.x') )) diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index 6b3b3d79713..36b4d7818d4 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -192,12 +192,6 @@ jobs: run: | tools --timestamps vm decompress-dependencies ${{ inputs.distro-slug }} - ## DGM - name: Downgrade importlib-metadata - ## DGM if: ${{ contains(fromJSON('["amazonlinux-2", "centos-7"]'), inputs.distro-slug) && contains(fromJSON('["upgrade-classic", "downgrade-classic"]'), matrix.tests-chunk) }} - ## DGM run: | - ## DGM # This step can go away once we stop testing classic packages upgrade/downgrades to/from 3005.x - ## DGM tools --timestamps vm ssh ${{ inputs.distro-slug }} -- "sudo python3 -m pip install -U 'importlib-metadata<=4.13.0' 'virtualenv<=20.21.1'" - - name: Show System Info run: | tools --timestamps --timeout-secs=1800 vm test --skip-requirements-install --print-system-information-only \ diff --git a/.github/workflows/test-packages-action-windows.yml b/.github/workflows/test-packages-action-windows.yml index 1020c4ba15a..985ff96de82 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -191,12 +191,6 @@ jobs: run: | tools --timestamps vm decompress-dependencies ${{ inputs.distro-slug }} - ## DGM - name: Downgrade importlib-metadata - ## DGM if: ${{ contains(fromJSON('["amazonlinux-2", "centos-7"]'), inputs.distro-slug) && contains(fromJSON('["upgrade-classic", "downgrade-classic"]'), matrix.tests-chunk) }} - ## DGM run: | - ## DGM # This step can go away once we stop testing classic packages upgrade/downgrades to/from 3005.x - ## DGM tools --timestamps vm ssh ${{ inputs.distro-slug }} -- "sudo python3 -m pip install -U 'importlib-metadata<=4.13.0' 'virtualenv<=20.21.1'" - - name: Show System Info run: | tools --timestamps --timeout-secs=1800 vm test --skip-requirements-install --print-system-information-only \ diff --git a/tools/ci.py b/tools/ci.py index 4920b351729..391214e69a3 100644 --- a/tools/ci.py +++ b/tools/ci.py @@ -791,28 +791,8 @@ def pkg_matrix( if TYPE_CHECKING: assert testing_releases - ## DGM still_testing_3005 = False - ## DGM for release_version in testing_releases: - ## DGM if still_testing_3005: - ## DGM break - ## DGM if release_version < tools.utils.Version("3006.0"): - ## DGM still_testing_3005 = True - - ## DGM if still_testing_3005 is False: - ## DGM ctx.error( - ## DGM f"No longer testing 3005.x releases please update {__file__} " - ## DGM "and remove this error and the logic above the error. There may " - ## DGM "be other places that need code removed as well." - ## DGM ) - ## DGM ctx.exit(1) - adjusted_versions = [] for ver in testing_releases: - ## DGM if ver < tools.utils.Version("3006.0"): - ## DGM adjusted_versions.append((ver, "classic")) - ## DGM adjusted_versions.append((ver, "tiamat")) - ## DGM else: - ## DGM adjusted_versions.append((ver, "relenv")) adjusted_versions.append((ver, "relenv")) ctx.info(f"Will look for the following versions: {adjusted_versions}") @@ -1330,13 +1310,6 @@ def get_testing_releases( majors = sorted( list( { - ## DGM version.major - ## DGM for version in releases - ## DGM # We aren't testing upgrades from anything before - ## DGM # 3006.0 except the latest 3005.x - ## DGM if version.major >= 3005 - ## DGM # We don't want to test 3007.? on the 3006.x branch - ## DGM and version.major <= parsed_salt_version.major # We aren't testing upgrades from anything before 3006.0 # and we don't want to test 3007.? on the 3006.x branch version.major From 1a82d65a259db258ca999a8d520b205ae6172da3 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 16 May 2024 10:44:26 -0600 Subject: [PATCH 032/157] Further debug statements --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index dec1e22d6a0..fe4c1b67a51 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -20,7 +20,9 @@ def _get_running_salt_minion_pid( pids = [] for proc in psutil.process_iter(): log.warning(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") - print(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") + print( + f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}', and proc.cmdline '{proc.cmdline()}'" + ) if "salt" in proc.name(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) log.warning( @@ -55,6 +57,10 @@ def test_salt_upgrade_minion( # Verify previous install version is setup correctly and works ret = salt_call_cli.run("--local", "test.version") + print(f"DGM test_salt_upgrade_minion, test.version ret '{ret}'") + assert ret.returncode == 0 + ret = salt_call_cli.run("--local", "cmd.run", "ps aux") + print(f"DGM test_salt_upgrade_minion, ps aux ret '{ret}'") assert ret.returncode == 0 installed_version = packaging.version.parse(ret.data) dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) From 449c82226e7a10a6b39340aaaea2a81dd1abb0d1 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 16 May 2024 14:18:21 -0600 Subject: [PATCH 033/157] Fix debugging order --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index fe4c1b67a51..5f21ed15685 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -55,13 +55,13 @@ def test_salt_upgrade_minion( if install_salt.relenv: original_py_version = install_salt.package_python_version() + ret = salt_call_cli.run("--local", "cmd.run", "ps aux") + print(f"DGM test_salt_upgrade_minion, ps aux ret '{ret}'") + assert ret.returncode == 0 # Verify previous install version is setup correctly and works ret = salt_call_cli.run("--local", "test.version") print(f"DGM test_salt_upgrade_minion, test.version ret '{ret}'") assert ret.returncode == 0 - ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - print(f"DGM test_salt_upgrade_minion, ps aux ret '{ret}'") - assert ret.returncode == 0 installed_version = packaging.version.parse(ret.data) dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) log.warning( From d63062be8235bac1eaf552392dfeb83fa1e17d2b Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 16 May 2024 16:51:24 -0600 Subject: [PATCH 034/157] Fix psutil for MacOS platform check --- .../pkg/downgrade/test_salt_downgrade.py | 20 ++++++------- .../pytests/pkg/upgrade/test_salt_upgrade.py | 29 +++++++++++-------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index dcae34603b8..bf051d27028 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -42,15 +42,16 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): old_pid = [] - # psutil process name only returning first part of the command '/opt/saltstack/' # need to check all of command line for salt-minion - # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] + # Linux: psutil process name only returning first part of the command '/opt/saltstack/' + # Linux: ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] + # MacOS: psutil process name only returning last part of the command '/opt/salt/bin/python3.10', that is 'python3.10' + # MacOS: ['/opt/salt/bin/python3.10 /opt/salt/salt-minion', ''] # and psutil is only returning the salt-minion once for proc in psutil.process_iter(): - if salt_name in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - old_pid.append(proc.pid) + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + old_pid.append(proc.pid) assert old_pid @@ -69,10 +70,9 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): # with the PID from before the upgrade new_pid = [] for proc in psutil.process_iter(): - if salt_name in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - new_pid.append(proc.pid) + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + new_pid.append(proc.pid) assert new_pid assert new_pid != old_pid diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 5f21ed15685..24e6f1612ff 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -13,26 +13,31 @@ def _get_running_salt_minion_pid( process_name, ): # pylint: disable=logging-fstring-interpolation - # psutil process name only returning first part of the command '/opt/saltstack/' # need to check all of command line for salt-minion - # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] + # + # Linux: psutil process name only returning first part of the command '/opt/saltstack/' + # Linux: ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] + # + # MacOS: psutil process name only returning last part of the command '/opt/salt/bin/python3.10', that is 'python3.10' + # MacOS: ['/opt/salt/bin/python3.10 /opt/salt/salt-minion', ''] + # # and psutil is only returning the salt-minion once + pids = [] for proc in psutil.process_iter(): log.warning(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") print( f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}', and proc.cmdline '{proc.cmdline()}'" ) - if "salt" in proc.name(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - log.warning( - f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" - ) - print( - f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" - ) - if process_name in cmdl_strg: - pids.append(proc.pid) + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + log.warning( + f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" + ) + print( + f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" + ) + if process_name in cmdl_strg: + pids.append(proc.pid) log.warning( f"DGM _get_running_salt_minion_pid, returning for process_name '{process_name}', pids '{pids}'" From 9abb43cdcf4f48dbe55bbc430dbac3ae7f3c8654 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 17 May 2024 09:31:50 -0600 Subject: [PATCH 035/157] More debug --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 24e6f1612ff..63ca94eaac8 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -24,17 +24,18 @@ def _get_running_salt_minion_pid( # and psutil is only returning the salt-minion once pids = [] + log.warning( + f"DGM _get_running_salt_minion_pid entry, process_name '{process_name}'" + ) + print(f"DGM _get_running_salt_minion_pid entry, process_name '{process_name}'") for proc in psutil.process_iter(): - log.warning(f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}'") - print( - f"DGM _get_running_salt_minion_pid, proc.name '{proc.name()}', and proc.cmdline '{proc.cmdline()}'" - ) + dgm_cmdline = proc.cmdline() cmdl_strg = " ".join(str(element) for element in proc.cmdline()) log.warning( - f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" + f"DGM _get_running_salt_minion_pid, cmdline, cmdl_strg '{cmdl_strg}'" ) print( - f"DGM _get_running_salt_minion_pid, proc.name exists, process_name '{process_name}', cmdl_strg '{cmdl_strg}'" + f"DGM _get_running_salt_minion_pid, cmdline, cmdl_strg '{cmdl_strg}', from cmdline '{dgm_cmdline}'" ) if process_name in cmdl_strg: pids.append(proc.pid) @@ -61,7 +62,7 @@ def test_salt_upgrade_minion( original_py_version = install_salt.package_python_version() ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - print(f"DGM test_salt_upgrade_minion, ps aux ret '{ret}'") + print(f"DGM test_salt_upgrade_minion, initial minion ps aux ret '{ret}'") assert ret.returncode == 0 # Verify previous install version is setup correctly and works ret = salt_call_cli.run("--local", "test.version") @@ -128,6 +129,11 @@ def test_salt_upgrade_minion( process_name = "salt-minion.exe" else: process_name = "salt-minion" + + ret = salt_call_cli.run("--local", "cmd.run", "ps aux") + print(f"DGM test_salt_upgrade_minion, upgraded minion ps aux ret '{ret}'") + assert ret.returncode == 0 + new_pids = _get_running_salt_minion_pid(process_name) assert new_pids From 24a44edf8c42e51930bf7befc682517e1731709f Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 17 May 2024 14:17:25 -0600 Subject: [PATCH 036/157] Further debug statements --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 4 ++++ tests/support/pkg.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 63ca94eaac8..83a5b268b01 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -1,4 +1,5 @@ import logging +import time import packaging.version import psutil @@ -102,6 +103,9 @@ def test_salt_upgrade_minion( # Upgrade Salt from previous version and test install_salt.install(upgrade=True) + + time.sleep(60) # give it some time, DGM + ret = salt_call_cli.run("--local", "test.version") log.warning(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") print(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 6b7863c2f5e..400c6160e7a 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -483,9 +483,9 @@ class SaltPkgInstall: log.debug("Installing: %s", str(pkg)) ret = self.proc.run("installer", "-pkg", str(pkg), "-target", "/") self._check_retcode(ret) - # Stop the service installed by the installer - self.proc.run("launchctl", "disable", f"system/{service_name}") - self.proc.run("launchctl", "bootout", "system", str(plist_file)) + ## DGM # Stop the service installed by the installer + ## DGM self.proc.run("launchctl", "disable", f"system/{service_name}") + ## DGM self.proc.run("launchctl", "bootout", "system", str(plist_file)) elif upgrade: env = os.environ.copy() extra_args = [] From 9138c3ccd245a582c29ea1bc14d53e89c4f567d0 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 17 May 2024 15:55:19 -0600 Subject: [PATCH 037/157] Further debug --- tests/support/pkg.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 400c6160e7a..fd02267b86d 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -483,9 +483,13 @@ class SaltPkgInstall: log.debug("Installing: %s", str(pkg)) ret = self.proc.run("installer", "-pkg", str(pkg), "-target", "/") self._check_retcode(ret) - ## DGM # Stop the service installed by the installer - ## DGM self.proc.run("launchctl", "disable", f"system/{service_name}") - ## DGM self.proc.run("launchctl", "bootout", "system", str(plist_file)) + + ## DGM TBD why stop service on upgrade ??? + if not upgrade: + # Stop the service installed by the installer + self.proc.run("launchctl", "disable", f"system/{service_name}") + self.proc.run("launchctl", "bootout", "system", str(plist_file)) + elif upgrade: env = os.environ.copy() extra_args = [] From 9bbf6491a3fe7908e6c6e2f3cfb858e02e019e46 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Wed, 22 May 2024 16:18:47 -0600 Subject: [PATCH 038/157] WIP additional tests for salt-master --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 226 +++++++++++------- 1 file changed, 144 insertions(+), 82 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 83a5b268b01..08908db0ad3 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -4,80 +4,84 @@ import time import packaging.version import psutil -## DGM import pytest +## import pytest from pytestskipmarkers.utils import platform log = logging.getLogger(__name__) -def _get_running_salt_minion_pid( +def _get_running_named_salt_pid( process_name, ): # pylint: disable=logging-fstring-interpolation - # need to check all of command line for salt-minion + # need to check all of command line for salt-minion, salt-master, for example: salt-minion # # Linux: psutil process name only returning first part of the command '/opt/saltstack/' # Linux: ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] # # MacOS: psutil process name only returning last part of the command '/opt/salt/bin/python3.10', that is 'python3.10' # MacOS: ['/opt/salt/bin/python3.10 /opt/salt/salt-minion', ''] - # - # and psutil is only returning the salt-minion once pids = [] - log.warning( - f"DGM _get_running_salt_minion_pid entry, process_name '{process_name}'" - ) - print(f"DGM _get_running_salt_minion_pid entry, process_name '{process_name}'") + log.warning(f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'") + ## DGM print( + ## DGM f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'", + ## DGM flush=True, + ## DGM ) for proc in psutil.process_iter(): dgm_cmdline = proc.cmdline() cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - log.warning( - f"DGM _get_running_salt_minion_pid, cmdline, cmdl_strg '{cmdl_strg}'" - ) - print( - f"DGM _get_running_salt_minion_pid, cmdline, cmdl_strg '{cmdl_strg}', from cmdline '{dgm_cmdline}'" - ) + ## DGM log.warning( + ## DGM f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}'" + ## DGM ) + ## DGM print( + ## DGM f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}', from cmdline '{dgm_cmdline}'", flush=True + ## DGM ) if process_name in cmdl_strg: pids.append(proc.pid) log.warning( - f"DGM _get_running_salt_minion_pid, returning for process_name '{process_name}', pids '{pids}'" - ) - print( - f"DGM _get_running_salt_minion_pid, returning for process_name '{process_name}', pids '{pids}'" + f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'" ) + ## DGM print( + ## DGM f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'", + ## DGM flush=True, + ## DGM ) return pids -def test_salt_upgrade_minion( +def test_salt_upgrade( salt_call_cli, install_salt ): # pylint: disable=logging-fstring-interpolation """ - Test an upgrade of Salt Minion. + Test an upgrade of Salt, Minion, Master, etc. """ log.warning("DGM test_salt_upgrade_minion entry") - print("DGM test_salt_upgrade_minion entry") + ## DGM print("DGM test_salt_upgrade_minion entry", flush=True) if install_salt.relenv: original_py_version = install_salt.package_python_version() - ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - print(f"DGM test_salt_upgrade_minion, initial minion ps aux ret '{ret}'") - assert ret.returncode == 0 - # Verify previous install version is setup correctly and works + ## DGM ret = salt_call_cli.run("--local", "cmd.run", "ps aux") + ## DGM print(f"DGM test_salt_upgrade_minion, initial minion ps aux ret '{ret}'", flush=True) + ## DGM assert ret.returncode == 0 + + # Verify previous install version salt-minion is setup correctly and works ret = salt_call_cli.run("--local", "test.version") - print(f"DGM test_salt_upgrade_minion, test.version ret '{ret}'") + ## DGM print(f"DGM test_salt_upgrade_minion, test.version ret '{ret}'", flush=True) assert ret.returncode == 0 - installed_version = packaging.version.parse(ret.data) + installed_minion_version = packaging.version.parse(ret.data) dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) log.warning( - f"DGM test_salt_upgrade_minion, installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + f"DGM test_salt_upgrade_minion, installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" ) - print( - f"DGM test_salt_upgrade_minion, installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ## DGM print( + ## DGM f"DGM test_salt_upgrade_minion, installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", + ## DGM flush=True, + ## DGM ) + assert installed_minion_version < packaging.version.parse( + install_salt.artifact_version ) - assert installed_version < packaging.version.parse(install_salt.artifact_version) # Test pip install before an upgrade dep = "PyGithub==1.56.0" @@ -90,58 +94,85 @@ def test_salt_upgrade_minion( assert "Authentication information could" in use_lib.stderr # Verify there is a running minion by getting its PID - if installed_version < packaging.version.parse("3006.0"): + if installed_minion_version < packaging.version.parse("3006.0"): # This is using PyInstaller - process_name = "run minion" + process_minion_name = "run minion" else: if platform.is_windows(): - process_name = "salt-minion.exe" + process_minion_name = "salt-minion.exe" else: - process_name = "salt-minion" - old_pids = _get_running_salt_minion_pid(process_name) - assert old_pids + process_minion_name = "salt-minion" - # Upgrade Salt from previous version and test + old_minion_pids = _get_running_named_salt_pid(process_minion_name) + assert old_minion_pids + + # Verify previous install version salt-master is setup correctly and works + bin_file = "salt" + ret = install_salt.proc.run(bin_file, "--version") + log.warning(f"DGM test_salt_upgrade_master , installed_master_version ret '{ret}'") + ## DGM print( + ## DGM f"DGM test_salt_upgrade_master , installed_master_version ret '{ret}'", + ## DGM flush=True, + ## DGM ) + + dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) + dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) + log.warning( + f"DGM test_salt_upgrade_master , installed_master_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) + ## DGM print( + ## DGM f"DGM test_salt_upgrade_master , installed_master_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", + ## DGM flush=True, + ## DGM ) + + assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) < packaging.version.parse(install_salt.artifact_version) + + # Verify there is a running master by getting its PID + salt_name = "salt" + process_master_name = "salt-master" + + old_master_pids = _get_running_named_salt_pid(process_master_name) + assert old_master_pids + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test install_salt.install(upgrade=True) time.sleep(60) # give it some time, DGM ret = salt_call_cli.run("--local", "test.version") log.warning(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") - print(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") + ## DGM print(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'", flush=True) assert ret.returncode == 0 - installed_version = packaging.version.parse(ret.data) + installed_minion_version = packaging.version.parse(ret.data) dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) log.warning( - f"DGM test_salt_upgrade_minion, upgrade installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - print( - f"DGM test_salt_upgrade_minion, upgrade installed_version '{installed_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + f"DGM test_salt_upgrade_minion, upgrade installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" ) + ## DGM print( + ## DGM f"DGM test_salt_upgrade_minion, upgrade installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", + ## DGM flush=True, + ## DGM ) - assert installed_version == packaging.version.parse(install_salt.artifact_version) + assert installed_minion_version == packaging.version.parse( + install_salt.artifact_version + ) # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade - if installed_version < packaging.version.parse("3006.0"): - # This is using PyInstaller - process_name = "run minion" - else: - if platform.is_windows(): - process_name = "salt-minion.exe" - else: - process_name = "salt-minion" - ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - print(f"DGM test_salt_upgrade_minion, upgraded minion ps aux ret '{ret}'") - assert ret.returncode == 0 + ## DGM ret = salt_call_cli.run("--local", "cmd.run", "ps aux") + ## DGM print(f"DGM test_salt_upgrade_minion, upgraded minion ps aux ret '{ret}'", flush=True) + ## DGM assert ret.returncode == 0 - new_pids = _get_running_salt_minion_pid(process_name) + new_minion_pids = _get_running_named_salt_pid(process_minion_name) - assert new_pids - assert new_pids != old_pids + assert new_minion_pids + assert new_minion_pids != old_minion_pids if install_salt.relenv: new_py_version = install_salt.package_python_version() @@ -150,10 +181,36 @@ def test_salt_upgrade_minion( use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr + ret = install_salt.proc.run(bin_file, "--version") + log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") + ## DGM print(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'", flush=True) + + dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) + dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) + log.warning( + f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" + ) + ## DGM print( + ## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", + ## DGM flush=True, + ## DGM ) + + assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) == packaging.version.parse(install_salt.artifact_version) + + # Verify there is a new running master by getting its PID and comparing it + # with the PID from before the upgrade + new_master_pids = _get_running_named_salt_pid(process_master_name) + + assert new_master_pids + assert new_master_pids != old_master_pids + ## DGM @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") ## DGM def test_salt_upgrade_master( -## DGM install_salt, +## DGM salt_call_cli, install_salt, ## DGM ): # pylint: disable=logging-fstring-interpolation ## DGM """ ## DGM Test an upgrade of Salt Master. @@ -161,6 +218,7 @@ def test_salt_upgrade_minion( ## DGM log.warning("DGM test_salt_upgrade_master entry") ## DGM if not install_salt.upgrade: ## DGM pytest.skip("Not testing an upgrade, do not run") +## DGM print("DGM test_salt_upgrade_master, not testing an upgrade, do not run", flush=True) ## DGM ## DGM if install_salt.relenv: ## DGM original_py_version = install_salt.package_python_version() @@ -169,44 +227,53 @@ def test_salt_upgrade_minion( ## DGM bin_file = "salt" ## DGM ret = install_salt.proc.run(bin_file, "--version") ## DGM log.warning(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'") +## DGM print(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'", flush=True) +## DGM ## DGM dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) ## DGM dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) ## DGM log.warning( ## DGM f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" ## DGM ) +## DGM print( +## DGM f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", flush=True +## DGM ) +## DGM +## DGM dgm_stdout_strip = ret.stdout.strip() +## DGM dgm_stdout_strip_split = ret.stdout.strip().split() +## DGM dgm_stdout_strip_split_one = ret.stdout.strip().split()[1] +## DGM print(f"DGM test_salt_upgrade_master, dgm_stdout_strip '{dgm_stdout_strip}', dgm_stdout_strip_split '{dgm_stdout_strip_split}', dgm_stdout_strip_split_one '{dgm_stdout_strip_split_one}'") ## DGM ## DGM assert ret.returncode == 0 ## DGM assert packaging.version.parse( ## DGM ret.stdout.strip().split()[1] -## DGM ) == packaging.version.parse(install_salt.artifact_version) +## DGM ) < packaging.version.parse(install_salt.artifact_version) +## DGM +## DGM ## DGM ret = salt_call_cli.run("--local", "cmd.run", "ps aux") +## DGM ## DGM print(f"DGM test_salt_upgrade_master, initial master ps aux ret '{ret}'", flush=True) +## DGM ## DGM assert ret.returncode == 0 ## DGM ## DGM # Verify there is a running minion by getting its PID ## DGM salt_name = "salt" ## DGM process_name = "salt-master" ## DGM -## DGM old_pid = [] +## DGM old_pids = _get_running_named_salt_pid(process_name) ## DGM -## DGM # psutil process name only returning first part of the command '/opt/saltstack/' -## DGM # need to check all of command line for salt-master -## DGM # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] -## DGM # and psutil is only returning the salt-minion once -## DGM for proc in psutil.process_iter(): -## DGM if salt_name in proc.name(): -## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) -## DGM if process_name in cmdl_strg: -## DGM old_pid.append(proc.pid) -## DGM -## DGM assert old_pid +## DGM assert old_pids ## DGM ## DGM # Upgrade Salt from previous version and test ## DGM install_salt.install(upgrade=True) ## DGM ret = install_salt.proc.run(bin_file, "--version") ## DGM log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") +## DGM print(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'", flush=True) +## DGM ## DGM dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) ## DGM dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) ## DGM log.warning( ## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" ## DGM ) +## DGM print( +## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", flush=True +## DGM ) ## DGM ## DGM assert ret.returncode == 0 ## DGM assert packaging.version.parse( @@ -215,12 +282,7 @@ def test_salt_upgrade_minion( ## DGM ## DGM # Verify there is a new running master by getting its PID and comparing it ## DGM # with the PID from before the upgrade -## DGM new_pid = [] -## DGM for proc in psutil.process_iter(): -## DGM if salt_name in proc.name(): -## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) -## DGM if process_name in cmdl_strg: -## DGM new_pid.append(proc.pid) +## DGM new_pids = _get_running_named_salt_pid(process_name) ## DGM -## DGM assert new_pid -## DGM assert new_pid != old_pid +## DGM assert new_pids +## DGM assert new_pids != old_pids From 1ebb6b0b17f4d3b5d39049df85809153541f5348 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Thu, 23 May 2024 09:25:53 -0600 Subject: [PATCH 039/157] Debugging MacOS --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 08908db0ad3..829c7eae5ae 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -24,29 +24,30 @@ def _get_running_named_salt_pid( pids = [] log.warning(f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'") - ## DGM print( - ## DGM f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'", - ## DGM flush=True, - ## DGM ) + print( + f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'", + flush=True, + ) for proc in psutil.process_iter(): dgm_cmdline = proc.cmdline() cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - ## DGM log.warning( - ## DGM f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}'" - ## DGM ) - ## DGM print( - ## DGM f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}', from cmdline '{dgm_cmdline}'", flush=True - ## DGM ) + log.warning( + f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}'" + ) + print( + f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}', from cmdline '{dgm_cmdline}'", + flush=True, + ) if process_name in cmdl_strg: pids.append(proc.pid) log.warning( f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'" ) - ## DGM print( - ## DGM f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'", - ## DGM flush=True, - ## DGM ) + print( + f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'", + flush=True, + ) return pids @@ -131,7 +132,6 @@ def test_salt_upgrade( ) < packaging.version.parse(install_salt.artifact_version) # Verify there is a running master by getting its PID - salt_name = "salt" process_master_name = "salt-master" old_master_pids = _get_running_named_salt_pid(process_master_name) @@ -165,9 +165,11 @@ def test_salt_upgrade( # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade - ## DGM ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - ## DGM print(f"DGM test_salt_upgrade_minion, upgraded minion ps aux ret '{ret}'", flush=True) - ## DGM assert ret.returncode == 0 + ret = salt_call_cli.run("--local", "cmd.run", "ps aux") + print( + f"DGM test_salt_upgrade_minion, upgraded minion ps aux ret '{ret}'", flush=True + ) + assert ret.returncode == 0 new_minion_pids = _get_running_named_salt_pid(process_minion_name) From 2da91cd48d60ca4d2a513d00fa5acf5632eb5c66 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 24 May 2024 10:34:46 -0600 Subject: [PATCH 040/157] WIP Initial updated tests --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 357 ++++++++---------- 1 file changed, 158 insertions(+), 199 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 829c7eae5ae..0b3ffd2c663 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -3,13 +3,34 @@ import time import packaging.version import psutil - -## import pytest +import pytest from pytestskipmarkers.utils import platform log = logging.getLogger(__name__) +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + def _get_running_named_salt_pid( process_name, ): # pylint: disable=logging-fstring-interpolation @@ -23,67 +44,37 @@ def _get_running_named_salt_pid( # MacOS: ['/opt/salt/bin/python3.10 /opt/salt/salt-minion', ''] pids = [] - log.warning(f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'") - print( - f"DGM _get_running_named_salt_pid entry, process_name '{process_name}'", - flush=True, - ) for proc in psutil.process_iter(): - dgm_cmdline = proc.cmdline() cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - log.warning( - f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}'" - ) - print( - f"DGM _get_running_named_salt_pid, cmdline, cmdl_strg '{cmdl_strg}', from cmdline '{dgm_cmdline}'", - flush=True, - ) if process_name in cmdl_strg: pids.append(proc.pid) - log.warning( - f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'" - ) - print( - f"DGM _get_running_named_salt_pid, returning for process_name '{process_name}', pids '{pids}'", - flush=True, - ) return pids -def test_salt_upgrade( - salt_call_cli, install_salt -): # pylint: disable=logging-fstring-interpolation +def test_salt_upgrade(salt_call_cli, install_salt): """ - Test an upgrade of Salt, Minion, Master, etc. + Test an upgrade of Salt, Minion and Master """ - - log.warning("DGM test_salt_upgrade_minion entry") - ## DGM print("DGM test_salt_upgrade_minion entry", flush=True) if install_salt.relenv: original_py_version = install_salt.package_python_version() - ## DGM ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - ## DGM print(f"DGM test_salt_upgrade_minion, initial minion ps aux ret '{ret}'", flush=True) - ## DGM assert ret.returncode == 0 - # Verify previous install version salt-minion is setup correctly and works ret = salt_call_cli.run("--local", "test.version") - ## DGM print(f"DGM test_salt_upgrade_minion, test.version ret '{ret}'", flush=True) assert ret.returncode == 0 installed_minion_version = packaging.version.parse(ret.data) - dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) - log.warning( - f"DGM test_salt_upgrade_minion, installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - ## DGM print( - ## DGM f"DGM test_salt_upgrade_minion, installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", - ## DGM flush=True, - ## DGM ) assert installed_minion_version < packaging.version.parse( install_salt.artifact_version ) + # Verify previous install version salt-master is setup correctly and works + bin_file = "salt" + ret = install_salt.proc.run(bin_file, "--version") + assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) < packaging.version.parse(install_salt.artifact_version) + # Test pip install before an upgrade dep = "PyGithub==1.56.0" install = salt_call_cli.run("--local", "pip.install", dep) @@ -94,87 +85,47 @@ def test_salt_upgrade( use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr - # Verify there is a running minion by getting its PID - if installed_minion_version < packaging.version.parse("3006.0"): - # This is using PyInstaller - process_minion_name = "run minion" + # Verify there is a running minion and master by getting there PIDs + process_master_name = "salt-master" + if platform.is_windows(): + process_minion_name = "salt-minion.exe" else: - if platform.is_windows(): - process_minion_name = "salt-minion.exe" - else: - process_minion_name = "salt-minion" + process_minion_name = "salt-minion" old_minion_pids = _get_running_named_salt_pid(process_minion_name) - assert old_minion_pids - - # Verify previous install version salt-master is setup correctly and works - bin_file = "salt" - ret = install_salt.proc.run(bin_file, "--version") - log.warning(f"DGM test_salt_upgrade_master , installed_master_version ret '{ret}'") - ## DGM print( - ## DGM f"DGM test_salt_upgrade_master , installed_master_version ret '{ret}'", - ## DGM flush=True, - ## DGM ) - - dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) - dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) - log.warning( - f"DGM test_salt_upgrade_master , installed_master_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - ## DGM print( - ## DGM f"DGM test_salt_upgrade_master , installed_master_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", - ## DGM flush=True, - ## DGM ) - - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) < packaging.version.parse(install_salt.artifact_version) - - # Verify there is a running master by getting its PID - process_master_name = "salt-master" - old_master_pids = _get_running_named_salt_pid(process_master_name) + assert old_minion_pids assert old_master_pids # Upgrade Salt (inc. minion, master, etc.) from previous version and test install_salt.install(upgrade=True) - time.sleep(60) # give it some time, DGM + time.sleep(6) # give it some time ret = salt_call_cli.run("--local", "test.version") - log.warning(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'") - ## DGM print(f"DGM test_salt_upgrade_minion, upgrade test_version ret '{ret}'", flush=True) - assert ret.returncode == 0 + installed_minion_version = packaging.version.parse(ret.data) - - dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) - log.warning( - f"DGM test_salt_upgrade_minion, upgrade installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - ## DGM print( - ## DGM f"DGM test_salt_upgrade_minion, upgrade installed_minion_version '{installed_minion_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", - ## DGM flush=True, - ## DGM ) - assert installed_minion_version == packaging.version.parse( install_salt.artifact_version ) - # Verify there is a new running minion by getting its PID and comparing it - # with the PID from before the upgrade - - ret = salt_call_cli.run("--local", "cmd.run", "ps aux") - print( - f"DGM test_salt_upgrade_minion, upgraded minion ps aux ret '{ret}'", flush=True - ) + ret = install_salt.proc.run(bin_file, "--version") assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) == packaging.version.parse(install_salt.artifact_version) + + # Verify there is a new running minion and master by getting their PID and comparing them + # with previous PIDs from before the upgrade new_minion_pids = _get_running_named_salt_pid(process_minion_name) + new_master_pids = _get_running_named_salt_pid(process_master_name) assert new_minion_pids + assert new_master_pids assert new_minion_pids != old_minion_pids + assert new_master_pids != old_master_pids if install_salt.relenv: new_py_version = install_salt.package_python_version() @@ -183,108 +134,116 @@ def test_salt_upgrade( use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr - ret = install_salt.proc.run(bin_file, "--version") - log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") - ## DGM print(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'", flush=True) - dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) - dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) - log.warning( - f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" - ) - ## DGM print( - ## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", - ## DGM flush=True, - ## DGM ) +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_wrk( + salt_call_cli, install_salt, salt_systemd_setup +): # pylint: disable=logging-fstring-interpolation + """ + Test an upgrade working features of Salt + """ + log.warning("DGM test_salt_wrk entry") + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + print("DGM test_salt_wrk, not testing an upgrade, do not run", flush=True) - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) == packaging.version.parse(install_salt.artifact_version) + if install_salt.relenv: + original_py_version = install_salt.package_python_version() - # Verify there is a new running master by getting its PID and comparing it - # with the PID from before the upgrade - new_master_pids = _get_running_named_salt_pid(process_master_name) + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup - assert new_master_pids - assert new_master_pids != old_master_pids + # test for enable, active and user, group + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test, ret '{ret}'", + flush=True, + ) + test_enabled = ret.stdout.strip().split("=")[1] + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_enabled == "enabled" + test_cmd = f"systemctl is-active {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl active test, ret '{ret}'", + flush=True, + ) + test_active = ret.stdout.strip().split()[2] + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl active test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_active == "active" -## DGM @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -## DGM def test_salt_upgrade_master( -## DGM salt_call_cli, install_salt, -## DGM ): # pylint: disable=logging-fstring-interpolation -## DGM """ -## DGM Test an upgrade of Salt Master. -## DGM """ -## DGM log.warning("DGM test_salt_upgrade_master entry") -## DGM if not install_salt.upgrade: -## DGM pytest.skip("Not testing an upgrade, do not run") -## DGM print("DGM test_salt_upgrade_master, not testing an upgrade, do not run", flush=True) -## DGM -## DGM if install_salt.relenv: -## DGM original_py_version = install_salt.package_python_version() -## DGM -## DGM # Verify previous install version is setup correctly and works -## DGM bin_file = "salt" -## DGM ret = install_salt.proc.run(bin_file, "--version") -## DGM log.warning(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'") -## DGM print(f"DGM test_salt_upgrade_master , installed_version ret '{ret}'", flush=True) -## DGM -## DGM dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) -## DGM dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) -## DGM log.warning( -## DGM f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" -## DGM ) -## DGM print( -## DGM f"DGM test_salt_upgrade_master , installed_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", flush=True -## DGM ) -## DGM -## DGM dgm_stdout_strip = ret.stdout.strip() -## DGM dgm_stdout_strip_split = ret.stdout.strip().split() -## DGM dgm_stdout_strip_split_one = ret.stdout.strip().split()[1] -## DGM print(f"DGM test_salt_upgrade_master, dgm_stdout_strip '{dgm_stdout_strip}', dgm_stdout_strip_split '{dgm_stdout_strip_split}', dgm_stdout_strip_split_one '{dgm_stdout_strip_split_one}'") -## DGM -## DGM assert ret.returncode == 0 -## DGM assert packaging.version.parse( -## DGM ret.stdout.strip().split()[1] -## DGM ) < packaging.version.parse(install_salt.artifact_version) -## DGM -## DGM ## DGM ret = salt_call_cli.run("--local", "cmd.run", "ps aux") -## DGM ## DGM print(f"DGM test_salt_upgrade_master, initial master ps aux ret '{ret}'", flush=True) -## DGM ## DGM assert ret.returncode == 0 -## DGM -## DGM # Verify there is a running minion by getting its PID -## DGM salt_name = "salt" -## DGM process_name = "salt-master" -## DGM -## DGM old_pids = _get_running_named_salt_pid(process_name) -## DGM -## DGM assert old_pids -## DGM -## DGM # Upgrade Salt from previous version and test -## DGM install_salt.install(upgrade=True) -## DGM ret = install_salt.proc.run(bin_file, "--version") -## DGM log.warning(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'") -## DGM print(f"DGM test_salt_upgrade_master , upgrade_version ret '{ret}'", flush=True) -## DGM -## DGM dgm_ret_version = packaging.version.parse(ret.stdout.strip().split()[1]) -## DGM dgm_pkg_version_parsed = packaging.version.parse(install_salt.artifact_version) -## DGM log.warning( -## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'" -## DGM ) -## DGM print( -## DGM f"DGM test_salt_upgrade_master , upgrade_version ret parsed '{dgm_ret_version}', artifact_version '{install_salt.artifact_version}', pkg_version_parsed '{dgm_pkg_version_parsed}'", flush=True -## DGM ) -## DGM -## DGM assert ret.returncode == 0 -## DGM assert packaging.version.parse( -## DGM ret.stdout.strip().split()[1] -## DGM ) == packaging.version.parse(install_salt.artifact_version) -## DGM -## DGM # Verify there is a new running master by getting its PID and comparing it -## DGM # with the PID from before the upgrade -## DGM new_pids = _get_running_named_salt_pid(process_name) -## DGM -## DGM assert new_pids -## DGM assert new_pids != old_pids + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_user == "salt" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_group == "salt" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + if test_name == "salt-minion": + assert test_user == "root" + else: + assert test_user == "salt" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + if test_name == "salt-minion": + assert test_group == "root" + else: + assert test_group == "salt" From b3cc75e5de20db62276c0308938ca9d91df2bcf4 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 24 May 2024 11:42:16 -0600 Subject: [PATCH 041/157] Fix test --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 0b3ffd2c663..eced00be933 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -163,7 +163,7 @@ def test_salt_wrk( f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test, ret '{ret}'", flush=True, ) - test_enabled = ret.stdout.strip().split("=")[1] + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() print( f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", flush=True, @@ -177,7 +177,7 @@ def test_salt_wrk( f"DGM salt_systemd_setup, '{test_item}' systemctl active test, ret '{ret}'", flush=True, ) - test_active = ret.stdout.strip().split()[2] + test_active = ret.stdout.strip().split()[2].strip('"').strip() print( f"DGM salt_systemd_setup, '{test_item}' systemctl active test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", flush=True, @@ -227,7 +227,7 @@ def test_salt_wrk( flush=True, ) assert ret.returncode == 0 - if test_name == "salt-minion": + if test_item == "salt-minion": assert test_user == "root" else: assert test_user == "salt" @@ -243,7 +243,7 @@ def test_salt_wrk( flush=True, ) assert ret.returncode == 0 - if test_name == "salt-minion": + if test_item == "salt-minion": assert test_group == "root" else: assert test_group == "salt" From 85c77e65b072d34bdc2ec8ff39d3184d14857cfe Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Fri, 24 May 2024 14:08:37 -0600 Subject: [PATCH 042/157] Added more tests for enabled, disabled, inactive and active, ownership wip --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 399 +++++++++++++++--- 1 file changed, 342 insertions(+), 57 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index eced00be933..a3c86086f57 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -31,6 +31,73 @@ def salt_systemd_setup( assert ret.returncode == 0 +@pytest.fixture +def salt_test_upgrade( + salt_call_cli, + install_salt, +): + """ + Test upgrade of Salt packages for Minion and Master + """ + # Verify previous install version salt-minion is setup correctly and works + ret = salt_call_cli.run("--local", "test.version") + assert ret.returncode == 0 + installed_minion_version = packaging.version.parse(ret.data) + assert installed_minion_version < packaging.version.parse( + install_salt.artifact_version + ) + + # Verify previous install version salt-master is setup correctly and works + bin_file = "salt" + ret = install_salt.proc.run(bin_file, "--version") + assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) < packaging.version.parse(install_salt.artifact_version) + + # Verify there is a running minion and master by getting there PIDs + process_master_name = "salt-master" + if platform.is_windows(): + process_minion_name = "salt-minion.exe" + else: + process_minion_name = "salt-minion" + + old_minion_pids = _get_running_named_salt_pid(process_minion_name) + old_master_pids = _get_running_named_salt_pid(process_master_name) + assert old_minion_pids + assert old_master_pids + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test + install_salt.install(upgrade=True) + + time.sleep(60) # give it some time + + ret = salt_call_cli.run("--local", "test.version") + assert ret.returncode == 0 + + installed_minion_version = packaging.version.parse(ret.data) + assert installed_minion_version == packaging.version.parse( + install_salt.artifact_version + ) + + ret = install_salt.proc.run(bin_file, "--version") + assert ret.returncode == 0 + assert packaging.version.parse( + ret.stdout.strip().split()[1] + ) == packaging.version.parse(install_salt.artifact_version) + + # Verify there is a new running minion and master by getting their PID and comparing them + # with previous PIDs from before the upgrade + + new_minion_pids = _get_running_named_salt_pid(process_minion_name) + new_master_pids = _get_running_named_salt_pid(process_master_name) + + assert new_minion_pids + assert new_master_pids + assert new_minion_pids != old_minion_pids + assert new_master_pids != old_master_pids + + def _get_running_named_salt_pid( process_name, ): # pylint: disable=logging-fstring-interpolation @@ -59,22 +126,6 @@ def test_salt_upgrade(salt_call_cli, install_salt): if install_salt.relenv: original_py_version = install_salt.package_python_version() - # Verify previous install version salt-minion is setup correctly and works - ret = salt_call_cli.run("--local", "test.version") - assert ret.returncode == 0 - installed_minion_version = packaging.version.parse(ret.data) - assert installed_minion_version < packaging.version.parse( - install_salt.artifact_version - ) - - # Verify previous install version salt-master is setup correctly and works - bin_file = "salt" - ret = install_salt.proc.run(bin_file, "--version") - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) < packaging.version.parse(install_salt.artifact_version) - # Test pip install before an upgrade dep = "PyGithub==1.56.0" install = salt_call_cli.run("--local", "pip.install", dep) @@ -85,47 +136,9 @@ def test_salt_upgrade(salt_call_cli, install_salt): use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr - # Verify there is a running minion and master by getting there PIDs - process_master_name = "salt-master" - if platform.is_windows(): - process_minion_name = "salt-minion.exe" - else: - process_minion_name = "salt-minion" - - old_minion_pids = _get_running_named_salt_pid(process_minion_name) - old_master_pids = _get_running_named_salt_pid(process_master_name) - assert old_minion_pids - assert old_master_pids - - # Upgrade Salt (inc. minion, master, etc.) from previous version and test - install_salt.install(upgrade=True) - - time.sleep(6) # give it some time - - ret = salt_call_cli.run("--local", "test.version") - assert ret.returncode == 0 - - installed_minion_version = packaging.version.parse(ret.data) - assert installed_minion_version == packaging.version.parse( - install_salt.artifact_version - ) - - ret = install_salt.proc.run(bin_file, "--version") - assert ret.returncode == 0 - assert packaging.version.parse( - ret.stdout.strip().split()[1] - ) == packaging.version.parse(install_salt.artifact_version) - - # Verify there is a new running minion and master by getting their PID and comparing them - # with previous PIDs from before the upgrade - - new_minion_pids = _get_running_named_salt_pid(process_minion_name) - new_master_pids = _get_running_named_salt_pid(process_master_name) - - assert new_minion_pids - assert new_master_pids - assert new_minion_pids != old_minion_pids - assert new_master_pids != old_master_pids + # perform Salt package upgrade test + # pylint: disable=pointless-statement + salt_test_upgrade if install_salt.relenv: new_py_version = install_salt.package_python_version() @@ -247,3 +260,275 @@ def test_salt_wrk( assert test_group == "root" else: assert test_group == "salt" + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_systemd_disabled_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): # pylint: disable=logging-fstring-interpolation + """ + Test upgrade of Salt packages preserve disabled state of systemd + """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + + if install_salt.relenv: + original_py_version = install_salt.package_python_version() + + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # ensure known state, disabled + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl disable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + # perform Salt package upgrade test + # pylint: disable=pointless-statement + salt_test_upgrade + + # test for disabled systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl disabled test, ret '{ret}'", + flush=True, + ) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl disabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_enabled == "disabled" + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_systemd_enabled_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): # pylint: disable=logging-fstring-interpolation + """ + Test upgrade of Salt packages preserve enabled state of systemd + """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + + if install_salt.relenv: + original_py_version = install_salt.package_python_version() + + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # perform Salt package upgrade test + # pylint: disable=pointless-statement + salt_test_upgrade + + # test for enabled systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test, ret '{ret}'", + flush=True, + ) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_enabled == "enabled" + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_systemd_inactive_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): # pylint: disable=logging-fstring-interpolation + """ + Test upgrade of Salt packages preserve inactive state of systemd + """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + + if install_salt.relenv: + original_py_version = install_salt.package_python_version() + + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # ensure known state, disabled + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl stop {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + # perform Salt package upgrade test + # pylint: disable=pointless-statement + salt_test_upgrade + + # test for inactive systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl is-active {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl inactive test, ret '{ret}'", + flush=True, + ) + test_active = ret.stdout.strip().split()[2].strip('"').strip() + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl inactive test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_active == "inactive" + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_systemd_active_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): # pylint: disable=logging-fstring-interpolation + """ + Test upgrade of Salt packages preserve active state of systemd + """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + + if install_salt.relenv: + original_py_version = install_salt.package_python_version() + + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # perform Salt package upgrade test + # pylint: disable=pointless-statement + salt_test_upgrade + + # test for active systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl is-active {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl active test, ret '{ret}'", + flush=True, + ) + test_active = ret.stdout.strip().split()[2].strip('"').strip() + print( + f"DGM salt_systemd_setup, '{test_item}' systemctl active test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_active == "active" + + +@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") +def test_salt_ownership_premission( + salt_call_cli, install_salt, salt_systemd_setup +): # pylint: disable=logging-fstring-interpolation + """ + Test upgrade of Salt packages preserve existing ownership + """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + + if install_salt.relenv: + original_py_version = install_salt.package_python_version() + + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # ensure known ownership + # TBD DGM need to create master user, and minion user, change conf, restart and test ownership + + # restart and check ownership is correct + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + # perform Salt package upgrade test + # pylint: disable=pointless-statement + salt_test_upgrade + + # test ownership for Minion, Master and Api + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER + assert test_user == "salt" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER + assert test_group == "salt" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER + if test_item == "salt-minion": + assert test_user == "root" + else: + assert test_user == "salt" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER + if test_item == "salt-minion": + assert test_group == "root" + else: + assert test_group == "salt" From e1d34cfc7a8236e32edc479c22976eb8d1832191 Mon Sep 17 00:00:00 2001 From: David Murphy < dmurphy@saltstack.com> Date: Tue, 28 May 2024 12:02:43 -0600 Subject: [PATCH 043/157] fix return code test for inactive --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index a3c86086f57..3c192df9680 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -389,7 +389,7 @@ def test_salt_systemd_inactive_preservation( f"DGM salt_systemd_setup, '{test_item}' systemctl inactive test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", flush=True, ) - assert ret.returncode == 0 + assert ret.returncode == 1 assert test_active == "inactive" From 0d5b85fb1a2a4c46589c4a2893a7a1237e670f51 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 3 Jun 2024 13:05:50 -0600 Subject: [PATCH 044/157] tests update --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 73 ++++++++++++++++++- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 3c192df9680..1f2600c9176 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -449,9 +449,6 @@ def test_salt_ownership_premission( # pylint: disable=pointless-statement salt_systemd_setup - # ensure known ownership - # TBD DGM need to create master user, and minion user, change conf, restart and test ownership - # restart and check ownership is correct test_list = ["salt-api", "salt-minion", "salt-master"] for test_item in test_list: @@ -459,6 +456,76 @@ def test_salt_ownership_premission( ret = salt_call_cli.run("--local", "cmd.run", test_cmd) assert ret.returncode == 0 + time.sleep(10) # allow some time for restart + + # test ownership for Minion, Master and Api + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_user == "salt" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_group == "salt" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_user == "root" + else: + assert test_user == "salt" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_group == "root" + else: + assert test_group == "salt" + + # TBD DGM need to create master user, and minion user, change conf, restart and test ownership + # perform Salt package upgrade test # pylint: disable=pointless-statement salt_test_upgrade From b65433f8ea42820e277e0bd313ad0827473f5d48 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 4 Jun 2024 12:19:20 -0600 Subject: [PATCH 045/157] Updated tests --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 181 ++++++++++++++---- 1 file changed, 146 insertions(+), 35 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 1f2600c9176..cfe7a3ef383 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -8,8 +8,9 @@ from pytestskipmarkers.utils import platform log = logging.getLogger(__name__) +pytestmark = [pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family")] + -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") @pytest.fixture def salt_systemd_setup( salt_call_cli, @@ -148,7 +149,6 @@ def test_salt_upgrade(salt_call_cli, install_salt): assert "Authentication information could" in use_lib.stderr -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") def test_salt_wrk( salt_call_cli, install_salt, salt_systemd_setup ): # pylint: disable=logging-fstring-interpolation @@ -262,7 +262,6 @@ def test_salt_wrk( assert test_group == "salt" -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") def test_salt_systemd_disabled_preservation( salt_call_cli, install_salt, salt_systemd_setup ): # pylint: disable=logging-fstring-interpolation @@ -308,7 +307,6 @@ def test_salt_systemd_disabled_preservation( assert test_enabled == "disabled" -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") def test_salt_systemd_enabled_preservation( salt_call_cli, install_salt, salt_systemd_setup ): # pylint: disable=logging-fstring-interpolation @@ -347,7 +345,6 @@ def test_salt_systemd_enabled_preservation( assert test_enabled == "enabled" -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") def test_salt_systemd_inactive_preservation( salt_call_cli, install_salt, salt_systemd_setup ): # pylint: disable=logging-fstring-interpolation @@ -393,7 +390,6 @@ def test_salt_systemd_inactive_preservation( assert test_active == "inactive" -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") def test_salt_systemd_active_preservation( salt_call_cli, install_salt, salt_systemd_setup ): # pylint: disable=logging-fstring-interpolation @@ -432,9 +428,8 @@ def test_salt_systemd_active_preservation( assert test_active == "active" -@pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") def test_salt_ownership_premission( - salt_call_cli, install_salt, salt_systemd_setup + salt_call_cli, install_salt, test_salt_ownership_premission ): # pylint: disable=logging-fstring-interpolation """ Test upgrade of Salt packages preserve existing ownership @@ -447,7 +442,7 @@ def test_salt_ownership_premission( # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement - salt_systemd_setup + test_salt_ownership_premission # restart and check ownership is correct test_list = ["salt-api", "salt-minion", "salt-master"] @@ -465,12 +460,12 @@ def test_salt_ownership_premission( test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", flush=True, ) test_user = ret.stdout.strip().split()[4] print( - f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", flush=True, ) assert ret.returncode == 0 @@ -479,12 +474,12 @@ def test_salt_ownership_premission( test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", flush=True, ) test_group = ret.stdout.strip().split()[5] print( - f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", flush=True, ) assert ret.returncode == 0 @@ -494,12 +489,12 @@ def test_salt_ownership_premission( test_cmd = f"ls -dl /run/salt/{test_name}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", flush=True, ) test_user = ret.stdout.strip().split()[4] print( - f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", flush=True, ) assert ret.returncode == 0 @@ -510,12 +505,12 @@ def test_salt_ownership_premission( ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", flush=True, ) test_group = ret.stdout.strip().split()[5] print( - f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", flush=True, ) assert ret.returncode == 0 @@ -525,11 +520,131 @@ def test_salt_ownership_premission( assert test_group == "salt" # TBD DGM need to create master user, and minion user, change conf, restart and test ownership + test_master_user = "horse" + test_minion_user = "donkey" + ret = salt_call_cli.run("--local", "user.add", f"{test_master_user}") + print( + f"DGM test_salt_ownership_premission, '{test_master_user}' user add, ret '{ret}'", + flush=True, + ) + + ret = salt_call_cli.run("--local", "user.add", f"{test_minion_user}") + print( + f"DGM test_salt_ownership_premission, '{test_minion_user}' user add, ret '{ret}'", + flush=True, + ) + + test_string = f"\nuser: {test_master_user}\n" + ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string) + print( + f"DGM test_salt_ownership_premission, file append /etc/salt/master '{test_string}', ret '{ret}'", + flush=True, + ) + + test_string = f"\nuser: {test_minion_user}\n" + ret = salt_call_cli.run("--local", "file.append", "/etc/salt/minion", test_string) + print( + f"DGM test_salt_ownership_premission, file append /etc/salt/minion '{test_string}', ret '{ret}'", + flush=True, + ) + + ## DGM Check configuration files + ret = salt_call_cli.run("--local", "cmd.run", "cat", "/etc/salt/master") + print( + f"DGM test_salt_ownership_premission, cat /etc/salt/master, ret '{ret}'", + flush=True, + ) + + ret = salt_call_cli.run("--local", "cmd.run", "cat", "/etc/salt/minion") + print( + f"DGM test_salt_ownership_premission, cat /etc/salt/minion, ret '{ret}'", + flush=True, + ) + + # restart and check ownership is correct + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + time.sleep(10) # allow some time for restart + + # test ownership for Minion, Master and Api - horse and donkey + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_user == f"{test_master_user}" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + assert test_group == f"{test_master_user}" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", + flush=True, + ) + test_user = ret.stdout.strip().split()[4] + print( + f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + flush=True, + ) + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_user == f"{test_minion_user}" + else: + assert test_user == f"{test_master_user}" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", + flush=True, + ) + test_group = ret.stdout.strip().split()[5] + print( + f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + flush=True, + ) + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_group == f"{test_minion_user}" + else: + assert test_group == f"{test_master_user}" # perform Salt package upgrade test # pylint: disable=pointless-statement salt_test_upgrade + print( + "DGM test_salt_ownership_premission, post-upgrade", + flush=True, + ) + # test ownership for Minion, Master and Api test_list = ["salt-api", "salt-minion", "salt-master"] for test_item in test_list: @@ -537,65 +652,61 @@ def test_salt_ownership_premission( test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", flush=True, ) test_user = ret.stdout.strip().split()[4] print( - f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", flush=True, ) assert ret.returncode == 0 - # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER - assert test_user == "salt" + assert test_user == f"{test_master_user}" test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", flush=True, ) test_group = ret.stdout.strip().split()[5] print( - f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", flush=True, ) assert ret.returncode == 0 - # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER - assert test_group == "salt" + assert test_group == f"{test_master_user}" else: test_name = test_item.strip().split("-")[1] test_cmd = f"ls -dl /run/salt/{test_name}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", flush=True, ) test_user = ret.stdout.strip().split()[4] print( - f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", + f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", flush=True, ) assert ret.returncode == 0 - # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER if test_item == "salt-minion": - assert test_user == "root" + assert test_user == f"{test_minion_user}" else: - assert test_user == "salt" + assert test_user == f"{test_master_user}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", flush=True, ) test_group = ret.stdout.strip().split()[5] print( - f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", + f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", flush=True, ) assert ret.returncode == 0 - # TBD DGM NEED TO CHANGE ASSERT TO CORRECT USER if test_item == "salt-minion": - assert test_group == "root" + assert test_group == f"{test_minion_user}" else: - assert test_group == "salt" + assert test_group == f"{test_master_user}" From 64e41d91666061240ddf66f694f021449385c683 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 7 Jun 2024 15:10:01 -0600 Subject: [PATCH 046/157] Updated tests for ownership and systemd enable/disable, active/inactive --- .../pytests/pkg/upgrade/test_salt_upgrade.py | 315 +----------------- 1 file changed, 16 insertions(+), 299 deletions(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index cfe7a3ef383..4f1a6cffb1b 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -99,9 +99,7 @@ def salt_test_upgrade( assert new_master_pids != old_master_pids -def _get_running_named_salt_pid( - process_name, -): # pylint: disable=logging-fstring-interpolation +def _get_running_named_salt_pid(process_name): # need to check all of command line for salt-minion, salt-master, for example: salt-minion # @@ -149,122 +147,9 @@ def test_salt_upgrade(salt_call_cli, install_salt): assert "Authentication information could" in use_lib.stderr -def test_salt_wrk( - salt_call_cli, install_salt, salt_systemd_setup -): # pylint: disable=logging-fstring-interpolation - """ - Test an upgrade working features of Salt - """ - log.warning("DGM test_salt_wrk entry") - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - print("DGM test_salt_wrk, not testing an upgrade, do not run", flush=True) - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - - # test for enable, active and user, group - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl show -p UnitFileState {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test, ret '{ret}'", - flush=True, - ) - test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", - flush=True, - ) - assert ret.returncode == 0 - assert test_enabled == "enabled" - - test_cmd = f"systemctl is-active {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl active test, ret '{ret}'", - flush=True, - ) - test_active = ret.stdout.strip().split()[2].strip('"').strip() - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl active test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", - flush=True, - ) - assert ret.returncode == 0 - assert test_active == "active" - - if "salt-api" == test_item: - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", - flush=True, - ) - test_user = ret.stdout.strip().split()[4] - print( - f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) - assert ret.returncode == 0 - assert test_user == "salt" - - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", - flush=True, - ) - test_group = ret.stdout.strip().split()[5] - print( - f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) - assert ret.returncode == 0 - assert test_group == "salt" - else: - test_name = test_item.strip().split("-")[1] - test_cmd = f"ls -dl /run/salt/{test_name}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' user test, ret '{ret}'", - flush=True, - ) - test_user = ret.stdout.strip().split()[4] - print( - f"DGM salt_systemd_setup, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_user == "root" - else: - assert test_user == "salt" - - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' group test, ret '{ret}'", - flush=True, - ) - test_group = ret.stdout.strip().split()[5] - print( - f"DGM salt_systemd_setup, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_group == "root" - else: - assert test_group == "salt" - - def test_salt_systemd_disabled_preservation( salt_call_cli, install_salt, salt_systemd_setup -): # pylint: disable=logging-fstring-interpolation +): """ Test upgrade of Salt packages preserve disabled state of systemd """ @@ -294,22 +179,14 @@ def test_salt_systemd_disabled_preservation( for test_item in test_list: test_cmd = f"systemctl show -p UnitFileState {test_item}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl disabled test, ret '{ret}'", - flush=True, - ) test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl disabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", - flush=True, - ) assert ret.returncode == 0 assert test_enabled == "disabled" def test_salt_systemd_enabled_preservation( salt_call_cli, install_salt, salt_systemd_setup -): # pylint: disable=logging-fstring-interpolation +): """ Test upgrade of Salt packages preserve enabled state of systemd """ @@ -332,22 +209,14 @@ def test_salt_systemd_enabled_preservation( for test_item in test_list: test_cmd = f"systemctl show -p UnitFileState {test_item}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test, ret '{ret}'", - flush=True, - ) test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl enabled test produced, line '{ret.stdout.strip().split('=')}', result '{test_enabled}'", - flush=True, - ) assert ret.returncode == 0 assert test_enabled == "enabled" def test_salt_systemd_inactive_preservation( salt_call_cli, install_salt, salt_systemd_setup -): # pylint: disable=logging-fstring-interpolation +): """ Test upgrade of Salt packages preserve inactive state of systemd """ @@ -377,22 +246,14 @@ def test_salt_systemd_inactive_preservation( for test_item in test_list: test_cmd = f"systemctl is-active {test_item}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl inactive test, ret '{ret}'", - flush=True, - ) test_active = ret.stdout.strip().split()[2].strip('"').strip() - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl inactive test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", - flush=True, - ) assert ret.returncode == 1 assert test_active == "inactive" def test_salt_systemd_active_preservation( salt_call_cli, install_salt, salt_systemd_setup -): # pylint: disable=logging-fstring-interpolation +): """ Test upgrade of Salt packages preserve active state of systemd """ @@ -415,22 +276,12 @@ def test_salt_systemd_active_preservation( for test_item in test_list: test_cmd = f"systemctl is-active {test_item}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl active test, ret '{ret}'", - flush=True, - ) test_active = ret.stdout.strip().split()[2].strip('"').strip() - print( - f"DGM salt_systemd_setup, '{test_item}' systemctl active test produced, line '{ret.stdout.strip().split()}', result '{test_active}'", - flush=True, - ) assert ret.returncode == 0 assert test_active == "active" -def test_salt_ownership_premission( - salt_call_cli, install_salt, test_salt_ownership_premission -): # pylint: disable=logging-fstring-interpolation +def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_setup): """ Test upgrade of Salt packages preserve existing ownership """ @@ -442,16 +293,7 @@ def test_salt_ownership_premission( # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement - test_salt_ownership_premission - - # restart and check ownership is correct - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - time.sleep(10) # allow some time for restart + salt_systemd_setup # test ownership for Minion, Master and Api test_list = ["salt-api", "salt-minion", "salt-master"] @@ -459,44 +301,20 @@ def test_salt_ownership_premission( if "salt-api" == test_item: test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", - flush=True, - ) test_user = ret.stdout.strip().split()[4] - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) assert ret.returncode == 0 assert test_user == "salt" test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", - flush=True, - ) test_group = ret.stdout.strip().split()[5] - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) assert ret.returncode == 0 assert test_group == "salt" else: test_name = test_item.strip().split("-")[1] test_cmd = f"ls -dl /run/salt/{test_name}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", - flush=True, - ) test_user = ret.stdout.strip().split()[4] - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) assert ret.returncode == 0 if test_item == "salt-minion": assert test_user == "root" @@ -504,68 +322,36 @@ def test_salt_ownership_premission( assert test_user == "salt" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", - flush=True, - ) test_group = ret.stdout.strip().split()[5] - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) assert ret.returncode == 0 if test_item == "salt-minion": assert test_group == "root" else: assert test_group == "salt" - # TBD DGM need to create master user, and minion user, change conf, restart and test ownership + # create master user, and minion user, change conf, restart and test ownership test_master_user = "horse" test_minion_user = "donkey" - ret = salt_call_cli.run("--local", "user.add", f"{test_master_user}") - print( - f"DGM test_salt_ownership_premission, '{test_master_user}' user add, ret '{ret}'", - flush=True, - ) + ret = salt_call_cli.run("--local", "user.list_users") + user_list = ret.stdout.strip().split(":")[1] - ret = salt_call_cli.run("--local", "user.add", f"{test_minion_user}") - print( - f"DGM test_salt_ownership_premission, '{test_minion_user}' user add, ret '{ret}'", - flush=True, - ) + if test_master_user not in user_list: + ret = salt_call_cli.run("--local", "user.add", f"{test_master_user}") + + if test_minion_user not in user_list: + ret = salt_call_cli.run("--local", "user.add", f"{test_minion_user}") test_string = f"\nuser: {test_master_user}\n" ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string) - print( - f"DGM test_salt_ownership_premission, file append /etc/salt/master '{test_string}', ret '{ret}'", - flush=True, - ) test_string = f"\nuser: {test_minion_user}\n" ret = salt_call_cli.run("--local", "file.append", "/etc/salt/minion", test_string) - print( - f"DGM test_salt_ownership_premission, file append /etc/salt/minion '{test_string}', ret '{ret}'", - flush=True, - ) - - ## DGM Check configuration files - ret = salt_call_cli.run("--local", "cmd.run", "cat", "/etc/salt/master") - print( - f"DGM test_salt_ownership_premission, cat /etc/salt/master, ret '{ret}'", - flush=True, - ) - - ret = salt_call_cli.run("--local", "cmd.run", "cat", "/etc/salt/minion") - print( - f"DGM test_salt_ownership_premission, cat /etc/salt/minion, ret '{ret}'", - flush=True, - ) # restart and check ownership is correct test_list = ["salt-api", "salt-minion", "salt-master"] for test_item in test_list: test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + ret = salt_call_cli.run("--local", "-l", "TRACE", "cmd.run", test_cmd) assert ret.returncode == 0 time.sleep(10) # allow some time for restart @@ -576,44 +362,20 @@ def test_salt_ownership_premission( if "salt-api" == test_item: test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", - flush=True, - ) test_user = ret.stdout.strip().split()[4] - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) assert ret.returncode == 0 assert test_user == f"{test_master_user}" test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", - flush=True, - ) test_group = ret.stdout.strip().split()[5] - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) assert ret.returncode == 0 assert test_group == f"{test_master_user}" else: test_name = test_item.strip().split("-")[1] test_cmd = f"ls -dl /run/salt/{test_name}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", - flush=True, - ) test_user = ret.stdout.strip().split()[4] - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) assert ret.returncode == 0 if test_item == "salt-minion": assert test_user == f"{test_minion_user}" @@ -621,15 +383,7 @@ def test_salt_ownership_premission( assert test_user == f"{test_master_user}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", - flush=True, - ) test_group = ret.stdout.strip().split()[5] - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) assert ret.returncode == 0 if test_item == "salt-minion": assert test_group == f"{test_minion_user}" @@ -640,55 +394,26 @@ def test_salt_ownership_premission( # pylint: disable=pointless-statement salt_test_upgrade - print( - "DGM test_salt_ownership_premission, post-upgrade", - flush=True, - ) - # test ownership for Minion, Master and Api test_list = ["salt-api", "salt-minion", "salt-master"] for test_item in test_list: if "salt-api" == test_item: test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", - flush=True, - ) test_user = ret.stdout.strip().split()[4] - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) assert ret.returncode == 0 assert test_user == f"{test_master_user}" test_cmd = f"ls -dl /run/{test_item}.pid" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", - flush=True, - ) test_group = ret.stdout.strip().split()[5] - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) assert ret.returncode == 0 assert test_group == f"{test_master_user}" else: test_name = test_item.strip().split("-")[1] test_cmd = f"ls -dl /run/salt/{test_name}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, ret '{ret}'", - flush=True, - ) test_user = ret.stdout.strip().split()[4] - print( - f"DGM test_salt_ownership_premission, '{test_item}' user test, line '{ret.stdout.strip().split()}', user '{test_user}'", - flush=True, - ) assert ret.returncode == 0 if test_item == "salt-minion": assert test_user == f"{test_minion_user}" @@ -696,15 +421,7 @@ def test_salt_ownership_premission( assert test_user == f"{test_master_user}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, ret '{ret}'", - flush=True, - ) test_group = ret.stdout.strip().split()[5] - print( - f"DGM test_salt_ownership_premission, '{test_item}' group test, line '{ret.stdout.strip().split()}', group '{test_group}'", - flush=True, - ) assert ret.returncode == 0 if test_item == "salt-minion": assert test_group == f"{test_minion_user}" From ff1fcf5e955aa67aeabb1ab4cafdd735b89eb2b8 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 10 Jun 2024 09:44:41 -0600 Subject: [PATCH 047/157] Remove left over trace debug statement --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 4f1a6cffb1b..daddd8be003 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -351,7 +351,7 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set test_list = ["salt-api", "salt-minion", "salt-master"] for test_item in test_list: test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "-l", "TRACE", "cmd.run", test_cmd) + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) assert ret.returncode == 0 time.sleep(10) # allow some time for restart From 12332188af1203657468d6f03694ceabae900c76 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 10 Jun 2024 14:10:23 -0600 Subject: [PATCH 048/157] Updated tests, cut too deep removing debug statements --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index daddd8be003..bafd4d6c2e1 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -341,6 +341,16 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set if test_minion_user not in user_list: ret = salt_call_cli.run("--local", "user.add", f"{test_minion_user}") + ret = salt_call_cli.run( + "--local", "file.comment_line", "/etc/salt/master", "^user:" + ) + assert ret.returncode == 0 + + ret = salt_call_cli.run( + "--local", "file.comment_line", "/etc/salt/minion", "^user:" + ) + assert ret.returncode == 0 + test_string = f"\nuser: {test_master_user}\n" ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string) From 70a69e9e2c2148d8bb630ae2919a6cd1ecc520fc Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 11 Jun 2024 14:13:06 -0600 Subject: [PATCH 049/157] Strip github version additions, so checking major.minor version of Salt --- tests/pytests/pkg/integration/test_version.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 24a665d4db7..070fa19e8d6 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -13,8 +13,9 @@ def test_salt_version(version, install_salt): """ test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") + stripped_version = version.split("+")[0] # strip off any git version additions actual = ret.stdout.strip().split(" ")[:2] - expected = ["salt", version] + expected = ["salt", stripped_version] assert actual == expected @@ -70,13 +71,14 @@ def test_compare_versions(version, binary, install_salt): Test compare versions """ if binary in install_salt.binary_paths: + stripped_version = version.split("+")[0] # strip off any git version additions ret = install_salt.proc.run( *install_salt.binary_paths[binary], "--version", stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) - ret.stdout.matcher.fnmatch_lines([f"*{version}*"]) + ret.stdout.matcher.fnmatch_lines([f"*{stripped_version}*"]) else: if platform.is_windows(): pytest.skip(f"Binary not available on windows: {binary}") From 89ee02f8917e3502d312e7df573c39d185692c26 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 12 Jun 2024 16:51:43 -0600 Subject: [PATCH 050/157] Updated tests --- .../pkg/integration/test_enabled_disabled.py | 18 +- .../integration/test_systemd_permissions.py | 294 +++++++++++++++++ tests/pytests/pkg/integration/test_version.py | 59 ++-- .../pytests/pkg/upgrade/test_salt_upgrade.py | 295 ------------------ 4 files changed, 338 insertions(+), 328 deletions(-) create mode 100644 tests/pytests/pkg/integration/test_systemd_permissions.py diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 99097b187ee..4618e3c83b3 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -3,10 +3,12 @@ from pytestskipmarkers.utils import platform @pytest.mark.skip_on_windows(reason="Linux test only") -def test_services(install_salt, salt_cli, salt_minion): +def test_services(install_salt, salt_cli, salt_minion, salt_call_cli): """ Check if Services are enabled/disabled """ + install_salt.install() + services_disabled = [] services_enabled = [] if install_salt.distro_id in ("ubuntu", "debian"): @@ -29,9 +31,15 @@ def test_services(install_salt, salt_cli, salt_minion): pytest.fail(f"Don't know how to handle os_family={install_salt.distro_id}") for service in services_enabled: - ret = salt_cli.run("service.enabled", service, minion_tgt=salt_minion.id) - assert "true" in ret.stdout + test_cmd = f"systemctl show -p UnitFileState {service}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + assert ret.returncode == 0 + assert test_enabled == "enabled" for service in services_disabled: - ret = salt_cli.run("service.disabled", service, minion_tgt=salt_minion.id) - assert "true" in ret.stdout + test_cmd = f"systemctl show -p UnitFileState {service}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + assert ret.returncode == 0 + assert test_enabled == "disabled" diff --git a/tests/pytests/pkg/integration/test_systemd_permissions.py b/tests/pytests/pkg/integration/test_systemd_permissions.py new file mode 100644 index 00000000000..b5576b75e14 --- /dev/null +++ b/tests/pytests/pkg/integration/test_systemd_permissions.py @@ -0,0 +1,294 @@ +import time + +import pytest + +pytestmark = [pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family")] + + +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + +def test_salt_systemd_disabled_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): + """ + Test upgrade of Salt packages preserve disabled state of systemd + """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # ensure known state, disabled + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl disable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test + # pylint: disable=pointless-statement + install_salt.install(upgrade=True) + time.sleep(60) # give it some time + + # test for disabled systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + assert ret.returncode == 0 + assert test_enabled == "disabled" + + +def test_salt_systemd_enabled_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): + """ + Test upgrade of Salt packages preserve enabled state of systemd + """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test + # pylint: disable=pointless-statement + install_salt.install(upgrade=True) + time.sleep(60) # give it some time + + # test for enabled systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + assert ret.returncode == 0 + assert test_enabled == "enabled" + + +def test_salt_systemd_inactive_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): + """ + Test upgrade of Salt packages preserve inactive state of systemd + """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # ensure known state, disabled + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl stop {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test + # pylint: disable=pointless-statement + install_salt.install(upgrade=True) + time.sleep(60) # give it some time + + # test for inactive systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl is-active {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_active = ret.stdout.strip().split()[2].strip('"').strip() + assert ret.returncode == 1 + assert test_active == "inactive" + + +def test_salt_systemd_active_preservation( + salt_call_cli, install_salt, salt_systemd_setup +): + """ + Test upgrade of Salt packages preserve active state of systemd + """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test + # pylint: disable=pointless-statement + install_salt.install(upgrade=True) + time.sleep(60) # give it some time + + # test for active systemd state + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl is-active {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_active = ret.stdout.strip().split()[2].strip('"').strip() + assert ret.returncode == 0 + assert test_active == "active" + + +def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_setup): + """ + Test upgrade of Salt packages preserve existing ownership + """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + + # test ownership for Minion, Master and Api + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_user = ret.stdout.strip().split()[4] + assert ret.returncode == 0 + assert test_user == "salt" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_group = ret.stdout.strip().split()[5] + assert ret.returncode == 0 + assert test_group == "salt" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_user = ret.stdout.strip().split()[4] + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_user == "root" + else: + assert test_user == "salt" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_group = ret.stdout.strip().split()[5] + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_group == "root" + else: + assert test_group == "salt" + + # create master user, and minion user, change conf, restart and test ownership + test_master_user = "horse" + test_minion_user = "donkey" + ret = salt_call_cli.run("--local", "user.list_users") + user_list = ret.stdout.strip().split(":")[1] + + if test_master_user not in user_list: + ret = salt_call_cli.run("--local", "user.add", f"{test_master_user}") + + if test_minion_user not in user_list: + ret = salt_call_cli.run("--local", "user.add", f"{test_minion_user}") + + ret = salt_call_cli.run( + "--local", "file.comment_line", "/etc/salt/master", "^user:" + ) + assert ret.returncode == 0 + + ret = salt_call_cli.run( + "--local", "file.comment_line", "/etc/salt/minion", "^user:" + ) + assert ret.returncode == 0 + + test_string = f"\nuser: {test_master_user}\n" + ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string) + + test_string = f"\nuser: {test_minion_user}\n" + ret = salt_call_cli.run("--local", "file.append", "/etc/salt/minion", test_string) + + # restart and check ownership is correct + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + + time.sleep(10) # allow some time for restart + + # test ownership for Minion, Master and Api - horse and donkey + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_user = ret.stdout.strip().split()[4] + assert ret.returncode == 0 + assert test_user == f"{test_master_user}" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_group = ret.stdout.strip().split()[5] + assert ret.returncode == 0 + assert test_group == f"{test_master_user}" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_user = ret.stdout.strip().split()[4] + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_user == f"{test_minion_user}" + else: + assert test_user == f"{test_master_user}" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_group = ret.stdout.strip().split()[5] + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_group == f"{test_minion_user}" + else: + assert test_group == f"{test_master_user}" + + # Upgrade Salt (inc. minion, master, etc.) from previous version and test + # pylint: disable=pointless-statement + install_salt.install(upgrade=True) + time.sleep(60) # give it some time + + # test ownership for Minion, Master and Api + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + if "salt-api" == test_item: + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_user = ret.stdout.strip().split()[4] + assert ret.returncode == 0 + assert test_user == f"{test_master_user}" + + test_cmd = f"ls -dl /run/{test_item}.pid" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_group = ret.stdout.strip().split()[5] + assert ret.returncode == 0 + assert test_group == f"{test_master_user}" + else: + test_name = test_item.strip().split("-")[1] + test_cmd = f"ls -dl /run/salt/{test_name}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_user = ret.stdout.strip().split()[4] + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_user == f"{test_minion_user}" + else: + assert test_user == f"{test_master_user}" + + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_group = ret.stdout.strip().split()[5] + assert ret.returncode == 0 + if test_item == "salt-minion": + assert test_group == f"{test_minion_user}" + else: + assert test_group == f"{test_master_user}" diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 070fa19e8d6..aa59b5674ad 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -6,16 +6,42 @@ import pytest from pytestskipmarkers.utils import platform +@pytest.mark.skip_on_windows +def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): + """ + Test running test.versions_report on minion + """ + # Make sure the minion is running + assert salt_minion.is_running() + + # Make sure we can ping the minion ... + ret = salt_cli.run( + "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 + ) + assert ret.returncode == 0 + assert ret.data is True + ret = salt_cli.run( + "--hard-crash", + "--failhard", + "--timeout=240", + "test.versions_report", + minion_tgt=salt_minion.id, + _timeout=240, + ) + ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) + + @pytest.mark.skip_on_windows def test_salt_version(version, install_salt): """ Test version output from salt --version """ + install_salt.install() + test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") - stripped_version = version.split("+")[0] # strip off any git version additions actual = ret.stdout.strip().split(" ")[:2] - expected = ["salt", stripped_version] + expected = ["salt", version] assert actual == expected @@ -39,30 +65,6 @@ def test_salt_versions_report_master(install_salt): ret.stdout.matcher.fnmatch_lines([f"*{py_version}*"]) -@pytest.mark.skip_on_windows -def test_salt_versions_report_minion(salt_cli, salt_minion): - """ - Test running test.versions_report on minion - """ - # Make sure the minion is running - assert salt_minion.is_running() - # Make sure we can ping the minion ... - ret = salt_cli.run( - "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 - ) - assert ret.returncode == 0 - assert ret.data is True - ret = salt_cli.run( - "--hard-crash", - "--failhard", - "--timeout=240", - "test.versions_report", - minion_tgt=salt_minion.id, - _timeout=240, - ) - ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) - - @pytest.mark.parametrize( "binary", ["master", "cloud", "syndic", "minion", "call", "api"] ) @@ -71,14 +73,15 @@ def test_compare_versions(version, binary, install_salt): Test compare versions """ if binary in install_salt.binary_paths: - stripped_version = version.split("+")[0] # strip off any git version additions + install_salt.install() + ret = install_salt.proc.run( *install_salt.binary_paths[binary], "--version", stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) - ret.stdout.matcher.fnmatch_lines([f"*{stripped_version}*"]) + ret.stdout.matcher.fnmatch_lines([f"*{version}*"]) else: if platform.is_windows(): pytest.skip(f"Binary not available on windows: {binary}") diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index bafd4d6c2e1..713484c6f08 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -1,4 +1,3 @@ -import logging import time import packaging.version @@ -6,8 +5,6 @@ import psutil import pytest from pytestskipmarkers.utils import platform -log = logging.getLogger(__name__) - pytestmark = [pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family")] @@ -145,295 +142,3 @@ def test_salt_upgrade(salt_call_cli, install_salt): # test pip install after an upgrade use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr - - -def test_salt_systemd_disabled_preservation( - salt_call_cli, install_salt, salt_systemd_setup -): - """ - Test upgrade of Salt packages preserve disabled state of systemd - """ - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - - # ensure known state, disabled - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl disable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - # perform Salt package upgrade test - # pylint: disable=pointless-statement - salt_test_upgrade - - # test for disabled systemd state - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl show -p UnitFileState {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - assert ret.returncode == 0 - assert test_enabled == "disabled" - - -def test_salt_systemd_enabled_preservation( - salt_call_cli, install_salt, salt_systemd_setup -): - """ - Test upgrade of Salt packages preserve enabled state of systemd - """ - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - - # perform Salt package upgrade test - # pylint: disable=pointless-statement - salt_test_upgrade - - # test for enabled systemd state - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl show -p UnitFileState {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - assert ret.returncode == 0 - assert test_enabled == "enabled" - - -def test_salt_systemd_inactive_preservation( - salt_call_cli, install_salt, salt_systemd_setup -): - """ - Test upgrade of Salt packages preserve inactive state of systemd - """ - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - - # ensure known state, disabled - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl stop {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - # perform Salt package upgrade test - # pylint: disable=pointless-statement - salt_test_upgrade - - # test for inactive systemd state - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl is-active {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_active = ret.stdout.strip().split()[2].strip('"').strip() - assert ret.returncode == 1 - assert test_active == "inactive" - - -def test_salt_systemd_active_preservation( - salt_call_cli, install_salt, salt_systemd_setup -): - """ - Test upgrade of Salt packages preserve active state of systemd - """ - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - - # perform Salt package upgrade test - # pylint: disable=pointless-statement - salt_test_upgrade - - # test for active systemd state - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl is-active {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_active = ret.stdout.strip().split()[2].strip('"').strip() - assert ret.returncode == 0 - assert test_active == "active" - - -def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_setup): - """ - Test upgrade of Salt packages preserve existing ownership - """ - if not install_salt.upgrade: - pytest.skip("Not testing an upgrade, do not run") - - if install_salt.relenv: - original_py_version = install_salt.package_python_version() - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - - # test ownership for Minion, Master and Api - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - if "salt-api" == test_item: - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_user = ret.stdout.strip().split()[4] - assert ret.returncode == 0 - assert test_user == "salt" - - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_group = ret.stdout.strip().split()[5] - assert ret.returncode == 0 - assert test_group == "salt" - else: - test_name = test_item.strip().split("-")[1] - test_cmd = f"ls -dl /run/salt/{test_name}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_user = ret.stdout.strip().split()[4] - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_user == "root" - else: - assert test_user == "salt" - - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_group = ret.stdout.strip().split()[5] - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_group == "root" - else: - assert test_group == "salt" - - # create master user, and minion user, change conf, restart and test ownership - test_master_user = "horse" - test_minion_user = "donkey" - ret = salt_call_cli.run("--local", "user.list_users") - user_list = ret.stdout.strip().split(":")[1] - - if test_master_user not in user_list: - ret = salt_call_cli.run("--local", "user.add", f"{test_master_user}") - - if test_minion_user not in user_list: - ret = salt_call_cli.run("--local", "user.add", f"{test_minion_user}") - - ret = salt_call_cli.run( - "--local", "file.comment_line", "/etc/salt/master", "^user:" - ) - assert ret.returncode == 0 - - ret = salt_call_cli.run( - "--local", "file.comment_line", "/etc/salt/minion", "^user:" - ) - assert ret.returncode == 0 - - test_string = f"\nuser: {test_master_user}\n" - ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string) - - test_string = f"\nuser: {test_minion_user}\n" - ret = salt_call_cli.run("--local", "file.append", "/etc/salt/minion", test_string) - - # restart and check ownership is correct - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - time.sleep(10) # allow some time for restart - - # test ownership for Minion, Master and Api - horse and donkey - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - if "salt-api" == test_item: - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_user = ret.stdout.strip().split()[4] - assert ret.returncode == 0 - assert test_user == f"{test_master_user}" - - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_group = ret.stdout.strip().split()[5] - assert ret.returncode == 0 - assert test_group == f"{test_master_user}" - else: - test_name = test_item.strip().split("-")[1] - test_cmd = f"ls -dl /run/salt/{test_name}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_user = ret.stdout.strip().split()[4] - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_user == f"{test_minion_user}" - else: - assert test_user == f"{test_master_user}" - - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_group = ret.stdout.strip().split()[5] - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_group == f"{test_minion_user}" - else: - assert test_group == f"{test_master_user}" - - # perform Salt package upgrade test - # pylint: disable=pointless-statement - salt_test_upgrade - - # test ownership for Minion, Master and Api - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - if "salt-api" == test_item: - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_user = ret.stdout.strip().split()[4] - assert ret.returncode == 0 - assert test_user == f"{test_master_user}" - - test_cmd = f"ls -dl /run/{test_item}.pid" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_group = ret.stdout.strip().split()[5] - assert ret.returncode == 0 - assert test_group == f"{test_master_user}" - else: - test_name = test_item.strip().split("-")[1] - test_cmd = f"ls -dl /run/salt/{test_name}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_user = ret.stdout.strip().split()[4] - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_user == f"{test_minion_user}" - else: - assert test_user == f"{test_master_user}" - - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_group = ret.stdout.strip().split()[5] - assert ret.returncode == 0 - if test_item == "salt-minion": - assert test_group == f"{test_minion_user}" - else: - assert test_group == f"{test_master_user}" From c21f67b9154e81a661ff90a8b64860ed5f594b54 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 13 Jun 2024 11:27:59 -0600 Subject: [PATCH 051/157] Updated tests --- .../pytests/pkg/integration/test_salt_user.py | 14 ++--- .../integration/test_systemd_permissions.py | 15 +++++ tests/pytests/pkg/integration/test_version.py | 56 ++++++++++--------- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 834fd399121..1f43fd5490e 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -11,13 +11,13 @@ from saltfactories.utils.tempfiles import temp_directory pytestmark = [ pytest.mark.skip_on_windows, pytest.mark.skip_on_darwin, - pytest.mark.skipif( - True, - reason=( - "Package permissions are getting reworked in " - "https://github.com/saltstack/salt/pull/66218" - ), - ), + ## DGM pytest.mark.skipif( + ## DGM True, + ## DGM reason=( + ## DGM "Package permissions are getting reworked in " + ## DGM "https://github.com/saltstack/salt/pull/66218" + ## DGM ), + ## DGM ), ] diff --git a/tests/pytests/pkg/integration/test_systemd_permissions.py b/tests/pytests/pkg/integration/test_systemd_permissions.py index b5576b75e14..0a7bf6c158a 100644 --- a/tests/pytests/pkg/integration/test_systemd_permissions.py +++ b/tests/pytests/pkg/integration/test_systemd_permissions.py @@ -34,6 +34,9 @@ def test_salt_systemd_disabled_preservation( """ Test upgrade of Salt packages preserve disabled state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -66,6 +69,9 @@ def test_salt_systemd_enabled_preservation( """ Test upgrade of Salt packages preserve enabled state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -91,6 +97,9 @@ def test_salt_systemd_inactive_preservation( """ Test upgrade of Salt packages preserve inactive state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -123,6 +132,9 @@ def test_salt_systemd_active_preservation( """ Test upgrade of Salt packages preserve active state of systemd """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup @@ -146,6 +158,9 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set """ Test upgrade of Salt packages preserve existing ownership """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + # setup systemd to enabled and active for Salt packages # pylint: disable=pointless-statement salt_systemd_setup diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index aa59b5674ad..d59377c31d6 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -6,37 +6,13 @@ import pytest from pytestskipmarkers.utils import platform -@pytest.mark.skip_on_windows -def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): - """ - Test running test.versions_report on minion - """ - # Make sure the minion is running - assert salt_minion.is_running() - - # Make sure we can ping the minion ... - ret = salt_cli.run( - "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 - ) - assert ret.returncode == 0 - assert ret.data is True - ret = salt_cli.run( - "--hard-crash", - "--failhard", - "--timeout=240", - "test.versions_report", - minion_tgt=salt_minion.id, - _timeout=240, - ) - ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) - - @pytest.mark.skip_on_windows def test_salt_version(version, install_salt): """ Test version output from salt --version """ - install_salt.install() + if install_salt.upgrade: + install_salt.install() test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") @@ -65,6 +41,31 @@ def test_salt_versions_report_master(install_salt): ret.stdout.matcher.fnmatch_lines([f"*{py_version}*"]) +@pytest.mark.skip_on_windows +def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): + """ + Test running test.versions_report on minion + """ + # Make sure the minion is running + assert salt_minion.is_running() + + # Make sure we can ping the minion ... + ret = salt_cli.run( + "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 + ) + assert ret.returncode == 0 + assert ret.data is True + ret = salt_cli.run( + "--hard-crash", + "--failhard", + "--timeout=240", + "test.versions_report", + minion_tgt=salt_minion.id, + _timeout=240, + ) + ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) + + @pytest.mark.parametrize( "binary", ["master", "cloud", "syndic", "minion", "call", "api"] ) @@ -73,7 +74,8 @@ def test_compare_versions(version, binary, install_salt): Test compare versions """ if binary in install_salt.binary_paths: - install_salt.install() + if install_salt.upgrade: + install_salt.install() ret = install_salt.proc.run( *install_salt.binary_paths[binary], From 82070dc46d82772e6d9e78ed1c84dc700bb6e3c7 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 13 Jun 2024 14:54:37 -0600 Subject: [PATCH 052/157] Cleanup of debug, and revision of tests --- pkg/debian/salt-api.postinst | 2 - pkg/debian/salt-api.preinst | 4 -- pkg/debian/salt-cloud.postinst | 2 - pkg/debian/salt-master.postinst | 2 - pkg/debian/salt-master.preinst | 5 -- pkg/debian/salt-minion.postinst | 2 - pkg/debian/salt-minion.preinst | 4 -- .../pkg/downgrade/test_salt_downgrade.py | 65 ------------------- .../pkg/integration/test_enabled_disabled.py | 5 +- .../pytests/pkg/integration/test_salt_user.py | 10 +-- .../test_systemd_permissions.py | 0 tests/support/pkg.py | 9 ++- 12 files changed, 8 insertions(+), 102 deletions(-) rename tests/pytests/pkg/{integration => upgrade}/test_systemd_permissions.py (100%) diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 3cf37a1675d..923d8e65cf2 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -2,8 +2,6 @@ . /usr/share/debconf/confmodule -echo "DGM salt-api.postinst dollar $@" - case "$1" in configure) db_get salt-api/user diff --git a/pkg/debian/salt-api.preinst b/pkg/debian/salt-api.preinst index 70a7002b73b..b04068ac18d 100644 --- a/pkg/debian/salt-api.preinst +++ b/pkg/debian/salt-api.preinst @@ -2,10 +2,6 @@ . /usr/share/debconf/confmodule -## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership - -echo "DGM salt-api.preinst dollar $@" - case "$1" in upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index 5e07309e14a..597584cf548 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -2,8 +2,6 @@ . /usr/share/debconf/confmodule -echo "DGM salt-cloud.postinst dollar $@" - case "$1" in configure) db_get salt-master/user diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index cdf85d13856..37d2c667672 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -2,8 +2,6 @@ . /usr/share/debconf/confmodule -echo "DGM salt-master.postinst dollar $@" - case "$1" in configure) db_get salt-master/user diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index d49664588de..3c31a65c430 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -2,11 +2,6 @@ . /usr/share/debconf/confmodule -## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership - -echo "DGM salt-master.preinst dollar $@" - - case "$1" in install) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index f6f7940e944..94c61b9300e 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -2,8 +2,6 @@ . /usr/share/debconf/confmodule -echo "DGM salt-minion.postinst dollar $@" - case "$1" in configure) db_get salt-minion/user diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index b6281b6a56b..cbbf1e23ad9 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -2,10 +2,6 @@ . /usr/share/debconf/confmodule -## TBD DGM need to allow for salt-minion having been installed previously and need to allow for it's ownership - -echo "DGM salt-minion.preinst dollar $@" - case "$1" in upgrade) [ -z "$SALT_HOME" ] && SALT_HOME=/opt/saltstack/salt diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index bf051d27028..ccc89481b01 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -1,7 +1,5 @@ import packaging.version import psutil - -## DGM import pytest from pytestskipmarkers.utils import platform @@ -89,66 +87,3 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): # test pip install after a downgrade use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) assert "Authentication information could" in use_lib.stderr - - -## DGM @pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family") -## DGM def test_salt_downgrade_master(install_salt): -## DGM """ -## DGM Test an downgrade of Salt Master. -## DGM """ -## DGM if not install_salt.downgrade: -## DGM pytest.skip("Not testing a downgrade, do not run") -## DGM -## DGM is_downgrade_to_relenv = packaging.version.parse( -## DGM install_salt.prev_version -## DGM ) >= packaging.version.parse("3006.0") -## DGM -## DGM if is_downgrade_to_relenv: -## DGM original_py_version = install_salt.package_python_version() -## DGM -## DGM # Verify current install version is setup correctly and works -## DGM bin_file = "salt" -## DGM ret = install_salt.proc.run(bin_file, "--version") -## DGM assert ret.returncode == 0 -## DGM assert packaging.version.parse( -## DGM ret.stdout.strip().split()[1] -## DGM ) == packaging.version.parse(install_salt.artifact_version) -## DGM -## DGM # Verify there is a running master by getting its PID -## DGM salt_name = "salt" -## DGM process_name = "salt-master" -## DGM -## DGM old_pid = [] -## DGM -## DGM # psutil process name only returning first part of the command '/opt/saltstack/' -## DGM # need to check all of command line for salt-minion -## DGM # ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-master EventPublisher'] -## DGM # and psutil is only returning the salt-minion once -## DGM for proc in psutil.process_iter(): -## DGM if salt_name in proc.name(): -## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) -## DGM if process_name in cmdl_strg: -## DGM old_pid.append(proc.pid) -## DGM -## DGM assert old_pid -## DGM -## DGM # Downgrade Salt to the previous version and test -## DGM install_salt.install(downgrade=True) -## DGM -## DGM # Verify there is a new running master by getting its PID and comparing it -## DGM # with the PID from before the upgrade -## DGM new_pid = [] -## DGM for proc in psutil.process_iter(): -## DGM if salt_name in proc.name(): -## DGM cmdl_strg = " ".join(str(element) for element in proc.cmdline()) -## DGM if process_name in cmdl_strg: -## DGM new_pid.append(proc.pid) -## DGM -## DGM assert new_pid -## DGM assert new_pid != old_pid -## DGM -## DGM ret = install_salt.proc.run(bin_file, "--version") -## DGM assert ret.returncode == 0 -## DGM assert packaging.version.parse( -## DGM ret.stdout.strip().split()[1] -## DGM ) < packaging.version.parse(install_salt.artifact_version) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 4618e3c83b3..ae6cf51362b 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -3,11 +3,12 @@ from pytestskipmarkers.utils import platform @pytest.mark.skip_on_windows(reason="Linux test only") -def test_services(install_salt, salt_cli, salt_minion, salt_call_cli): +def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled """ - install_salt.install() + if not install_salt.upgrade: + install_salt.install() services_disabled = [] services_enabled = [] diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 1f43fd5490e..076a43963ec 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -9,15 +9,7 @@ import pytest from saltfactories.utils.tempfiles import temp_directory pytestmark = [ - pytest.mark.skip_on_windows, - pytest.mark.skip_on_darwin, - ## DGM pytest.mark.skipif( - ## DGM True, - ## DGM reason=( - ## DGM "Package permissions are getting reworked in " - ## DGM "https://github.com/saltstack/salt/pull/66218" - ## DGM ), - ## DGM ), + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_systemd_permissions.py b/tests/pytests/pkg/upgrade/test_systemd_permissions.py similarity index 100% rename from tests/pytests/pkg/integration/test_systemd_permissions.py rename to tests/pytests/pkg/upgrade/test_systemd_permissions.py diff --git a/tests/support/pkg.py b/tests/support/pkg.py index fd02267b86d..a5803a67bbb 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -484,11 +484,10 @@ class SaltPkgInstall: ret = self.proc.run("installer", "-pkg", str(pkg), "-target", "/") self._check_retcode(ret) - ## DGM TBD why stop service on upgrade ??? - if not upgrade: - # Stop the service installed by the installer - self.proc.run("launchctl", "disable", f"system/{service_name}") - self.proc.run("launchctl", "bootout", "system", str(plist_file)) + ## DGM TBD ? if not upgrade: + # Stop the service installed by the installer + self.proc.run("launchctl", "disable", f"system/{service_name}") + self.proc.run("launchctl", "bootout", "system", str(plist_file)) elif upgrade: env = os.environ.copy() From 0a8bc5aeb0643a023229d440f3304791c4bcf74a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 14 Jun 2024 10:11:40 -0600 Subject: [PATCH 053/157] Backing out changes to discover cause of FileNotFoundError messages --- .../pytests/pkg/integration/test_enabled_disabled.py | 4 ++-- tests/pytests/pkg/integration/test_salt_user.py | 7 +++++++ tests/pytests/pkg/integration/test_version.py | 8 ++++---- tests/pytests/pkg/upgrade/test_systemd_permissions.py | 11 ++++++++++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index ae6cf51362b..6074dff1207 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -7,8 +7,8 @@ def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled """ - if not install_salt.upgrade: - install_salt.install() + ## DGM if not install_salt.upgrade: + ## DGM install_salt.install() services_disabled = [] services_enabled = [] diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 076a43963ec..61508ca993b 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -10,6 +10,13 @@ from saltfactories.utils.tempfiles import temp_directory pytestmark = [ pytest.mark.skip_unless_on_linux, + pytest.mark.skipif( + True, + reason=( + "Package permissions are getting reworked in " + "https://github.com/saltstack/salt/pull/66218" + ), + ), ] diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index d59377c31d6..a84527cbe42 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -11,8 +11,8 @@ def test_salt_version(version, install_salt): """ Test version output from salt --version """ - if install_salt.upgrade: - install_salt.install() + ## DGM if install_salt.upgrade: + ## DGM install_salt.install() test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") @@ -74,8 +74,8 @@ def test_compare_versions(version, binary, install_salt): Test compare versions """ if binary in install_salt.binary_paths: - if install_salt.upgrade: - install_salt.install() + ## DGM if install_salt.upgrade: + ## DGM install_salt.install() ret = install_salt.proc.run( *install_salt.binary_paths[binary], diff --git a/tests/pytests/pkg/upgrade/test_systemd_permissions.py b/tests/pytests/pkg/upgrade/test_systemd_permissions.py index 0a7bf6c158a..33ccb635a38 100644 --- a/tests/pytests/pkg/upgrade/test_systemd_permissions.py +++ b/tests/pytests/pkg/upgrade/test_systemd_permissions.py @@ -2,7 +2,16 @@ import time import pytest -pytestmark = [pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family")] +pytestmark = [ + pytest.mark.skip_unless_on_linux(reason="Only supported on Linux family"), + pytest.mark.skipif( + True, + reason=( + "Package permissions are getting reworked in " + "https://github.com/saltstack/salt/pull/66218" + ), + ), +] @pytest.fixture From 693053d684eb0b64959c3f7d45ae8d2de0e76fba Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 14 Jun 2024 13:14:28 -0600 Subject: [PATCH 054/157] Removed more support for classic packages, adjust handling of '--no-install' --- noxfile.py | 15 --------------- tests/pytests/pkg/conftest.py | 8 +------- .../pkg/integration/test_enabled_disabled.py | 4 ++-- tests/pytests/pkg/integration/test_version.py | 8 ++++---- tests/support/pkg.py | 3 +++ 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/noxfile.py b/noxfile.py index 48d40672f3e..dff60827d70 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1833,18 +1833,10 @@ def ci_test_onedir_pkgs(session): "--upgrade", "--no-uninstall", ], - "upgrade-classic": [ - "--upgrade", - "--no-uninstall", - ], "downgrade": [ "--downgrade", "--no-uninstall", ], - "downgrade-classic": [ - "--downgrade", - "--no-uninstall", - ], "download-pkgs": [ "--download-pkgs", ], @@ -1875,9 +1867,6 @@ def ci_test_onedir_pkgs(session): "PKG_TEST_TYPE": chunk, } - if chunk in ("upgrade-classic", "downgrade-classic"): - cmd_args.append("--classic") - pytest_args = ( common_pytest_args[:] + cmd_args[:] @@ -1945,8 +1934,6 @@ def ci_test_onedir_pkgs(session): ) if "downgrade" in chunk: pytest_args.append("--use-prev-version") - if chunk in ("upgrade-classic", "downgrade-classic"): - pytest_args.append("--classic") if append_tests_path: pytest_args.append("tests/pytests/pkg/") try: @@ -1969,8 +1956,6 @@ def ci_test_onedir_pkgs(session): ) if "downgrade" in chunk: pytest_args.append("--use-prev-version") - if chunk in ("upgrade-classic", "downgrade-classic"): - pytest_args.append("--classic") if append_tests_path: pytest_args.append("tests/pytests/pkg/") _pytest( diff --git a/tests/pytests/pkg/conftest.py b/tests/pytests/pkg/conftest.py index 59d02c3a60d..6cbed8ab590 100644 --- a/tests/pytests/pkg/conftest.py +++ b/tests/pytests/pkg/conftest.py @@ -90,12 +90,6 @@ def pytest_addoption(parser): action="store_true", help="Do not uninstall salt packages after test run is complete", ) - test_selection_group.addoption( - "--classic", - default=False, - action="store_true", - help="Test an upgrade from the classic packages.", - ) test_selection_group.addoption( "--prev-version", action="store", @@ -231,7 +225,7 @@ def install_salt(request, salt_factories_root_dir): downgrade=request.config.getoption("--downgrade"), no_uninstall=request.config.getoption("--no-uninstall"), no_install=request.config.getoption("--no-install"), - classic=request.config.getoption("--classic"), + ## DGM classic=request.config.getoption("--classic"), prev_version=request.config.getoption("--prev-version"), use_prev_version=request.config.getoption("--use-prev-version"), ) as fixture: diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 6074dff1207..ae6cf51362b 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -7,8 +7,8 @@ def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled """ - ## DGM if not install_salt.upgrade: - ## DGM install_salt.install() + if not install_salt.upgrade: + install_salt.install() services_disabled = [] services_enabled = [] diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index a84527cbe42..d59377c31d6 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -11,8 +11,8 @@ def test_salt_version(version, install_salt): """ Test version output from salt --version """ - ## DGM if install_salt.upgrade: - ## DGM install_salt.install() + if install_salt.upgrade: + install_salt.install() test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") @@ -74,8 +74,8 @@ def test_compare_versions(version, binary, install_salt): Test compare versions """ if binary in install_salt.binary_paths: - ## DGM if install_salt.upgrade: - ## DGM install_salt.install() + if install_salt.upgrade: + install_salt.install() ret = install_salt.proc.run( *install_salt.binary_paths[binary], diff --git a/tests/support/pkg.py b/tests/support/pkg.py index a5803a67bbb..393e70e7b67 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -1009,7 +1009,10 @@ class SaltPkgInstall: if self.upgrade: self.install_previous() else: + # assume downgrade, since no_install only used in these two cases self.install() + else: + self.install() return self def __exit__(self, *_): From c48a3e412cc3aceff2f8b63fc658de4a9ea09458 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 14 Jun 2024 15:48:10 -0600 Subject: [PATCH 055/157] Updated tests --- tests/pytests/pkg/conftest.py | 1 - tests/support/pkg.py | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/pytests/pkg/conftest.py b/tests/pytests/pkg/conftest.py index 6cbed8ab590..b5596bb4371 100644 --- a/tests/pytests/pkg/conftest.py +++ b/tests/pytests/pkg/conftest.py @@ -225,7 +225,6 @@ def install_salt(request, salt_factories_root_dir): downgrade=request.config.getoption("--downgrade"), no_uninstall=request.config.getoption("--no-uninstall"), no_install=request.config.getoption("--no-install"), - ## DGM classic=request.config.getoption("--classic"), prev_version=request.config.getoption("--prev-version"), use_prev_version=request.config.getoption("--use-prev-version"), ) as fixture: diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 393e70e7b67..0d2af4abcf2 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -1005,14 +1005,19 @@ class SaltPkgInstall: if platform.is_windows(): self.update_process_path() - if not self.no_install: - if self.upgrade: - self.install_previous() - else: - # assume downgrade, since no_install only used in these two cases - self.install() - else: - self.install() + ## DGM if not self.no_install: + ## DGM if self.upgrade: + ## DGM self.install_previous() + ## DGM else: + ## DGM # assume downgrade, since no_install only used in these two cases + ## DGM self.install() + ## DGM else: + ## DGM self.install() + + # DGM Hate the use of negative flags + # if flag set, use previous version of Salt. + if self.no_install: + self.install_previous() return self def __exit__(self, *_): From 761c576bf5612166cbf0e68dc4bff511ea20b549 Mon Sep 17 00:00:00 2001 From: dmurphy18 Date: Tue, 18 Jun 2024 15:23:59 -0600 Subject: [PATCH 056/157] Rearranging tests --- tests/pytests/pkg/upgrade/test_salt_upgrade.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 713484c6f08..79e7c259fb4 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -119,6 +119,9 @@ def test_salt_upgrade(salt_call_cli, install_salt): """ Test an upgrade of Salt, Minion and Master """ + if not install_salt.upgrade: + pytest.skip("Not testing an upgrade, do not run") + if install_salt.relenv: original_py_version = install_salt.package_python_version() From e2bb8361cfa68cf9fdd7cb0d2fcbfbdb523c397d Mon Sep 17 00:00:00 2001 From: dmurphy18 Date: Tue, 18 Jun 2024 15:25:00 -0600 Subject: [PATCH 057/157] Revert change --- tests/support/pkg.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 0d2af4abcf2..d8b2dea8aab 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -1005,19 +1005,15 @@ class SaltPkgInstall: if platform.is_windows(): self.update_process_path() - ## DGM if not self.no_install: - ## DGM if self.upgrade: - ## DGM self.install_previous() - ## DGM else: - ## DGM # assume downgrade, since no_install only used in these two cases - ## DGM self.install() - ## DGM else: - ## DGM self.install() + if not self.no_install: + if self.upgrade: + self.install_previous() + else: + # assume downgrade, since no_install only used in these two cases + self.install() + else: + self.install() - # DGM Hate the use of negative flags - # if flag set, use previous version of Salt. - if self.no_install: - self.install_previous() return self def __exit__(self, *_): From 6743cefc1cf4cdad79ff5201d888b5b13b6794fb Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 19 Jun 2024 16:12:50 -0600 Subject: [PATCH 058/157] Revised tests --- .../pytests/pkg/integration/test_salt_user.py | 11 +------- tests/pytests/pkg/integration/test_version.py | 17 ++++++++++--- .../pkg/upgrade/test_systemd_permissions.py | 25 +++++++++++++++++++ tests/support/pkg.py | 1 - 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 61508ca993b..347215e25ca 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -8,16 +8,7 @@ import psutil import pytest from saltfactories.utils.tempfiles import temp_directory -pytestmark = [ - pytest.mark.skip_unless_on_linux, - pytest.mark.skipif( - True, - reason=( - "Package permissions are getting reworked in " - "https://github.com/saltstack/salt/pull/66218" - ), - ), -] +pytestmark = [pytest.mark.skip_unless_on_linux] @pytest.fixture diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index d59377c31d6..c484684b9d5 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -11,12 +11,20 @@ def test_salt_version(version, install_salt): """ Test version output from salt --version """ - if install_salt.upgrade: - install_salt.install() - + actual = [] test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") - actual = ret.stdout.strip().split(" ")[:2] + actual_ver = ret.stdout.strip().split(" ")[:2] + actual_ver_salt = actual_ver[1] # get salt version + if "+" in actual_ver_salt: + actual_ver_salt_stripped = actual_ver_salt.split("+")[ + 0 + ] # strip any git versioning + actual.append(actual_ver[0]) + actual.append(actual_ver_salt_stripped) + else: + pytest.skip("Not testing a non-release build artifact, do not run") + expected = ["salt", version] assert actual == expected @@ -28,6 +36,7 @@ def test_salt_versions_report_master(install_salt): """ if not install_salt.relenv and not install_salt.classic: pytest.skip("Unable to get the python version dynamically from tiamat builds") + test_bin = os.path.join(*install_salt.binary_paths["master"]) python_bin = os.path.join(*install_salt.binary_paths["python"]) ret = install_salt.proc.run(test_bin, "--versions-report") diff --git a/tests/pytests/pkg/upgrade/test_systemd_permissions.py b/tests/pytests/pkg/upgrade/test_systemd_permissions.py index 33ccb635a38..12afeb5f656 100644 --- a/tests/pytests/pkg/upgrade/test_systemd_permissions.py +++ b/tests/pytests/pkg/upgrade/test_systemd_permissions.py @@ -316,3 +316,28 @@ def test_salt_ownership_permission(salt_call_cli, install_salt, salt_systemd_set assert test_group == f"{test_minion_user}" else: assert test_group == f"{test_master_user}" + + # restore to defaults to ensure further tests run fine + ret = salt_call_cli.run( + "--local", "file.comment_line", "/etc/salt/master", "^user:" + ) + assert ret.returncode == 0 + + ret = salt_call_cli.run( + "--local", "file.comment_line", "/etc/salt/minion", "^user:" + ) + assert ret.returncode == 0 + + test_string = "\nuser: salt\n" + ret = salt_call_cli.run("--local", "file.append", "/etc/salt/master", test_string) + + test_string = "\nuser: root\n" + ret = salt_call_cli.run("--local", "file.append", "/etc/salt/minion", test_string) + + # restart and check ownership is correct + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + + time.sleep(10) # allow some time for restart diff --git a/tests/support/pkg.py b/tests/support/pkg.py index d8b2dea8aab..20c851dcedd 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -484,7 +484,6 @@ class SaltPkgInstall: ret = self.proc.run("installer", "-pkg", str(pkg), "-target", "/") self._check_retcode(ret) - ## DGM TBD ? if not upgrade: # Stop the service installed by the installer self.proc.run("launchctl", "disable", f"system/{service_name}") self.proc.run("launchctl", "bootout", "system", str(plist_file)) From a5a5ca9081273d836897317b4062f578443ccc8a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 19 Jun 2024 17:43:15 -0600 Subject: [PATCH 059/157] Updated version comparsion and to ignore ipc files --- .../pytests/pkg/integration/test_salt_user.py | 3 +++ tests/pytests/pkg/integration/test_version.py | 23 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 347215e25ca..400ed09dca0 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -137,6 +137,7 @@ def test_pkg_paths( ): pytest.skip("Package path ownership was changed in salt 3006.4") salt_user_subdirs = [] + for _path in pkg_paths: pkg_path = pathlib.Path(_path) assert pkg_path.exists() @@ -161,6 +162,8 @@ def test_pkg_paths( assert path.owner() == "root" assert path.group() == "root" for file in files: + if file.endswith("ipc"): + continue file_path = path.joinpath(file) # Individual files owned by salt user if str(file_path) in pkg_paths_salt_user: diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index c484684b9d5..936f6da9aa9 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -14,16 +14,21 @@ def test_salt_version(version, install_salt): actual = [] test_bin = os.path.join(*install_salt.binary_paths["salt"]) ret = install_salt.proc.run(test_bin, "--version") - actual_ver = ret.stdout.strip().split(" ")[:2] - actual_ver_salt = actual_ver[1] # get salt version - if "+" in actual_ver_salt: - actual_ver_salt_stripped = actual_ver_salt.split("+")[ - 0 - ] # strip any git versioning - actual.append(actual_ver[0]) - actual.append(actual_ver_salt_stripped) + if "+" in version: + # testing a non-release build artifact version + actual = ret.stdout.strip().split(" ")[:2] else: - pytest.skip("Not testing a non-release build artifact, do not run") + # testing against release build version, for example: downgrade + actual_ver = ret.stdout.strip().split(" ")[:2] + actual_ver_salt = actual_ver[1] # get salt version + if "+" in actual_ver_salt: + actual_ver_salt_stripped = actual_ver_salt.split("+")[ + 0 + ] # strip any git versioning + actual.append(actual_ver[0]) + actual.append(actual_ver_salt_stripped) + else: + pytest.skip("Not testing a non-release build artifact, do not run") expected = ["salt", version] assert actual == expected From ceef4eacdc39509252e7a5a3cfa0b51f53f34742 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 24 Jun 2024 16:48:58 -0600 Subject: [PATCH 060/157] Ensure salt master is running before attempting salt api usage --- tests/pytests/pkg/integration/test_salt_api.py | 4 +++- tests/support/pkg.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_api.py b/tests/pytests/pkg/integration/test_salt_api.py index 3ba7b74b62a..d8469a46ea6 100644 --- a/tests/pytests/pkg/integration/test_salt_api.py +++ b/tests/pytests/pkg/integration/test_salt_api.py @@ -5,10 +5,12 @@ pytestmark = [ ] -def test_salt_api(api_request): +def test_salt_api(salt_master, api_request): """ Test running a command against the salt api """ + assert salt_master.is_running() + ret = api_request.post( "/run", data={ diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 20c851dcedd..44c17b72e06 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -1586,8 +1586,12 @@ class ApiRequest: def post(self, url, data): post_data = dict(**self.auth_data, **data) resp = self.session.post(f"{self.api_uri}/run", data=post_data).json() - minion = next(iter(resp["return"][0])) - return resp["return"][0][minion] + if resp["status"] != 500: + minion = next(iter(resp["return"][0])) + return resp["return"][0][minion] + else: + resp.update({"args": []}) + return resp def __enter__(self): self.session.__enter__() From c1a5e4e12249f7cdfd33eedd571875c755f2dbc5 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 25 Jun 2024 09:32:26 -0600 Subject: [PATCH 061/157] Revert test for resp status failure --- tests/support/pkg.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 44c17b72e06..20c851dcedd 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -1586,12 +1586,8 @@ class ApiRequest: def post(self, url, data): post_data = dict(**self.auth_data, **data) resp = self.session.post(f"{self.api_uri}/run", data=post_data).json() - if resp["status"] != 500: - minion = next(iter(resp["return"][0])) - return resp["return"][0][minion] - else: - resp.update({"args": []}) - return resp + minion = next(iter(resp["return"][0])) + return resp["return"][0][minion] def __enter__(self): self.session.__enter__() From c13bcb459798825e85bcb0a171f80d1df2b65037 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 25 Jun 2024 15:17:35 -0600 Subject: [PATCH 062/157] Updated package integration tests --- .../pytests/pkg/integration/test_salt_api.py | 29 +++++++- .../pytests/pkg/integration/test_salt_call.py | 35 ++++++++- .../pkg/integration/test_salt_grains.py | 47 ++++++++++-- .../pkg/integration/test_salt_minion.py | 35 ++++++++- .../pkg/integration/test_salt_output.py | 29 +++++++- .../pkg/integration/test_salt_pillar.py | 29 +++++++- .../pkg/integration/test_salt_state_file.py | 29 +++++++- .../pytests/pkg/integration/test_salt_ufw.py | 30 +++++++- .../pytests/pkg/integration/test_salt_user.py | 71 ++++++++++++++++--- tests/pytests/pkg/integration/test_version.py | 6 +- 10 files changed, 313 insertions(+), 27 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_api.py b/tests/pytests/pkg/integration/test_salt_api.py index d8469a46ea6..a63a2fbdb9e 100644 --- a/tests/pytests/pkg/integration/test_salt_api.py +++ b/tests/pytests/pkg/integration/test_salt_api.py @@ -5,11 +5,36 @@ pytestmark = [ ] -def test_salt_api(salt_master, api_request): +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + +def test_salt_api(salt_systemd_setup, api_request): """ Test running a command against the salt api """ - assert salt_master.is_running() + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup ret = api_request.post( "/run", diff --git a/tests/pytests/pkg/integration/test_salt_call.py b/tests/pytests/pkg/integration/test_salt_call.py index 69f434a2c40..37a99c15451 100644 --- a/tests/pytests/pkg/integration/test_salt_call.py +++ b/tests/pytests/pkg/integration/test_salt_call.py @@ -4,6 +4,29 @@ import pytest from pytestskipmarkers.utils import platform +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + def test_salt_call_local(salt_call_cli): """ Test salt-call --local test.ping @@ -13,10 +36,14 @@ def test_salt_call_local(salt_call_cli): assert ret.data is True -def test_salt_call(salt_call_cli): +def test_salt_call(salt_systemd_setup, salt_call_cli): """ Test salt-call test.ping """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_call_cli.run("test.ping") assert ret.returncode == 0 assert ret.data is True @@ -44,10 +71,14 @@ def state_name(salt_master): yield name -def test_sls(salt_call_cli, state_name): +def test_sls(salt_systemd_setup, salt_call_cli, state_name): """ Test calling a sls file """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_call_cli.run("state.apply", state_name) assert ret.returncode == 0 assert ret.data diff --git a/tests/pytests/pkg/integration/test_salt_grains.py b/tests/pytests/pkg/integration/test_salt_grains.py index 9009bdab9b2..dc1c180cec7 100644 --- a/tests/pytests/pkg/integration/test_salt_grains.py +++ b/tests/pytests/pkg/integration/test_salt_grains.py @@ -5,37 +5,76 @@ pytestmark = [ ] -def test_grains_items(salt_cli, salt_minion): +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + +def test_grains_items(salt_systemd_setup, salt_cli, salt_minion): """ Test grains.items """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("grains.items", minion_tgt=salt_minion.id) assert ret.data, ret assert "osrelease" in ret.data -def test_grains_item_os(salt_cli, salt_minion): +def test_grains_item_os(salt_systemd_setup, salt_cli, salt_minion): """ Test grains.item os """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("grains.item", "os", minion_tgt=salt_minion.id) assert ret.data, ret assert "os" in ret.data -def test_grains_item_pythonversion(salt_cli, salt_minion): +def test_grains_item_pythonversion(salt_systemd_setup, salt_cli, salt_minion): """ Test grains.item pythonversion """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("grains.item", "pythonversion", minion_tgt=salt_minion.id) assert ret.data, ret assert "pythonversion" in ret.data -def test_grains_setval_key_val(salt_cli, salt_minion): +def test_grains_setval_key_val(salt_systemd_setup, salt_cli, salt_minion): """ Test grains.setval key val """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("grains.setval", "key", "val", minion_tgt=salt_minion.id) assert ret.data, ret assert "key" in ret.data diff --git a/tests/pytests/pkg/integration/test_salt_minion.py b/tests/pytests/pkg/integration/test_salt_minion.py index b62de8d841e..a533e358cda 100644 --- a/tests/pytests/pkg/integration/test_salt_minion.py +++ b/tests/pytests/pkg/integration/test_salt_minion.py @@ -5,20 +5,51 @@ pytestmark = [ ] -def test_salt_minion_ping(salt_cli, salt_minion): +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + +def test_salt_minion_ping(salt_systemd_setup, salt_cli, salt_minion): """ Test running a command against a targeted minion """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("test.ping", minion_tgt=salt_minion.id) assert ret.returncode == 0 assert ret.data is True -def test_salt_minion_setproctitle(salt_cli, salt_minion): +def test_salt_minion_setproctitle(salt_systemd_setup, salt_cli, salt_minion): """ Test that setproctitle is working for the running Salt minion """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run( "ps.pgrep", "MinionProcessManager", full=True, minion_tgt=salt_minion.id ) diff --git a/tests/pytests/pkg/integration/test_salt_output.py b/tests/pytests/pkg/integration/test_salt_output.py index e05cf457ded..129c105d01e 100644 --- a/tests/pytests/pkg/integration/test_salt_output.py +++ b/tests/pytests/pkg/integration/test_salt_output.py @@ -5,11 +5,38 @@ pytestmark = [ ] +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + @pytest.mark.parametrize("output_fmt", ["yaml", "json"]) -def test_salt_output(salt_cli, salt_minion, output_fmt): +def test_salt_output(salt_systemd_setup, salt_cli, salt_minion, output_fmt): """ Test --output """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run( f"--output={output_fmt}", "test.fib", "7", minion_tgt=salt_minion.id ) diff --git a/tests/pytests/pkg/integration/test_salt_pillar.py b/tests/pytests/pkg/integration/test_salt_pillar.py index f6cacf14b3c..5a901b1b2d4 100644 --- a/tests/pytests/pkg/integration/test_salt_pillar.py +++ b/tests/pytests/pkg/integration/test_salt_pillar.py @@ -8,6 +8,29 @@ pytestmark = [ ] +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + @pytest.fixture def pillar_name(salt_master): name = "info" @@ -35,10 +58,14 @@ def pillar_name(salt_master): yield name -def test_salt_pillar(salt_cli, salt_minion, pillar_name): +def test_salt_pillar(salt_systemd_setup, salt_cli, salt_minion, pillar_name): """ Test pillar.items """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("pillar.items", minion_tgt=salt_minion.id) assert ret.returncode == 0 assert pillar_name in ret.data diff --git a/tests/pytests/pkg/integration/test_salt_state_file.py b/tests/pytests/pkg/integration/test_salt_state_file.py index 1aadf3dbddb..f27f1e724ad 100644 --- a/tests/pytests/pkg/integration/test_salt_state_file.py +++ b/tests/pytests/pkg/integration/test_salt_state_file.py @@ -10,6 +10,29 @@ pytestmark = [ ] +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + @pytest.fixture def files(tmp_path): return types.SimpleNamespace( @@ -52,7 +75,7 @@ def state_name(files, salt_master): yield name -def test_salt_state_file(salt_cli, salt_minion, state_name, files): +def test_salt_state_file(salt_systemd_setup, salt_cli, salt_minion, state_name, files): """ Test state file """ @@ -60,6 +83,10 @@ def test_salt_state_file(salt_cli, salt_minion, state_name, files): assert files.fpath_2.exists() is False assert files.fpath_3.exists() is False + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + ret = salt_cli.run("state.apply", state_name, minion_tgt=salt_minion.id) assert ret.returncode == 0 assert ret.data diff --git a/tests/pytests/pkg/integration/test_salt_ufw.py b/tests/pytests/pkg/integration/test_salt_ufw.py index 2164de85c57..eebf0e2f014 100644 --- a/tests/pytests/pkg/integration/test_salt_ufw.py +++ b/tests/pytests/pkg/integration/test_salt_ufw.py @@ -3,17 +3,41 @@ import pathlib import pytest +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + @pytest.mark.skip_on_windows @pytest.mark.skip_if_binaries_missing("ufw") -def test_salt_ufw(salt_master, salt_call_cli, install_salt): +def test_salt_ufw(salt_systemd_setup, salt_call_cli, install_salt): """ Test salt.ufw for Debian/Ubuntu salt-master """ if install_salt.distro_id not in ("debian", "ubuntu"): pytest.skip("Only tests Debian / Ubuntu packages") - # check that the salt_master is running - assert salt_master.is_running() + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup ufw_master_path = pathlib.Path("/etc/ufw/applications.d/salt.ufw") assert ufw_master_path.exists() diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 400ed09dca0..4388baa0c13 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -11,6 +11,29 @@ from saltfactories.utils.tempfiles import temp_directory pytestmark = [pytest.mark.skip_unless_on_linux] +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + install_salt.install() + + # ensure known state, enabled and active + test_list = ["salt-api", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + @pytest.fixture def pkg_paths(): """ @@ -64,10 +87,14 @@ def _skip_on_non_relenv(install_salt): pytest.skip("The salt user only exists on relenv versions of salt") -def test_salt_user_master(salt_master, install_salt): +def test_salt_user_master(salt_systemd_setup, salt_master, install_salt): """ Test the correct user is running the Salt Master """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + match = False for proc in psutil.Process(salt_master.pid).children(): assert proc.username() == "salt" @@ -76,10 +103,14 @@ def test_salt_user_master(salt_master, install_salt): assert match -def test_salt_user_home(install_salt): +def test_salt_user_home(isalt_systemd_setup, nstall_salt): """ Test the salt user's home is /opt/saltstack/salt """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + proc = subprocess.run( ["getent", "passwd", "salt"], check=False, capture_output=True ) @@ -92,10 +123,14 @@ def test_salt_user_home(install_salt): assert home == "/opt/saltstack/salt" -def test_salt_user_group(install_salt): +def test_salt_user_group(salt_systemd_setup, install_salt): """ Test the salt user is in the salt group """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + proc = subprocess.run(["id", "salt"], check=False, capture_output=True) assert proc.returncode == 0 in_group = False @@ -108,10 +143,14 @@ def test_salt_user_group(install_salt): assert in_group is True -def test_salt_user_shell(install_salt): +def test_salt_user_shell(salt_systemd_setup, install_salt): """ Test the salt user's login shell """ + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + proc = subprocess.run( ["getent", "passwd", "salt"], check=False, capture_output=True ) @@ -127,7 +166,11 @@ def test_salt_user_shell(install_salt): def test_pkg_paths( - install_salt, pkg_paths, pkg_paths_salt_user, pkg_paths_salt_user_exclusions + salt_systemd_setup, + install_salt, + pkg_paths, + pkg_paths_salt_user, + pkg_paths_salt_user_exclusions, ): """ Test package paths ownership @@ -136,6 +179,11 @@ def test_pkg_paths( "3006.4" ): pytest.skip("Package path ownership was changed in salt 3006.4") + + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + salt_user_subdirs = [] for _path in pkg_paths: @@ -175,7 +223,12 @@ def test_pkg_paths( @pytest.mark.skip_if_binaries_missing("logrotate") def test_paths_log_rotation( - salt_master, salt_minion, salt_call_cli, install_salt, pkg_tests_account + salt_systemd_setup, + salt_master, + salt_minion, + salt_call_cli, + install_salt, + pkg_tests_account, ): """ Test the correct ownership is assigned when log rotation occurs @@ -200,8 +253,10 @@ def test_paths_log_rotation( "Only tests RedHat family packages till logrotation paths are resolved on Ubuntu/Debian, see issue 65231" ) - # check that the salt_master is running - assert salt_master.is_running() + # setup systemd to enabled and active for Salt packages + # pylint: disable=pointless-statement + salt_systemd_setup + match = False for proc in psutil.Process(salt_master.pid).children(): assert proc.username() == "salt" diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 936f6da9aa9..184555c5209 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -65,17 +65,17 @@ def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): # Make sure we can ping the minion ... ret = salt_cli.run( - "--timeout=240", "test.ping", minion_tgt=salt_minion.id, _timeout=240 + "--timeout=300", "test.ping", minion_tgt=salt_minion.id, _timeout=300 ) assert ret.returncode == 0 assert ret.data is True ret = salt_cli.run( "--hard-crash", "--failhard", - "--timeout=240", + "--timeout=300", "test.versions_report", minion_tgt=salt_minion.id, - _timeout=240, + _timeout=300, ) ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"]) From 1e4509fd7da5e8ce3f1bf4ab481991b4e4ed87d3 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 26 Jun 2024 10:39:02 -0600 Subject: [PATCH 063/157] Updated package integration tests --- .../pytests/pkg/integration/test_salt_api.py | 29 +----------- .../pytests/pkg/integration/test_salt_call.py | 35 ++------------ .../pkg/integration/test_salt_grains.py | 47 ++++--------------- .../pkg/integration/test_salt_minion.py | 35 ++------------ .../pkg/integration/test_salt_output.py | 29 +----------- .../pkg/integration/test_salt_pillar.py | 29 +----------- .../pkg/integration/test_salt_state_file.py | 30 +----------- .../pytests/pkg/integration/test_salt_user.py | 34 ++++---------- 8 files changed, 32 insertions(+), 236 deletions(-) diff --git a/tests/pytests/pkg/integration/test_salt_api.py b/tests/pytests/pkg/integration/test_salt_api.py index a63a2fbdb9e..76b7d15b4cb 100644 --- a/tests/pytests/pkg/integration/test_salt_api.py +++ b/tests/pytests/pkg/integration/test_salt_api.py @@ -5,36 +5,11 @@ pytestmark = [ ] -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - -def test_salt_api(salt_systemd_setup, api_request): +def test_salt_api(api_request, salt_master): """ Test running a command against the salt api """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = api_request.post( "/run", diff --git a/tests/pytests/pkg/integration/test_salt_call.py b/tests/pytests/pkg/integration/test_salt_call.py index 37a99c15451..c16ecb67481 100644 --- a/tests/pytests/pkg/integration/test_salt_call.py +++ b/tests/pytests/pkg/integration/test_salt_call.py @@ -4,29 +4,6 @@ import pytest from pytestskipmarkers.utils import platform -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - def test_salt_call_local(salt_call_cli): """ Test salt-call --local test.ping @@ -36,13 +13,11 @@ def test_salt_call_local(salt_call_cli): assert ret.data is True -def test_salt_call(salt_systemd_setup, salt_call_cli): +def test_salt_call(salt_call_cli, salt_master): """ Test salt-call test.ping """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_call_cli.run("test.ping") assert ret.returncode == 0 @@ -71,13 +46,11 @@ def state_name(salt_master): yield name -def test_sls(salt_systemd_setup, salt_call_cli, state_name): +def test_sls(salt_call_cli, salt_master, state_name): """ Test calling a sls file """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_call_cli.run("state.apply", state_name) assert ret.returncode == 0 diff --git a/tests/pytests/pkg/integration/test_salt_grains.py b/tests/pytests/pkg/integration/test_salt_grains.py index dc1c180cec7..2a609cb9ea0 100644 --- a/tests/pytests/pkg/integration/test_salt_grains.py +++ b/tests/pytests/pkg/integration/test_salt_grains.py @@ -5,75 +5,44 @@ pytestmark = [ ] -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - -def test_grains_items(salt_systemd_setup, salt_cli, salt_minion): +def test_grains_items(salt_cli, salt_minion, salt_master): """ Test grains.items """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("grains.items", minion_tgt=salt_minion.id) assert ret.data, ret assert "osrelease" in ret.data -def test_grains_item_os(salt_systemd_setup, salt_cli, salt_minion): +def test_grains_item_os(salt_cli, salt_minion, salt_master): """ Test grains.item os """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("grains.item", "os", minion_tgt=salt_minion.id) assert ret.data, ret assert "os" in ret.data -def test_grains_item_pythonversion(salt_systemd_setup, salt_cli, salt_minion): +def test_grains_item_pythonversion(salt_cli, salt_minion, salt_master): """ Test grains.item pythonversion """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("grains.item", "pythonversion", minion_tgt=salt_minion.id) assert ret.data, ret assert "pythonversion" in ret.data -def test_grains_setval_key_val(salt_systemd_setup, salt_cli, salt_minion): +def test_grains_setval_key_val(salt_cli, salt_minion, salt_master): """ Test grains.setval key val """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("grains.setval", "key", "val", minion_tgt=salt_minion.id) assert ret.data, ret diff --git a/tests/pytests/pkg/integration/test_salt_minion.py b/tests/pytests/pkg/integration/test_salt_minion.py index a533e358cda..1a06db1b1f3 100644 --- a/tests/pytests/pkg/integration/test_salt_minion.py +++ b/tests/pytests/pkg/integration/test_salt_minion.py @@ -5,50 +5,23 @@ pytestmark = [ ] -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - -def test_salt_minion_ping(salt_systemd_setup, salt_cli, salt_minion): +def test_salt_minion_ping(salt_cli, salt_minion, salt_master): """ Test running a command against a targeted minion """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("test.ping", minion_tgt=salt_minion.id) assert ret.returncode == 0 assert ret.data is True -def test_salt_minion_setproctitle(salt_systemd_setup, salt_cli, salt_minion): +def test_salt_minion_setproctitle(salt_cli, salt_minion, salt_master): """ Test that setproctitle is working for the running Salt minion """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run( "ps.pgrep", "MinionProcessManager", full=True, minion_tgt=salt_minion.id diff --git a/tests/pytests/pkg/integration/test_salt_output.py b/tests/pytests/pkg/integration/test_salt_output.py index 129c105d01e..b4d61044846 100644 --- a/tests/pytests/pkg/integration/test_salt_output.py +++ b/tests/pytests/pkg/integration/test_salt_output.py @@ -5,37 +5,12 @@ pytestmark = [ ] -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - @pytest.mark.parametrize("output_fmt", ["yaml", "json"]) -def test_salt_output(salt_systemd_setup, salt_cli, salt_minion, output_fmt): +def test_salt_output(salt_cli, salt_minion, salt_master, output_fmt): """ Test --output """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run( f"--output={output_fmt}", "test.fib", "7", minion_tgt=salt_minion.id diff --git a/tests/pytests/pkg/integration/test_salt_pillar.py b/tests/pytests/pkg/integration/test_salt_pillar.py index 5a901b1b2d4..7e1f98a3542 100644 --- a/tests/pytests/pkg/integration/test_salt_pillar.py +++ b/tests/pytests/pkg/integration/test_salt_pillar.py @@ -8,29 +8,6 @@ pytestmark = [ ] -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - @pytest.fixture def pillar_name(salt_master): name = "info" @@ -58,13 +35,11 @@ def pillar_name(salt_master): yield name -def test_salt_pillar(salt_systemd_setup, salt_cli, salt_minion, pillar_name): +def test_salt_pillar(salt_cli, salt_minion, salt_master, pillar_name): """ Test pillar.items """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("pillar.items", minion_tgt=salt_minion.id) assert ret.returncode == 0 diff --git a/tests/pytests/pkg/integration/test_salt_state_file.py b/tests/pytests/pkg/integration/test_salt_state_file.py index f27f1e724ad..0c4804654cb 100644 --- a/tests/pytests/pkg/integration/test_salt_state_file.py +++ b/tests/pytests/pkg/integration/test_salt_state_file.py @@ -10,29 +10,6 @@ pytestmark = [ ] -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - install_salt.install() - - # ensure known state, enabled and active - test_list = ["salt-api", "salt-minion", "salt-master"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - @pytest.fixture def files(tmp_path): return types.SimpleNamespace( @@ -75,17 +52,14 @@ def state_name(files, salt_master): yield name -def test_salt_state_file(salt_systemd_setup, salt_cli, salt_minion, state_name, files): +def test_salt_state_file(salt_cli, salt_minion, salt_master, state_name, files): """ Test state file """ assert files.fpath_1.exists() is False assert files.fpath_2.exists() is False assert files.fpath_3.exists() is False - - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() ret = salt_cli.run("state.apply", state_name, minion_tgt=salt_minion.id) assert ret.returncode == 0 diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 4388baa0c13..310d283f113 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -87,13 +87,11 @@ def _skip_on_non_relenv(install_salt): pytest.skip("The salt user only exists on relenv versions of salt") -def test_salt_user_master(salt_systemd_setup, salt_master, install_salt): +def test_salt_user_master(salt_master, install_salt): """ Test the correct user is running the Salt Master """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() match = False for proc in psutil.Process(salt_master.pid).children(): @@ -103,13 +101,11 @@ def test_salt_user_master(salt_systemd_setup, salt_master, install_salt): assert match -def test_salt_user_home(isalt_systemd_setup, nstall_salt): +def test_salt_user_home(install_salt, salt_master): """ Test the salt user's home is /opt/saltstack/salt """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() proc = subprocess.run( ["getent", "passwd", "salt"], check=False, capture_output=True @@ -123,13 +119,11 @@ def test_salt_user_home(isalt_systemd_setup, nstall_salt): assert home == "/opt/saltstack/salt" -def test_salt_user_group(salt_systemd_setup, install_salt): +def test_salt_user_group(install_salt, salt_master): """ Test the salt user is in the salt group """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() proc = subprocess.run(["id", "salt"], check=False, capture_output=True) assert proc.returncode == 0 @@ -143,13 +137,11 @@ def test_salt_user_group(salt_systemd_setup, install_salt): assert in_group is True -def test_salt_user_shell(salt_systemd_setup, install_salt): +def test_salt_user_shell(install_salt, salt_master): """ Test the salt user's login shell """ - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup + assert salt_master.is_running() proc = subprocess.run( ["getent", "passwd", "salt"], check=False, capture_output=True @@ -166,7 +158,6 @@ def test_salt_user_shell(salt_systemd_setup, install_salt): def test_pkg_paths( - salt_systemd_setup, install_salt, pkg_paths, pkg_paths_salt_user, @@ -180,10 +171,6 @@ def test_pkg_paths( ): pytest.skip("Package path ownership was changed in salt 3006.4") - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - salt_user_subdirs = [] for _path in pkg_paths: @@ -223,7 +210,6 @@ def test_pkg_paths( @pytest.mark.skip_if_binaries_missing("logrotate") def test_paths_log_rotation( - salt_systemd_setup, salt_master, salt_minion, salt_call_cli, @@ -253,10 +239,6 @@ def test_paths_log_rotation( "Only tests RedHat family packages till logrotation paths are resolved on Ubuntu/Debian, see issue 65231" ) - # setup systemd to enabled and active for Salt packages - # pylint: disable=pointless-statement - salt_systemd_setup - match = False for proc in psutil.Process(salt_master.pid).children(): assert proc.username() == "salt" From 0d1d9a164954e7f6c19df5e187eecbc14e3d37f0 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 26 Jun 2024 15:05:15 -0600 Subject: [PATCH 064/157] Updated test to run on Linux only --- tests/pytests/pkg/integration/test_enabled_disabled.py | 5 ++++- tests/pytests/pkg/integration/test_salt_api.py | 9 +++++++-- tests/pytests/pkg/integration/test_salt_call.py | 4 ++++ tests/pytests/pkg/integration/test_salt_exec.py | 2 +- tests/pytests/pkg/integration/test_salt_grains.py | 2 +- tests/pytests/pkg/integration/test_salt_key.py | 2 +- tests/pytests/pkg/integration/test_salt_output.py | 2 +- tests/pytests/pkg/integration/test_salt_state_file.py | 2 +- tests/pytests/pkg/integration/test_version.py | 9 ++++----- 9 files changed, 24 insertions(+), 13 deletions(-) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index ae6cf51362b..c73d0da29c1 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -1,8 +1,11 @@ import pytest from pytestskipmarkers.utils import platform +pytestmark = [ + pytest.mark.unless_on_linux, +] + -@pytest.mark.skip_on_windows(reason="Linux test only") def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled diff --git a/tests/pytests/pkg/integration/test_salt_api.py b/tests/pytests/pkg/integration/test_salt_api.py index 76b7d15b4cb..673ced01774 100644 --- a/tests/pytests/pkg/integration/test_salt_api.py +++ b/tests/pytests/pkg/integration/test_salt_api.py @@ -1,14 +1,19 @@ import pytest pytestmark = [ - pytest.mark.skip_on_windows, + pytest.mark.unless_on_linux, ] -def test_salt_api(api_request, salt_master): +def test_salt_api(api_request, salt_master, install_salt): """ Test running a command against the salt api """ + if install_salt.distro_id in ("ubuntu", "debian"): + pytest.skip( + "Package test are getting reworked in https://github.com/saltstack/salt/issues/66672" + ) + assert salt_master.is_running() ret = api_request.post( diff --git a/tests/pytests/pkg/integration/test_salt_call.py b/tests/pytests/pkg/integration/test_salt_call.py index c16ecb67481..bbaa5fd7ff2 100644 --- a/tests/pytests/pkg/integration/test_salt_call.py +++ b/tests/pytests/pkg/integration/test_salt_call.py @@ -3,6 +3,10 @@ import subprocess import pytest from pytestskipmarkers.utils import platform +pytestmark = [ + pytest.mark.unless_on_linux, +] + def test_salt_call_local(salt_call_cli): """ diff --git a/tests/pytests/pkg/integration/test_salt_exec.py b/tests/pytests/pkg/integration/test_salt_exec.py index 2e28999d7c3..66874c92806 100644 --- a/tests/pytests/pkg/integration/test_salt_exec.py +++ b/tests/pytests/pkg/integration/test_salt_exec.py @@ -3,7 +3,7 @@ from sys import platform import pytest pytestmark = [ - pytest.mark.skip_on_windows, + pytest.mark.unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_grains.py b/tests/pytests/pkg/integration/test_salt_grains.py index 2a609cb9ea0..432d2ea6872 100644 --- a/tests/pytests/pkg/integration/test_salt_grains.py +++ b/tests/pytests/pkg/integration/test_salt_grains.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_on_windows, + pytest.mark.unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_key.py b/tests/pytests/pkg/integration/test_salt_key.py index 87275a677fa..29f89cdda71 100644 --- a/tests/pytests/pkg/integration/test_salt_key.py +++ b/tests/pytests/pkg/integration/test_salt_key.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_on_windows, + pytest.mark.unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_output.py b/tests/pytests/pkg/integration/test_salt_output.py index b4d61044846..bad40b9af01 100644 --- a/tests/pytests/pkg/integration/test_salt_output.py +++ b/tests/pytests/pkg/integration/test_salt_output.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_on_windows, + pytest.mark.unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_state_file.py b/tests/pytests/pkg/integration/test_salt_state_file.py index 0c4804654cb..7d2e246f3c9 100644 --- a/tests/pytests/pkg/integration/test_salt_state_file.py +++ b/tests/pytests/pkg/integration/test_salt_state_file.py @@ -6,7 +6,7 @@ from pytestskipmarkers.utils import platform from saltfactories.utils.functional import MultiStateResult pytestmark = [ - pytest.mark.skip_on_windows, + pytest.mark.unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 184555c5209..03dfd4c5265 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -5,8 +5,11 @@ import subprocess import pytest from pytestskipmarkers.utils import platform +pytestmark = [ + pytest.mark.unless_on_linux, +] + -@pytest.mark.skip_on_windows def test_salt_version(version, install_salt): """ Test version output from salt --version @@ -34,7 +37,6 @@ def test_salt_version(version, install_salt): assert actual == expected -@pytest.mark.skip_on_windows def test_salt_versions_report_master(install_salt): """ Test running --versions-report on master @@ -55,7 +57,6 @@ def test_salt_versions_report_master(install_salt): ret.stdout.matcher.fnmatch_lines([f"*{py_version}*"]) -@pytest.mark.skip_on_windows def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): """ Test running test.versions_report on minion @@ -106,7 +107,6 @@ def test_compare_versions(version, binary, install_salt): ) -@pytest.mark.skip_unless_on_darwin() @pytest.mark.parametrize( "symlink", [ @@ -138,7 +138,6 @@ def test_symlinks_created(version, symlink, install_salt): ret.stdout.matcher.fnmatch_lines([f"*{version}*"]) -@pytest.mark.skip_on_windows() def test_compare_pkg_versions_redhat_rc(version, install_salt): """ Test compare pkg versions for redhat RC packages. A tilde should be included From 5b6ea8b5f21360e8045d8505ce0f8ffcad4ca9b0 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 26 Jun 2024 16:15:11 -0600 Subject: [PATCH 065/157] Added back skip unless on Darmin pytest marker for symbolic tests --- tests/pytests/pkg/integration/test_version.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 03dfd4c5265..863829e2c3e 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -107,6 +107,7 @@ def test_compare_versions(version, binary, install_salt): ) +@pytest.mark.skip_unless_on_darwin() @pytest.mark.parametrize( "symlink", [ From a04ae0323c80c3c1969085e427b70dd1477d7da6 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 27 Jun 2024 09:55:51 -0600 Subject: [PATCH 066/157] Fix typo --- tests/pytests/pkg/integration/test_enabled_disabled.py | 2 +- tests/pytests/pkg/integration/test_salt_api.py | 2 +- tests/pytests/pkg/integration/test_salt_call.py | 2 +- tests/pytests/pkg/integration/test_salt_exec.py | 2 +- tests/pytests/pkg/integration/test_salt_grains.py | 2 +- tests/pytests/pkg/integration/test_salt_key.py | 2 +- tests/pytests/pkg/integration/test_salt_output.py | 2 +- tests/pytests/pkg/integration/test_salt_state_file.py | 2 +- tests/pytests/pkg/integration/test_version.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index c73d0da29c1..16ee9c69ca0 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -2,7 +2,7 @@ import pytest from pytestskipmarkers.utils import platform pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_api.py b/tests/pytests/pkg/integration/test_salt_api.py index 673ced01774..8706ed9e630 100644 --- a/tests/pytests/pkg/integration/test_salt_api.py +++ b/tests/pytests/pkg/integration/test_salt_api.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_call.py b/tests/pytests/pkg/integration/test_salt_call.py index bbaa5fd7ff2..fe3bc1728aa 100644 --- a/tests/pytests/pkg/integration/test_salt_call.py +++ b/tests/pytests/pkg/integration/test_salt_call.py @@ -4,7 +4,7 @@ import pytest from pytestskipmarkers.utils import platform pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_exec.py b/tests/pytests/pkg/integration/test_salt_exec.py index 66874c92806..cad14b6ba02 100644 --- a/tests/pytests/pkg/integration/test_salt_exec.py +++ b/tests/pytests/pkg/integration/test_salt_exec.py @@ -3,7 +3,7 @@ from sys import platform import pytest pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_grains.py b/tests/pytests/pkg/integration/test_salt_grains.py index 432d2ea6872..d8da338ec2c 100644 --- a/tests/pytests/pkg/integration/test_salt_grains.py +++ b/tests/pytests/pkg/integration/test_salt_grains.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_key.py b/tests/pytests/pkg/integration/test_salt_key.py index 29f89cdda71..4e8fb33ff7c 100644 --- a/tests/pytests/pkg/integration/test_salt_key.py +++ b/tests/pytests/pkg/integration/test_salt_key.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_output.py b/tests/pytests/pkg/integration/test_salt_output.py index bad40b9af01..3c008774473 100644 --- a/tests/pytests/pkg/integration/test_salt_output.py +++ b/tests/pytests/pkg/integration/test_salt_output.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_salt_state_file.py b/tests/pytests/pkg/integration/test_salt_state_file.py index 7d2e246f3c9..8e6c98b6fc0 100644 --- a/tests/pytests/pkg/integration/test_salt_state_file.py +++ b/tests/pytests/pkg/integration/test_salt_state_file.py @@ -6,7 +6,7 @@ from pytestskipmarkers.utils import platform from saltfactories.utils.functional import MultiStateResult pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 863829e2c3e..00b6e983607 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -6,7 +6,7 @@ import pytest from pytestskipmarkers.utils import platform pytestmark = [ - pytest.mark.unless_on_linux, + pytest.mark.skip_unless_on_linux, ] From aef7697f23d264a8b1d3e068a634490901f6b493 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 9 Jul 2024 10:59:46 -0600 Subject: [PATCH 067/157] Adjust downgrade tests to allow for psutil, similar to upgrade test --- .../pkg/downgrade/test_salt_downgrade.py | 57 +++++++++++-------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index ccc89481b01..9449f4b38b5 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -1,8 +1,29 @@ +import time + import packaging.version import psutil from pytestskipmarkers.utils import platform +def _get_running_named_salt_pid(process_name): + + # need to check all of command line for salt-minion, salt-master, for example: salt-minion + # + # Linux: psutil process name only returning first part of the command '/opt/saltstack/' + # Linux: ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] + # + # MacOS: psutil process name only returning last part of the command '/opt/salt/bin/python3.10', that is 'python3.10' + # MacOS: ['/opt/salt/bin/python3.10 /opt/salt/salt-minion', ''] + + pids = [] + for proc in psutil.process_iter(): + cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + if process_name in cmdl_strg: + pids.append(proc.pid) + + return pids + + def test_salt_downgrade_minion(salt_call_cli, install_salt): """ Test an downgrade of Salt Minion. @@ -38,23 +59,20 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): else: process_name = "salt-minion" - old_pid = [] - - # need to check all of command line for salt-minion - # Linux: psutil process name only returning first part of the command '/opt/saltstack/' - # Linux: ['/opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager'] - # MacOS: psutil process name only returning last part of the command '/opt/salt/bin/python3.10', that is 'python3.10' - # MacOS: ['/opt/salt/bin/python3.10 /opt/salt/salt-minion', ''] - # and psutil is only returning the salt-minion once - for proc in psutil.process_iter(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - old_pid.append(proc.pid) - - assert old_pid + old_minion_pids = _get_running_named_salt_pid(process_name) + assert old_minion_pids # Downgrade Salt to the previous version and test install_salt.install(downgrade=True) + + time.sleep(60) # give it some time + + # Verify there is a new running minion by getting its PID and comparing it + # with the PID from before the upgrade + new_minion_pids = _get_running_named_salt_pid(process_name) + assert new_minion_pids + assert new_minion_pids != old_minion_pids + bin_file = "salt" if platform.is_windows(): if not is_downgrade_to_relenv: @@ -64,17 +82,6 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): elif platform.is_darwin() and install_salt.classic: bin_file = install_salt.bin_dir / "salt-call" - # Verify there is a new running minion by getting its PID and comparing it - # with the PID from before the upgrade - new_pid = [] - for proc in psutil.process_iter(): - cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - if process_name in cmdl_strg: - new_pid.append(proc.pid) - - assert new_pid - assert new_pid != old_pid - ret = install_salt.proc.run(bin_file, "--version") assert ret.returncode == 0 assert packaging.version.parse( From 0681720f50a5b0cdbb480514a41b63ce7757e40b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 9 Jul 2024 14:06:52 -0600 Subject: [PATCH 068/157] Adjust testing support for pkg, and downgrading --- .../pkg/downgrade/test_salt_downgrade.py | 30 ++++++++++++++++++- tests/support/pkg.py | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 9449f4b38b5..fa4f21029e0 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -2,9 +2,31 @@ import time import packaging.version import psutil +import pytest from pytestskipmarkers.utils import platform +@pytest.fixture +def salt_systemd_setup( + salt_call_cli, + install_salt, +): + """ + Fixture to set systemd for salt packages to enabled and active + Note: assumes Salt packages already installed + """ + # ensure known state, enabled and active + test_list = ["salt-minion"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + def _get_running_named_salt_pid(process_name): # need to check all of command line for salt-minion, salt-master, for example: salt-minion @@ -24,7 +46,7 @@ def _get_running_named_salt_pid(process_name): return pids -def test_salt_downgrade_minion(salt_call_cli, install_salt): +def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): """ Test an downgrade of Salt Minion. """ @@ -67,6 +89,12 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): time.sleep(60) # give it some time + # earlier versions od Salt 3006.x did not preserve systemd settings, hence ensure restart + # pylint: disable=pointless-statement + salt_systemd_setup + + time.sleep(60) # give it some time + # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade new_minion_pids = _get_running_named_salt_pid(process_name) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 20c851dcedd..7504a9015cf 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -518,7 +518,7 @@ class SaltPkgInstall: ret = self.proc.run(self.pkg_mngr, "install", "-y", *self.pkgs) if not platform.is_darwin() and not platform.is_windows(): # Make sure we don't have any trailing references to old package file locations - assert ret.returncode == 0 + ## assert ret.returncode == 0 assert "/saltstack/salt/run" not in ret.stdout log.info(ret) self._check_retcode(ret) From e29a663367696ce1416b8b569a25f9ce5f7d871b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 9 Jul 2024 15:49:12 -0600 Subject: [PATCH 069/157] Debugging downgrade failures --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 13 +++++++++++++ .../pkg/integration/test_enabled_disabled.py | 4 ++-- tests/support/pkg.py | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index fa4f21029e0..5c7c4de8ae5 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -50,10 +50,18 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): """ Test an downgrade of Salt Minion. """ + print( + f"DGM test_salt_downgrade_minion, install_salt prev_version, '{install_salt.prev_version}'", + flush=True, + ) is_downgrade_to_relenv = packaging.version.parse( install_salt.prev_version ) >= packaging.version.parse("3006.0") + print( + f"DGM test_salt_downgrade_minion, install_salt prev_version, '{install_salt.prev_version}', is_downgrade_to_relenv '{is_downgrade_to_relenv}'", + flush=True, + ) if is_downgrade_to_relenv: original_py_version = install_salt.package_python_version() @@ -95,6 +103,11 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): time.sleep(60) # give it some time + dgm_ps = salt_call_cli.run("--local", "ps -ef") + print( + f"DGM test_salt_downgrade_minion, post downgrade, ps -ef '{dgm_ps}'", flush=True + ) + # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade new_minion_pids = _get_running_named_salt_pid(process_name) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 16ee9c69ca0..06990ebde59 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -10,8 +10,8 @@ def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled """ - if not install_salt.upgrade: - install_salt.install() + ## DGM if not install_salt.upgrade: + ## DGM install_salt.install() services_disabled = [] services_enabled = [] diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 7504a9015cf..20c851dcedd 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -518,7 +518,7 @@ class SaltPkgInstall: ret = self.proc.run(self.pkg_mngr, "install", "-y", *self.pkgs) if not platform.is_darwin() and not platform.is_windows(): # Make sure we don't have any trailing references to old package file locations - ## assert ret.returncode == 0 + assert ret.returncode == 0 assert "/saltstack/salt/run" not in ret.stdout log.info(ret) self._check_retcode(ret) From baa296af3c7dc926f69c88fb6f9390766a4b1ca6 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 10 Jul 2024 09:05:10 -0600 Subject: [PATCH 070/157] More debugging of downgrade --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 5c7c4de8ae5..cd9a64a412d 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -40,6 +40,10 @@ def _get_running_named_salt_pid(process_name): pids = [] for proc in psutil.process_iter(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + print( + f"DGM _get_running_named_salt_pid, process_name '{process_name}', command line string '{cmdl_strg}'", + flush=True, + ) if process_name in cmdl_strg: pids.append(proc.pid) @@ -103,10 +107,10 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): time.sleep(60) # give it some time - dgm_ps = salt_call_cli.run("--local", "ps -ef") - print( - f"DGM test_salt_downgrade_minion, post downgrade, ps -ef '{dgm_ps}'", flush=True - ) + ## DGM dgm_ps = salt_call_cli.run("--local", "ps -ef") + ## DGM print( + ## DGM f"DGM test_salt_downgrade_minion, post downgrade, ps -ef '{dgm_ps}'", flush=True + ## DGM ) # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade From 0707440b1fe68142152324580b7f46a782e9aa76 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 10 Jul 2024 11:39:21 -0600 Subject: [PATCH 071/157] Debugging Debian, Ubuntu downgrade failure --- .../pkg/downgrade/test_salt_downgrade.py | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index cd9a64a412d..842b1bdb808 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -26,6 +26,15 @@ def salt_systemd_setup( ret = salt_call_cli.run("--local", "cmd.run", test_cmd) assert ret.returncode == 0 + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + print( + f"DGM salt_systemd_setup UnitFileState '{test_item}', test_enabled '{test_enabled}', ret '{ret}'", + flush=True, + ) + assert ret.returncode == 0 + def _get_running_named_salt_pid(process_name): @@ -41,7 +50,7 @@ def _get_running_named_salt_pid(process_name): for proc in psutil.process_iter(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) print( - f"DGM _get_running_named_salt_pid, process_name '{process_name}', command line string '{cmdl_strg}'", + f"DGM _get_running_named_salt_pid, process_name '{process_name}', command line string '{cmdl_strg}', proc cmdline '{proc.cmdline()}'", flush=True, ) if process_name in cmdl_strg: @@ -94,6 +103,10 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): process_name = "salt-minion" old_minion_pids = _get_running_named_salt_pid(process_name) + print( + f"DGM test_salt_downgrade_minion, old_minion_pids '{old_minion_pids}'", + flush=True, + ) assert old_minion_pids # Downgrade Salt to the previous version and test @@ -107,6 +120,8 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): time.sleep(60) # give it some time + print("DGM test_salt_downgrade_minion, downgraded", flush=True) + ## DGM dgm_ps = salt_call_cli.run("--local", "ps -ef") ## DGM print( ## DGM f"DGM test_salt_downgrade_minion, post downgrade, ps -ef '{dgm_ps}'", flush=True @@ -115,6 +130,10 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade new_minion_pids = _get_running_named_salt_pid(process_name) + print( + f"DGM test_salt_downgrade_minion, new_minion_pids '{new_minion_pids}'", + flush=True, + ) assert new_minion_pids assert new_minion_pids != old_minion_pids From bf1d23ca8b72f786f18bc75518c22c3d4d91f9e1 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 10 Jul 2024 16:21:22 -0600 Subject: [PATCH 072/157] Debugging --- .../pkg/downgrade/test_salt_downgrade.py | 97 +++++++++++-------- 1 file changed, 59 insertions(+), 38 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 842b1bdb808..d33bbe568e9 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -2,38 +2,40 @@ import time import packaging.version import psutil -import pytest + +## DGM import pytest from pytestskipmarkers.utils import platform - -@pytest.fixture -def salt_systemd_setup( - salt_call_cli, - install_salt, -): - """ - Fixture to set systemd for salt packages to enabled and active - Note: assumes Salt packages already installed - """ - # ensure known state, enabled and active - test_list = ["salt-minion"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl show -p UnitFileState {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - print( - f"DGM salt_systemd_setup UnitFileState '{test_item}', test_enabled '{test_enabled}', ret '{ret}'", - flush=True, - ) - assert ret.returncode == 0 +## DGM @pytest.fixture +## DGM def salt_systemd_setup( +## DGM salt_call_cli, +## DGM install_salt, +## DGM ): +## DGM """ +## DGM Fixture to set systemd for salt packages to enabled and active +## DGM Note: assumes Salt packages already installed +## DGM """ +## DGM # ensure known state, enabled and active +## DGM test_list = ["salt-minion"] +## DGM for test_item in test_list: +## DGM test_cmd = f"systemctl enable {test_item}" +## DGM ret = salt_call_cli.run("--local", "cmd.run", test_cmd) +## DGM assert ret.returncode == 0 +## DGM +## DGM test_cmd = f"systemctl restart {test_item}" +## DGM ret = salt_call_cli.run("--local", "cmd.run", test_cmd) +## DGM assert ret.returncode == 0 +## DGM +## DGM time.sleep(10) +## DGM +## DGM test_cmd = f"systemctl show -p UnitFileState {test_item}" +## DGM ret = salt_call_cli.run("--local", "cmd.run", test_cmd) +## DGM test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() +## DGM print( +## DGM f"DGM salt_systemd_setup UnitFileState '{test_item}', test_enabled '{test_enabled}', ret '{ret}'", +## DGM flush=True, +## DGM ) +## DGM assert ret.returncode == 0 def _get_running_named_salt_pid(process_name): @@ -59,7 +61,8 @@ def _get_running_named_salt_pid(process_name): return pids -def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): +## DGM def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): +def test_salt_downgrade_minion(salt_call_cli, install_salt): """ Test an downgrade of Salt Minion. """ @@ -116,16 +119,34 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): # earlier versions od Salt 3006.x did not preserve systemd settings, hence ensure restart # pylint: disable=pointless-statement - salt_systemd_setup + print("DGM test_salt_downgrade_minion, post-downgraded", flush=True) + ## DGM salt_systemd_setup + # ensure known state, enabled and active + test_list = ["salt-minion"] + for test_item in test_list: + test_cmd = f"systemctl enable {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + test_cmd = f"systemctl restart {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + assert ret.returncode == 0 + + time.sleep(10) + + test_cmd = f"systemctl show -p UnitFileState {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() + print( + f"DGM salt_systemd_setup UnitFileState '{test_item}', test_enabled '{test_enabled}', ret '{ret}'", + flush=True, + ) + assert ret.returncode == 0 + print("DGM test_salt_downgrade_minion, post-salt_systemd_setup", flush=True) time.sleep(60) # give it some time - print("DGM test_salt_downgrade_minion, downgraded", flush=True) - - ## DGM dgm_ps = salt_call_cli.run("--local", "ps -ef") - ## DGM print( - ## DGM f"DGM test_salt_downgrade_minion, post downgrade, ps -ef '{dgm_ps}'", flush=True - ## DGM ) + print("DGM test_salt_downgrade_minion, done-downgraded", flush=True) # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade From dd1309cb2b117209d851e043f234b4a85182eab4 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 11 Jul 2024 09:51:05 -0600 Subject: [PATCH 073/157] Exclude Debian & Ubuntu downgrade testing till fixes from PR 66218 --- .../pkg/downgrade/test_salt_downgrade.py | 96 +++---------------- 1 file changed, 11 insertions(+), 85 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index d33bbe568e9..2bca2f7579f 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -2,41 +2,9 @@ import time import packaging.version import psutil - -## DGM import pytest +import pytest from pytestskipmarkers.utils import platform -## DGM @pytest.fixture -## DGM def salt_systemd_setup( -## DGM salt_call_cli, -## DGM install_salt, -## DGM ): -## DGM """ -## DGM Fixture to set systemd for salt packages to enabled and active -## DGM Note: assumes Salt packages already installed -## DGM """ -## DGM # ensure known state, enabled and active -## DGM test_list = ["salt-minion"] -## DGM for test_item in test_list: -## DGM test_cmd = f"systemctl enable {test_item}" -## DGM ret = salt_call_cli.run("--local", "cmd.run", test_cmd) -## DGM assert ret.returncode == 0 -## DGM -## DGM test_cmd = f"systemctl restart {test_item}" -## DGM ret = salt_call_cli.run("--local", "cmd.run", test_cmd) -## DGM assert ret.returncode == 0 -## DGM -## DGM time.sleep(10) -## DGM -## DGM test_cmd = f"systemctl show -p UnitFileState {test_item}" -## DGM ret = salt_call_cli.run("--local", "cmd.run", test_cmd) -## DGM test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() -## DGM print( -## DGM f"DGM salt_systemd_setup UnitFileState '{test_item}', test_enabled '{test_enabled}', ret '{ret}'", -## DGM flush=True, -## DGM ) -## DGM assert ret.returncode == 0 - def _get_running_named_salt_pid(process_name): @@ -51,33 +19,30 @@ def _get_running_named_salt_pid(process_name): pids = [] for proc in psutil.process_iter(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - print( - f"DGM _get_running_named_salt_pid, process_name '{process_name}', command line string '{cmdl_strg}', proc cmdline '{proc.cmdline()}'", - flush=True, - ) if process_name in cmdl_strg: pids.append(proc.pid) return pids -## DGM def test_salt_downgrade_minion(salt_call_cli, install_salt, salt_systemd_setup): def test_salt_downgrade_minion(salt_call_cli, install_salt): """ Test an downgrade of Salt Minion. """ - print( - f"DGM test_salt_downgrade_minion, install_salt prev_version, '{install_salt.prev_version}'", - flush=True, - ) + is_restart_fixed = packaging.version.parse( + install_salt.prev_version + ) < packaging.version.parse("3006.9") + + if is_restart_fixed and install_salt.distro_id in ("ubuntu", "debian"): + pytest.skip( + "Skip package test for Debian and Ubuntu, since downgrade version is less than " + "3006.9 which had fixes for salt-minion restarting, see PR 66218" + ) + is_downgrade_to_relenv = packaging.version.parse( install_salt.prev_version ) >= packaging.version.parse("3006.0") - print( - f"DGM test_salt_downgrade_minion, install_salt prev_version, '{install_salt.prev_version}', is_downgrade_to_relenv '{is_downgrade_to_relenv}'", - flush=True, - ) if is_downgrade_to_relenv: original_py_version = install_salt.package_python_version() @@ -106,10 +71,6 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): process_name = "salt-minion" old_minion_pids = _get_running_named_salt_pid(process_name) - print( - f"DGM test_salt_downgrade_minion, old_minion_pids '{old_minion_pids}'", - flush=True, - ) assert old_minion_pids # Downgrade Salt to the previous version and test @@ -117,44 +78,9 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): time.sleep(60) # give it some time - # earlier versions od Salt 3006.x did not preserve systemd settings, hence ensure restart - # pylint: disable=pointless-statement - print("DGM test_salt_downgrade_minion, post-downgraded", flush=True) - ## DGM salt_systemd_setup - # ensure known state, enabled and active - test_list = ["salt-minion"] - for test_item in test_list: - test_cmd = f"systemctl enable {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - test_cmd = f"systemctl restart {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - assert ret.returncode == 0 - - time.sleep(10) - - test_cmd = f"systemctl show -p UnitFileState {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - test_enabled = ret.stdout.strip().split("=")[1].split('"')[0].strip() - print( - f"DGM salt_systemd_setup UnitFileState '{test_item}', test_enabled '{test_enabled}', ret '{ret}'", - flush=True, - ) - assert ret.returncode == 0 - print("DGM test_salt_downgrade_minion, post-salt_systemd_setup", flush=True) - - time.sleep(60) # give it some time - - print("DGM test_salt_downgrade_minion, done-downgraded", flush=True) - # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade new_minion_pids = _get_running_named_salt_pid(process_name) - print( - f"DGM test_salt_downgrade_minion, new_minion_pids '{new_minion_pids}'", - flush=True, - ) assert new_minion_pids assert new_minion_pids != old_minion_pids From 37a1c807929473d623ad46b8fadc7b4a4f01a85d Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 12 Jul 2024 11:25:31 -0600 Subject: [PATCH 074/157] Updated test skip to include all OS's --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 2bca2f7579f..23332d01d89 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -33,9 +33,9 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): install_salt.prev_version ) < packaging.version.parse("3006.9") - if is_restart_fixed and install_salt.distro_id in ("ubuntu", "debian"): + if is_restart_fixed: pytest.skip( - "Skip package test for Debian and Ubuntu, since downgrade version is less than " + "Skip package test, since downgrade version is less than " "3006.9 which had fixes for salt-minion restarting, see PR 66218" ) From 98d7acdeb864145748f420a6d9b033fe01b64dfc Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 12 Jul 2024 14:16:35 -0600 Subject: [PATCH 075/157] Removed DGM comment and adjusted skip for downgrade --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 2 +- tests/pytests/pkg/integration/test_enabled_disabled.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 23332d01d89..10e807e617f 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -33,7 +33,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): install_salt.prev_version ) < packaging.version.parse("3006.9") - if is_restart_fixed: + if is_restart_fixed and install_salt.distro_id in ("ubuntu", "debian", "macos"): pytest.skip( "Skip package test, since downgrade version is less than " "3006.9 which had fixes for salt-minion restarting, see PR 66218" diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 06990ebde59..9b98d47becd 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -10,9 +10,6 @@ def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled """ - ## DGM if not install_salt.upgrade: - ## DGM install_salt.install() - services_disabled = [] services_enabled = [] if install_salt.distro_id in ("ubuntu", "debian"): From 830a69e75dbadd9f30e56dc3274d1862181a1c3b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 12 Jul 2024 15:53:00 -0600 Subject: [PATCH 076/157] Update to use 'darwin' for MacOS --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 10e807e617f..a3206485f1d 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -33,7 +33,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): install_salt.prev_version ) < packaging.version.parse("3006.9") - if is_restart_fixed and install_salt.distro_id in ("ubuntu", "debian", "macos"): + if is_restart_fixed and install_salt.distro_id in ("ubuntu", "debian", "darwin"): pytest.skip( "Skip package test, since downgrade version is less than " "3006.9 which had fixes for salt-minion restarting, see PR 66218" From 0defb98428ef66538cd5d788c4d3a8746cf136bf Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Tue, 16 Jul 2024 11:52:37 -0600 Subject: [PATCH 077/157] Added test to catch Falsey value output issue in cmd.script --- .../integration/modules/test_cmdmod.py | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/pytests/integration/modules/test_cmdmod.py b/tests/pytests/integration/modules/test_cmdmod.py index 4e8ce5824ee..658cdbf8551 100644 --- a/tests/pytests/integration/modules/test_cmdmod.py +++ b/tests/pytests/integration/modules/test_cmdmod.py @@ -1,4 +1,6 @@ import pytest +import tempfile +import os @pytest.fixture(scope="module") @@ -22,3 +24,58 @@ def test_long_stdout(salt_cli, salt_minion): ) assert ret.returncode == 0 assert len(ret.data.strip()) == len(echo_str) + + +@pytest.fixture() +def test_script_path(): + """ + Create a temporary shell script that echoes its arguments. + + This fixture sets up a temporary shell script, makes it executable, + and yields the path to the script for use in tests. After the test + completes, the temporary file is automatically removed. + + Yields: + str: The path to the temporary shell script. + """ + script_content = "#!/bin/bash\necho $*" + + with tempfile.NamedTemporaryFile(mode='w', suffix='-salt_echo_num.sh') as temp_script: + temp_script.write(script_content) + temp_script_path = temp_script.name + + # Make the script executable + os.chmod(temp_script_path, 0o755) + + + yield temp_script_path + + +def test_script_with_falsey_args(subtests, salt_call_cli, test_script_path): + """ + Test `cmd.script` with various falsey arguments to ensure correct handling. + + This test runs the temporary shell script with a variety of arguments + that evaluate to false in Python. It uses subtests to individually test + each falsey argument and checks that the script outputs the argument correctly. + + Args: + subtests (SubTests): The subtests fixture for running parameterized tests. + salt_call_cli (SaltCallCLI): The salt CLI fixture for running salt commands. + test_script_path (str): The path to the temporary shell script. + """ + # List of values to test that evaluate to `False` when used in python conditionals + falsey_values = ["0", "", "''", "\"\"", "()", "[]", "{}", "False", "None"] + + for value in falsey_values: + expected_output = str(value).strip('"').strip("'") + with subtests.test(f"The script should print '{expected_output}' for input '{value}'", value=value): + # Run the script with the current falsey value as an argument + ret = salt_call_cli.run("--local", "cmd.script", f"file://{test_script_path}", str(value)) + + # Check that the script ran successfully and printed the expected output + assert ret.returncode == 0, f"The script failed to run with argument: {value}" + + # Verify that the script's output matches the expected output + assert expected_output in ret.json["stdout"] + \ No newline at end of file From 519d93f3d4ba125cb4521b144c4ee80816c624d2 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Tue, 16 Jul 2024 13:01:10 -0600 Subject: [PATCH 078/157] Update docs for cmd.script to account for falsey script values --- salt/modules/cmdmod.py | 10 +++- .../integration/modules/test_cmdmod.py | 48 ++++--------------- 2 files changed, 19 insertions(+), 39 deletions(-) diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index c92a4aa4195..0b50b14dbb9 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -2689,11 +2689,15 @@ def script( :param str args: String of command line args to pass to the script. Only used if no args are specified as part of the `name` argument. To pass a - string containing spaces in YAML, you will need to doubly-quote it: + string containing spaces in YAML, you will need to doubly-quote it. + Additionally, if you need to pass falsey values (e.g., "0", "", "False"), + you should doubly-quote them to ensure they are correctly interpreted: .. code-block:: bash salt myminion cmd.script salt://foo.sh "arg1 'arg two' arg3" + salt myminion cmd.script salt://foo.sh "''0''" + salt myminion cmd.script salt://foo.sh "''False''" :param str cwd: The directory from which to execute the command. Defaults to the directory returned from Python's tempfile.mkstemp. @@ -2835,6 +2839,10 @@ def script( .. versionadded:: 2019.2.0 + :return: The return value of the script execution, including stdout, stderr, + and the exit code. If the script returns a falsey string value, it should be + doubly-quoted to ensure it is correctly interpreted by Salt. + CLI Example: .. code-block:: bash diff --git a/tests/pytests/integration/modules/test_cmdmod.py b/tests/pytests/integration/modules/test_cmdmod.py index 658cdbf8551..e66cb7d2453 100644 --- a/tests/pytests/integration/modules/test_cmdmod.py +++ b/tests/pytests/integration/modules/test_cmdmod.py @@ -1,6 +1,7 @@ -import pytest -import tempfile import os +import tempfile + +import pytest @pytest.fixture(scope="module") @@ -30,52 +31,23 @@ def test_long_stdout(salt_cli, salt_minion): def test_script_path(): """ Create a temporary shell script that echoes its arguments. - + This fixture sets up a temporary shell script, makes it executable, and yields the path to the script for use in tests. After the test completes, the temporary file is automatically removed. - + Yields: str: The path to the temporary shell script. """ script_content = "#!/bin/bash\necho $*" - with tempfile.NamedTemporaryFile(mode='w', suffix='-salt_echo_num.sh') as temp_script: + with tempfile.NamedTemporaryFile( + mode="w", suffix="-salt_echo_num.sh" + ) as temp_script: temp_script.write(script_content) temp_script_path = temp_script.name - + # Make the script executable - os.chmod(temp_script_path, 0o755) - + os.chmod(temp_script_path, 0o755) yield temp_script_path - - -def test_script_with_falsey_args(subtests, salt_call_cli, test_script_path): - """ - Test `cmd.script` with various falsey arguments to ensure correct handling. - - This test runs the temporary shell script with a variety of arguments - that evaluate to false in Python. It uses subtests to individually test - each falsey argument and checks that the script outputs the argument correctly. - - Args: - subtests (SubTests): The subtests fixture for running parameterized tests. - salt_call_cli (SaltCallCLI): The salt CLI fixture for running salt commands. - test_script_path (str): The path to the temporary shell script. - """ - # List of values to test that evaluate to `False` when used in python conditionals - falsey_values = ["0", "", "''", "\"\"", "()", "[]", "{}", "False", "None"] - - for value in falsey_values: - expected_output = str(value).strip('"').strip("'") - with subtests.test(f"The script should print '{expected_output}' for input '{value}'", value=value): - # Run the script with the current falsey value as an argument - ret = salt_call_cli.run("--local", "cmd.script", f"file://{test_script_path}", str(value)) - - # Check that the script ran successfully and printed the expected output - assert ret.returncode == 0, f"The script failed to run with argument: {value}" - - # Verify that the script's output matches the expected output - assert expected_output in ret.json["stdout"] - \ No newline at end of file From 77b7c2327b2765d87051c941260c28f77e4d683b Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Tue, 16 Jul 2024 13:12:57 -0600 Subject: [PATCH 079/157] Remove changes to test_cmdmod.py --- .../integration/modules/test_cmdmod.py | 29 ------------------- 1 file changed, 29 deletions(-) diff --git a/tests/pytests/integration/modules/test_cmdmod.py b/tests/pytests/integration/modules/test_cmdmod.py index e66cb7d2453..4e8ce5824ee 100644 --- a/tests/pytests/integration/modules/test_cmdmod.py +++ b/tests/pytests/integration/modules/test_cmdmod.py @@ -1,6 +1,3 @@ -import os -import tempfile - import pytest @@ -25,29 +22,3 @@ def test_long_stdout(salt_cli, salt_minion): ) assert ret.returncode == 0 assert len(ret.data.strip()) == len(echo_str) - - -@pytest.fixture() -def test_script_path(): - """ - Create a temporary shell script that echoes its arguments. - - This fixture sets up a temporary shell script, makes it executable, - and yields the path to the script for use in tests. After the test - completes, the temporary file is automatically removed. - - Yields: - str: The path to the temporary shell script. - """ - script_content = "#!/bin/bash\necho $*" - - with tempfile.NamedTemporaryFile( - mode="w", suffix="-salt_echo_num.sh" - ) as temp_script: - temp_script.write(script_content) - temp_script_path = temp_script.name - - # Make the script executable - os.chmod(temp_script_path, 0o755) - - yield temp_script_path From 4e707af83b4f87741ceb1a1fc3569605fa6940d1 Mon Sep 17 00:00:00 2001 From: hurzhurz Date: Thu, 4 Jul 2024 21:47:20 +0000 Subject: [PATCH 080/157] Fix relative file_roots paths --- changelog/66588.fixed.md | 1 + salt/utils/verify.py | 2 +- tests/pytests/unit/fileserver/test_roots.py | 10 ++++++++++ tests/pytests/unit/utils/verify/test_clean_path.py | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 changelog/66588.fixed.md diff --git a/changelog/66588.fixed.md b/changelog/66588.fixed.md new file mode 100644 index 00000000000..6bc72eff59b --- /dev/null +++ b/changelog/66588.fixed.md @@ -0,0 +1 @@ +Fix relative file_roots paths diff --git a/salt/utils/verify.py b/salt/utils/verify.py index b3fe6c02c60..247f947b7b6 100644 --- a/salt/utils/verify.py +++ b/salt/utils/verify.py @@ -521,7 +521,7 @@ def clean_path(root, path, subdir=False, realpath=True): Pass realpath=False if filesystem links should not be resolved. """ if not os.path.isabs(root): - return "" + root = os.path.join(os.getcwd(), root) root = os.path.normpath(root) if not os.path.isabs(path): path = os.path.join(root, path) diff --git a/tests/pytests/unit/fileserver/test_roots.py b/tests/pytests/unit/fileserver/test_roots.py index a197b937eec..124c491ce15 100644 --- a/tests/pytests/unit/fileserver/test_roots.py +++ b/tests/pytests/unit/fileserver/test_roots.py @@ -341,3 +341,13 @@ def test_serve_file_symlink_destination_not_in_root(tmp_state_tree): fnd = {"path": str(symlink / "testfile"), "rel": "bar/testfile"} ret = roots.serve_file(load, fnd) assert ret == {"data": b"testfile", "dest": "bar/testfile"} + + +def test_relative_file_roots(tmp_state_tree): + parent = pathlib.Path(tmp_state_tree).parent + reldir = os.path.basename(tmp_state_tree) + opts = {"file_roots": copy.copy(roots.__opts__["file_roots"])} + opts["file_roots"]["base"] = [reldir] + with patch.dict(roots.__opts__, opts), pytest.helpers.change_cwd(str(parent)): + ret = roots.find_file("testfile") + assert "testfile" == ret["rel"] diff --git a/tests/pytests/unit/utils/verify/test_clean_path.py b/tests/pytests/unit/utils/verify/test_clean_path.py index 062821eb796..9899cbde076 100644 --- a/tests/pytests/unit/utils/verify/test_clean_path.py +++ b/tests/pytests/unit/utils/verify/test_clean_path.py @@ -3,6 +3,7 @@ salt.utils.clean_path works as expected """ import salt.utils.verify +from tests.support.mock import patch def test_clean_path_valid(tmp_path): @@ -15,3 +16,10 @@ def test_clean_path_invalid(tmp_path): path_a = str(tmp_path / "foo") path_b = str(tmp_path / "baz" / "bar") assert salt.utils.verify.clean_path(path_a, path_b) == "" + + +def test_clean_path_relative_root(tmp_path): + with patch("os.getcwd", return_value=str(tmp_path)): + path_a = "foo" + path_b = str(tmp_path / "foo" / "bar") + assert salt.utils.verify.clean_path(path_a, path_b) == path_b From 2595d8ea150d22041871f361fcab60cbd10a52e0 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Thu, 11 Jul 2024 10:40:46 -0600 Subject: [PATCH 081/157] Fix nsis installer/uninstaller to close when it's finished --- .../nsis/installer/Salt-Minion-Setup.nsi | Bin 71876 -> 160468 bytes .../nsis/installer/helper_StrContains.nsh | 52 +++++ pkg/windows/nsis/tests/clean.ps1 | 153 ++++++++++++- .../config_tests/test_custom_full_path.py | 30 ++- .../tests/config_tests/test_custom_master.py | 16 +- .../config_tests/test_custom_master_minion.py | 27 +-- .../tests/config_tests/test_custom_minion.py | 21 +- .../config_tests/test_custom_rel_path.py | 16 +- .../nsis/tests/config_tests/test_default.py | 13 +- .../tests/config_tests/test_default_master.py | 11 +- .../test_default_master_minion.py | 13 +- .../tests/config_tests/test_default_minion.py | 11 +- .../nsis/tests/config_tests/test_existing.py | 13 +- .../config_tests/test_existing_custom.py | 16 +- .../test_existing_custom_master.py | 16 +- .../test_existing_custom_master_minion.py | 27 ++- .../test_existing_custom_minion.py | 20 +- .../config_tests/test_existing_default.py | 15 +- .../test_existing_default_master.py | 15 +- .../test_existing_default_master_minion.py | 21 +- .../test_existing_default_minion.py | 15 +- .../config_tests/test_install_dir_custom.py | 21 +- .../test_install_dir_custom_master.py | 25 +-- .../test_install_dir_custom_master_minion.py | 27 ++- .../test_install_dir_custom_minion.py | 25 +-- .../config_tests/test_install_dir_default.py | 12 +- .../test_install_dir_default_master.py | 14 +- .../test_install_dir_default_master_minion.py | 25 ++- .../test_install_dir_default_minion.py | 14 +- .../config_tests/test_install_dir_existing.py | 14 +- .../test_install_dir_move_old_install.py | 13 +- .../tests/config_tests/test_old_install.py | 16 +- .../config_tests/test_old_install_custom.py | 19 +- .../test_old_install_custom_master.py | 19 +- .../test_old_install_custom_master_minion.py | 30 ++- .../test_old_install_custom_minion.py | 19 +- .../config_tests/test_old_install_default.py | 20 +- .../test_old_install_default_master.py | 18 +- .../test_old_install_default_master_minion.py | 29 ++- .../test_old_install_default_minion.py | 18 +- .../config_tests/test_old_install_move.py | 18 +- .../test_old_install_move_custom.py | 23 +- .../test_old_install_move_custom_master.py | 27 +-- ...t_old_install_move_custom_master_minion.py | 34 ++- .../test_old_install_move_custom_minion.py | 32 ++- .../test_old_install_move_default.py | 22 +- .../test_old_install_move_default_master.py | 20 +- ..._old_install_move_default_master_minion.py | 33 ++- .../test_old_install_move_default_minion.py | 31 ++- pkg/windows/nsis/tests/conftest.py | 211 +++++++++++++----- .../test_manual_custom_full_path.py | 14 +- .../manual_tests/test_manual_custom_master.py | 9 +- .../test_manual_custom_master_minion.py | 18 +- .../manual_tests/test_manual_custom_minion.py | 9 +- .../test_manual_custom_rel_path.py | 9 +- .../tests/manual_tests/test_manual_default.py | 7 +- .../test_manual_default_master.py | 7 +- .../test_manual_default_master_minion.py | 7 +- .../test_manual_default_minion.py | 5 +- .../manual_tests/test_manual_existing.py | 7 +- .../test_manual_existing_custom.py | 10 +- .../test_manual_existing_custom_master.py | 10 +- ...st_manual_existing_custom_master_minion.py | 19 +- .../test_manual_existing_custom_minion.py | 9 +- .../test_manual_existing_default.py | 9 +- .../test_manual_existing_default_master.py | 9 +- ..._manual_existing_default_master_minion.py} | 14 +- .../test_manual_existing_default_minion.py | 9 +- .../test_manual_install_dir_custom.py | 41 ++++ .../test_manual_install_dir_custom_master.py | 53 +++++ ...manual_install_dir_custom_master_minion.py | 54 +++++ .../test_manual_install_dir_custom_minion.py | 53 +++++ .../test_manual_install_dir_default.py | 39 ++++ .../test_manual_install_dir_default_master.py | 47 ++++ ...anual_install_dir_default_master_minion.py | 47 ++++ .../test_manual_install_dir_default_minion.py | 47 ++++ .../test_manual_install_dir_existing.py | 40 ++++ ...est_manual_install_dir_move_old_install.py | 42 ++++ .../manual_tests/test_manual_old_install.py | 37 +++ .../test_manual_old_install_custom.py | 40 ++++ .../test_manual_old_install_custom_master.py | 48 ++++ ...manual_old_install_custom_master_minion.py | 52 +++++ .../test_manual_old_install_custom_minion.py | 48 ++++ .../test_manual_old_install_default.py | 38 ++++ .../test_manual_old_install_default_master.py | 46 ++++ ...anual_old_install_default_master_minion.py | 50 +++++ .../test_manual_old_install_default_minion.py | 46 ++++ .../test_manual_old_install_move.py | 37 +++ .../test_manual_old_install_move_custom.py | 40 ++++ ...t_manual_old_install_move_custom_master.py | 48 ++++ ...l_old_install_move_custom_master_minion.py | 53 +++++ ...t_manual_old_install_move_custom_minion.py | 48 ++++ .../test_manual_old_install_move_default.py | 38 ++++ ..._manual_old_install_move_default_master.py | 46 ++++ ..._old_install_move_default_master_minion.py | 51 +++++ ..._manual_old_install_move_default_minion.py | 50 +++++ pkg/windows/nsis/tests/pytest.ini | 1 + pkg/windows/nsis/tests/quick_setup.ps1 | 154 +++++++++++++ pkg/windows/nsis/tests/setup.ps1 | 37 ++- .../nsis/tests/stress_tests/test_hang.py | 26 +++ pkg/windows/nsis/tests/test.ps1 | 50 ++++- 101 files changed, 2427 insertions(+), 651 deletions(-) create mode 100644 pkg/windows/nsis/installer/helper_StrContains.nsh rename pkg/windows/nsis/tests/manual_tests/{test_manulal_existing_default_master_minion.py => test_manual_existing_default_master_minion.py} (83%) create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_existing.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_move_old_install.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master_minion.py create mode 100644 pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_minion.py create mode 100644 pkg/windows/nsis/tests/pytest.ini create mode 100644 pkg/windows/nsis/tests/quick_setup.ps1 create mode 100644 pkg/windows/nsis/tests/stress_tests/test_hang.py diff --git a/pkg/windows/nsis/installer/Salt-Minion-Setup.nsi b/pkg/windows/nsis/installer/Salt-Minion-Setup.nsi index 59ca96c76f66254a725947f6071510bfa3e2eafc..4fa08425d1339d7c98f988cb240704c89b193848 100644 GIT binary patch literal 160468 zcmeIb`Enh{mF|nbPsDu(n50{>+oUFsI>+5XagY$^6a;9sI~bRez`<;h5}KeSt9|@H z=Oynw>sKE>=E|(B+O;ra9ma2u$~{mW&HNl@b|r~TU$F@SGI0%UER92_5W=BkKy0XwjRc}JoU|R*PX4q!yWhH z&b_S%@yz9|n{og4*14_StuJG2M!Y%P|8(oycz1%w3`grTT_&Gd+`e5rt!22Ju z%KiBEQmo+Hg>zg99NdVX2Lbi9txvc96#xI_2>x#acQ3boh&f)w$oB`#><=>?#`t`9 zf9vxBTMy&!9|D^Df!Xik4(|UZzW;MvU&QCa=KYxKAbz&D?!=fcgRVT`HCznXp~16& z|Iyap;@>jtUy0Gq2J{DOLM~jN1=zn1Z2!0>^f!Z=y8~a|JrnqU9^8XYfaBKVpqn9I z=#Sg+|5>2M^Q3{+TglzfL}z0SFG3G|vnCy+#cvH<_285>(Y=5Uy8y>X>)hYEu=V%Q zC4C$5kA>Q(UISy@9&Am~tDnWnZiFtCcEeVk4~=*?`1U^oXO9MmwgaYzVda2uJNWtO z)|1edFXKDzukXD!=*s{Xw#j|A`TSaEuiLnpj-WT!AcHI9o?C6WQ zmzjWodw&+cW2>IU$kXRzfj)>yr)=BD)gMJ z=jyxvw)NYsUpJ$|%YqgP>~H;JplSIO9y%C(swXZ7w!c66uI10CvHnN#J)YN(@&6KP z6>d6=XW=vizQN)C;B!L}{7F1IdGRyeGXDA1fxGz&eYG9h?)UM@n0iZRoyPEALQ{Ws+>1{X zE67f)UgJE4&&OJ>23{Wrce4JME9k!zI$>`at*-^&VKtCPs148T#^3+77QM%#c#JWX z=I@=N&9#7PFKB_!NhEYN{4}KO-xEcqM?Oh9%tP}25nuKtOq4-OA%B^>rMZx?n&ah} z!1>6NVySX(D+$&&cOrsY&B%qbuS>4Wbjmhw(y&D+4i7cjssCU z_DMiBr(wsd6MoCeTCLeygHHzECv@$%!KL2~ z7NE8xQ1yfGH{O5s4^G-1{MeGM!NN0xco<)S*&ZHg8uB^z@LD@%81O?LHa6@}0XJj$ z*-aoLTk$9~-#1(D1cZ1PkKzYE;$?iZ9dq(OQYsw}?w<_Vo3COGJn>`P@m)Mkwqkqm z>iG1__@``%Vv8rk-%sNSY@wdyuO;g{*HGYAjE+|WrsY+vid3ND90tz?pFIlLq0e4W z`^#82Sit^&9XMGs6H*Q(Svj6@JqCIUze@J9j;qEwGi&K};Jy+w90WB=ge0i{&ne7m zj>Bdj25&RxL9AL*xeQx7!AV$L$prdbx?uI1=j3sE?p7;kHu&%S8UGQC+o1{J$7h4g zXML#{^-Wj>EBV(@Vby?#o4{c$amRZ3uI_BEI$i58pl23 z5vHEa*4R(o8T0{vNkP}3#h~)mfQ^6W<7x8K%8f{a$@_vE{}wV&z5re% zB4T~mIcWhtQIwJ~>wHS)-|<*;oKVl(XPHN-UpX!SzHycW+rPd~{4xt*_qTJS)j4Ecs9@l&M3QloFI=Yh!I?8V(! zU#N;5J~*=BaLIPi|9S8OSu~_uyu)3h`}YIhw+F6y^2%@dEIx&UfiBO)Q%{CZ`1E{? zem&sD&!EDh2o0KIcR!AAT@T_fDni&7zPl9v@HvR(i7}x$*(cS8-aFC|$^tP{tD%I8 zn=uMr%sVq$D&P6e0C}d3@;gt$gVjh62E1s6Q~cw5Ol#kFk{T&P&HBq6%e2zm^I0=x zTogT%KZU~5A`gOx;7#L-Pcv-3uV@=QEAIM7^<;j=>#}CN(80g&VYHp#m45^_E`-i* zdA>x8(m;N$y)urncOHWg&&3b_-x#hJB6?t!4~G9g9RB}k`2W|#|GydjSDvRG-+xQT zUI}R=BIrYm9r$pFf<74je?RQlg~*l?7yV}V|F;284`Zz2+90FC$<#dsW1^n*$5Lz^ zhpUYVUt5f{5P=QyCpSY&-47jrANn$A-g>3fLQK1&^DYj&hL$@V^q^|B&jz0DuIlI(-ma7HmvQ{GIT4j^72TM{{BkqWAo6?RB|K}OX=~;(A>YA;M5j|E1~Nj z1#QXbQQ_b(d=zW|lCqQw=4rZAK9eca;rZ?dhRs=ZH0Ie9{bH9V~$GBrXBP_x~;a ziP~P@&M>d@Z;HuOdv^R@uei@6Wt~?dCqiWkdS4&%BUB3ANd(<*2iKNWUWs@OTl{sv zY)=5JK8a_tSG6v_ug3FKCz%~t`O832ue#L?P&QW-3Vb|4{EEgQu2q+%YV5{Lelm|- zMwz+;EstOFef-Z%hR_q}+gtAj=E_=C z|9rUhi{aTR9kV$XWGJX(QXTl=MCPJ$bUCsXNQ75c&sI}l9n5BJmZ^7dz-Z=P>{FTF z*)K5P^8rjlG;hJ_JRNTgIuk2tUM;+{jAL#Dp0Fa+GttXv5d4@Y!GYqBqB+E;XW54k zgm@5zi|H;X-A&tJcfJjsL#>UhRnCpQ8S8T{F0Ts6{W&~AH~6zblKg4bMT%s}>plof z{WY|(aFR#q-%qshEXMyat`BFQE^V@v7AgK>v>{qP@{NUNaApp)cOy7;=3-y|U?Vc0&T`fMvDz$UJLH z+nrbex=eNJKBQT)$e3im8hrTQS+=9+2PmPOFkR=(?gXar-R0kK2lyakZ|f?$pXC(- zp|dW|4-{W*o%qCAN3cZ>oDLB0)IyUhGod=CG&}qbuBNz&?iu0^dT5l*b3YExyOyVU zxbI<5pw4Zwx(wGrMX|?&O)Aw|sE4HgI8Z%5H&s=;IAmYGk4T;RA?y7v^tx+mL>}w` zyLcq`^dTQcO^(r?$6W8l^!ej7i(i>k!$;z@tkLVhovWR1)roJd=!)&X9q3KF@r zuuj$e&_OQ)hI+3U@cj^LLB1LLQP|D*BJyEox}b;z>&{f@ZK$LP=`|2EJ0Ulv((1dU zO~Hjbr&iIp#m3$d7W(sv+gL+^3>)G6F!S>JS0g&_#OJw(>9b+|beh8(?8eZDXgq0g z{6CEccC`C&KUV+EQFl6a1Klp{!N=0`d=4&OR4}+&puG1|t?SCt2h~`ae?Jvuzq zP1qsNi+uw2Z{j!Qckpinue$lA-?xVt8cvps6)pEwtdyO3is?L~uZlDuR(k@;D&HO8 zI2RVNz;!OhRz>haWJx}c8Ltk}A6blB;k{)J@c8HBnGa&D54QdgziD0OG3bqjf(wd$ za`pV-fO)6_e?v>+MSOZ_^=^#$w}9<>_=}49J)^Im#=ZCr&w_^VjJgF`nd+BXp<(O6 zPHbrnmiJ5wKa8T@VbAER*UYNhHGeY59s4ffQ}rgockrCobS-do+%+-xNv{d(X`K$u zunVST>phSK&z2X@LYyl}l!nafuO;-aaX%i8BoS%V4pl4xon^hXf%j_x;eK45VTXp$ z9*>S5QTLDjFpT(hXmcb-9v?752X%_l2PG<9ju~HW{d3$`#`R~P3?uBu4D9h0R;FMx zuITL8A4a#%@i(_(9PxU_OzCzlI6@Z44DcjWnVM6ONxyqeaof~f;=&ImI1n8B$v*~< zQOywE$Phn^&h!tDx^A_9`i~)_J=j)BXHUPNNqS?kM&j0+aV>kckkbArXzUk1M^f(BClon_Cm_|7?QQtw&eXSnXaqvxF0 zEH4GAQr0K)89Z+}x)VAApMWzC@R7)U7p)+R*7h0au~uhqIgQ|Q;G11(Kr4Owm@c@-MwFSeo%oL|n?csX2QyB*Zj*Ma7InM0mXGIq*r|Wr&NKPLAAB|RM8q`wqPeD(4+oy@|Uyq>4 z_%8S`EE#7R-{U)1<2!3RbUU(k5R}gOTua*&fBPvvV?O%r(Yij2UOo8yqllcv>9vk2 zYsk>d=a~C2ao)=1u(}UJ3W;mwg~^UD8yh)9cbDvJ-Put?USs5BX3v?prE}j7nIZdw z9>*rFw_?{CGw)|?J&3AwJ$|cMkX+%tmods?ZHK=_1@qcHmu^Xu2%k^RJz4+Gv>dWzg%YjBx4rskJii!si!ttDr# z?4x>=+2yKw>9d$!Hf=jN2HVT|0(A4R8-{+AOpobEVtrV#n~pQ+ccH(54yC;#Ih8li z&i*nW!m9)qmaJYZ9Nj_sgA z^C0vux!t^?T2mHzE~9=D&;Bj>AXtrBuI-of`5mv=ko;5dYb%|Gu9taM56QwsK;85XVdU{7XTQd4It{GV|d)YCN@pwL@&o*w(LwFq)&Ysn|&<^Wq@~?t(!5F)_ zl{3Q5^(AU7L)re+_D(t3ItI>nUkaTtmOPzTMCPq;llyRGOI>V~viT(^j%6z=q<%sT zmt1o8?Xu0@+@9VFeNKGNo-S3>a`eMzcj6o6ybl8ca@eXdeDO--U~wIXXHSeQn=}5s z5&Ag#A}p^uSRBVP{x|U%bSs`BHl@Yk^Oz4jO>4E9|If0uUKi5!HJtJ+eOtZ$>?dQX zkplQjrz;h&l!}VFG?g_%Udf{?>uv6_5S{yy3bLY?E@IiSgkGdoPUB(?bt;p&h)EYwQVlAUJ|pJL;BjxxH~uW z3#zt@<|5m#9H#1^n^=bZSX+^n<@UfZ&Ba;1=j_=BLv|W=LY|aP2hhoNp3T?S!6`+q zmc_Vz&uBW@&E8Gx3(a#e8G@7cl-A+=dFZ_2w{mgP{*&Z_s^HV`L2JoaZR2XI{L|+_ zrfgmx&Xe`4)}8w}UX}d$aV(TAg{tbZk=oTq4!T4it#z&Qx>TOZSwxNuEQijn_jB^+ zV-`V(Z~t;w5EF)Sfp| zK6NLvuA%e>|E>?vew;p7d!}sOPnI}VJ zVV$!d)GqG&w^RrY{lyTSTJsF~;r3)k+D2YESUM;wXu=P+e`WmRx9nH`>FFIt;@&OB4=Cy(Om`51vbBp#i- z#GFfdFS6XF22?Ue&MM`aR$ie;_chPZ>b*Q)zj8m-@3?IA0>3j`trqFWmmWQHQBPMb zfxq9$Kz7)>y*yicT|N8i^)Y+zuGO={9iP3j?^)O8+)nPeoZ|v($d&{0xS4ZXI)RHh zd)MM_{rQ~pSa+rxPqn@7_edJnDHu=Q8}N+2PR%?;je1p%2;^z6Llto4xqJ2ddY(=A zsnv&>r|QvrtME?zI$|=`e1${sgr&Rhh9xb##avUOUXrVP^P1Qr8#k?#tY2@+v{}BY zYheduTjp?oy3qFhS-ys>hpk^}71jbZ*vKDkQJpiZ0U$ zQ~D^cBWu`FIe^Bp49jK$PsQ7)HT9cjMUQ8Lmg&DK${f#9ESr0dr)$d1NygL)rg*C! z`FPfQeQQwrWN+<(-sFdu(T^|Q+5=m=`daI`%IfdbR&DkHS zSARU4rDzB2^&=QV2_B~G8{cW1ItK|}`PXKpb+5lgCi^}s`A)js?u|!F;Gm6b@iyrnLTV*V+78&<~7^^=LZ{fN13M#+zx4b{}u)ZAn(uw(?@PqIf zF2^2NaJv_j;xxKj!PUQrwOtCXc_-+mw*;}{nT~XJ`>FzPJNg@Ybh;Gx9mKPAn_rJ{ zl+R{I^W*qw&r?_hF>*3Bli_?3)EA_dJmh0J#O$yJTD>_5{_!~T(6QU#-2tC-5YFGR znyddY)OY9mHwsack zZQ8@2<3Xo)z>ic8*?}P+1drp#qcaCuY~GG>AI0}&9C~TcYwXX+cTcbJo!~7_eAP~W z&NN|1v+(Qjt*cz00yZ>@bRlc*Q(L3tUic+6F8&d3Qutq6{}TV#y8JXKcPUmR+GV_X zrp$Z2Y+#npb$E|)<-cgv%$?^)X08Wh)Vg_hGUqsyH=)!qMoZ)J96X#yox4+*=I(hv zt9M7S;W^%}@o^*8P@kG>9JAKlqwfkw?}j``SL79Bdh~R`<~7gtW;uy$?5ee7{B70+ zU<|LGX{iRC;`e#%62byp)4j z16usc_?x}obMwo-lE=UYe0Fpuvg8bibPklFH{hRIgS`*!zAZa@cxw!610EosdY<+KK``yPxJLri zO^6)yU|OY%uY~N}3Yd8h$JDM=Q=^>YunG42Ym#O%50w?p?+i6W=r;5jQj~EB&#BYZ zypEJ00pjB4@jE-{(K~3xZ-U~I_8*5mXR9#LS_9dI8kgj1c-JKwrbih#084^}LJzzX zyu&)=G3bno?_wR&aI6T4!ZSyPwE};;ezw@W>UY7J7mG)rv9s?nW%oZFqyy}lzgcf@ z%^4>jckeJ|!47>W#$byjI{(>Ks~%b7!FH*9DJn^57dbyTx!}Pv> zW69UD+LkX?`9$U?@d{6`ju_vJGyk%mt^6A2^Be|8mv>mP-m|}&mLerWC(7`u>i4!} z`9RWl2Fs>%<=}jIE9UN2n&rV39S_!cBMc|t98|K`)=B8Zxf4+cyF*EzrTX`hElu8@p%p0{K~EHl!7Xe(tV$Xnn6=`G7S_ko_Y9vo|* zEa~~wp7t5MD)xx$9J)UoUB~Cqab{kI#HY7h3<`?c#JhFmS?VPj?lQ`>CXt`s-|4?( zEMi)GuXEuYl%EVV zq;XS^zCNZ}uT9uwjsDl(G3D3IS6hz1+p*4`WiC?oP5eS;Y&kDs)e4_w9&V}ZC~2L! z=4dlLbN$p56~=Tr`w;@txD#IC;o!mI+u+ms#9{d~KGRdwKKpBOomy3szlR@oH@y0* z;jwX&JrM@g40fZ-gKEDgb|^hm+@(&HPhy0f&|P#O?8Po-x_pXnbUQrJm#?Zfp1c0^ zA4h&vjd5jBc|!ZK>dbxV@HkBQ(z#43{Mnn~Zph)2$Rj)&GQ^+7Z#M!DhP1_k-oyG} z=u-PM?!6W(27d0B&*WZ1&xMo_2a(@Xq^Q^rczo}@;I$?9>ltN<&5h??Jt;37SUi?K z@!LIkI@`8l9hYQJR@(#Y*OS2AVf+t&__WQZu{vrV^Ep4qDVt1{p9 zc)==-=_SopGPfD=?6;L5{)#)&# z39cZ+`ye=jnp|D$?suBhRR8-ck4RWNj1doyY-Y>1`E2)JMy>Cc6BwMQqVQ(9oSwtD zYBf@yYMyiMJvG7+b!hiD$hWGcv#e6SR6G9?jo6Mchpi?2b{v|~AN_qu%Nz{G9`lTC z@hXaGhM$gJn*TV|$|KC->9lF3{-M*Pm1g+qXr=j&L#sT(acLzzZvUj#1K>!tiQ{PL zcFf~=SXoNvGI+JN$Xy8TPu-4PP=5>?w%OTFrONV2SY)5iUhIc-d!9Gjvz`p)@1e;~ zmGP+iQ|h`FRt6-YLFQ>H62)7Xm(VTfBd7XXMFg40&C50zYt( z>`eXC{l5{V`8BP8L*kd<-|kuV`uMq;aifTob!A@a|4<6LD;o2rR;0 z@R<5a9uIO;#`c@y$zh|3m=`@I=EB)*7D|Fgk8#GYla_=_?ahu7@l*7 zR0|b$jG2I@mq(TkBo9>AYJk;!G5f>1v8Uvs`tGRriRS#<3K1dfNeUk9xlNDT2?#?ph^)W*mrPklgofCOJxNYwhjcP4$w&jc3 z_0>Uh%=67UGFEHWpF+lJ2;R!rlD&*)LB_^@nq{zLadgVYVQ9gfkouxw(TZdNN>A^N zK`%TCJyU8ARD6*CtOJl{9&xZQSK^K`w^pgNFNVfaSemwC7 z5AhqP4e>Uwi*cnh_Humpe%$@Zkq-G_u-&fb*@o4#s!Gnh8PZn25dYK_p+0|-|NnN# zUdR@f?nb))TPs{LZnd@}ipH|mJC&yUwciP?$@tV)>DzcZ*bb;fSB%dic^F;|@&3c0 zA09Z}+jvGqs(+8qdbGg9<(wpXt)IrdoQ(0Sc#0DxJ{X;mVd-GJ;u(Gz&yg>!@#lNt zc6K@919O%`=~{43r1+}JR~Y_2@@1YtLCN6^x;EU0C3t=6h$@@S{l6jG~l5c4blpXjxLr1?XBQp|pqK6!%G76rv zcI9a|rQ_5VF3m45tn6dd&Ylv5eG~g0;eKM4R?`w|t`nb@=u~UsY2G|a?zV+4zaOsn zX!$K5ta%Qj)+xw2xnu3xuGdgB3!~)-T@cPeH8=NCYC2DVHve?!EYzD$fW~xnpNI0L zR6sA zJx#>h4V43g*R}3Bs!xwx^z3{$LWX)Z%=5701t2%UN;HzzB>-eD0OPqa{@ z5&6v8o4DB-(J#ZdIS5UoDvLAa#qv7mj77&16yEG^?Mpe~gDKIp{T?+oG_d}+DP5X_hl%wOzyXxdY;RS=m`<y3vH~N{uHyVOwxA@&iul3i0|Fv|NY_`qAWDDLZ{B6D_Cnwb`0r z3&n3b)2*ESls~o4Sj#;5iyoIq7mQEfLc<&mk?lc8KQU5oG<1dKV&_Qbs3Xtz({iEg zvvUCbPA&Wp?#I7yg&uDMKc{CEki;HT;8?p+@5Iw+Z88t+5VIX;(xCLO45x+_D!6^b$NtwX`<5Eqq6I*Jxr~t>E=_;T;Ju* z1?*?_iJtI*G2B*k$yn+P&6@9fu=HSGTH&oD#yooFm~yg|b(611zvN6Aq2lqN6>`oG z%YsxB@#J|lQhyB^*){6%40TrVF!-SO_kCO6a=3iLex4ebax9Y9Gry~;KTAKi%`9zB zXN({D>U)7boeU{oJVT_@?xv!}K7OUQ3w{*`)>u{V=c5U^(Fiph`FU0{wHhKGXSQp( zcHc*9BZyy0j#xIKRD$f+yc^@vhYUvG2>Np#M*XJ;$1=QRSrBZB{)I1FUvN)Om$ zz2MT8ikZisg{|vRpw!RC{NpYqo*O^g=SuwdTF2q9)jBq7K-)~>cRCPR1KiWc7yKe= zo{DeCM$wnd7)9IQaXcNoRQql6RH=T*i&L~z`rJy_=6L1U#H@9tpO@@b?P($;(-2S1 zHK%*0z2UJ%EYv2e^D=aLo%O8cx8%=S4p=o#K8GdOM%r;|Jhsr}C$p#7!!#pZ4&Hf~ ztYLnBTy<(^(>Y_VQuX<-&-3Gvl%sP`t#vQ?G^Fg|P@BcafZOS0M2D8_XPs^DL(*FB z{#w-`nMcm|)g!aE9-p?R)Pk^+z zdW_l=d4Ukm1;3nLBu7aZGQ}Q1B+sr?(zB+iIXLUKu{N!%()nKKnl&k%Nj`}^Yt!iw zT9~G^J)^O*=TSc?*z|cNI;Ym0TEjHoL4%J<>d@6~rAec9(H_|9C%9U9k>qI!hj1~^uGMZ^cJsm`xyw~(Rm6&@H@LwoyvG6(nP z7Z!_sXm^3m&q*#8*ww``WzqUpWt07-UXMo1Jec9kIUetEE`C8dBjq%^W#IO_2YY|W zlSvY4KLQ>k0;YQrZU&#KW&6ZH=SI;|V-D$KH{)Z>D>dCt1`l4bF^+VS1=Vh~TVd1r z+q>6xBM*ElxcD#eDHdiq4C`2=K5k@Bw1;IWuVhWgN^KYVGt6V(n1Yr>G|PBn-0QZ< z+%@GlTb1G8jMCF{o-AeOGrD~pnqh0D)X_#AnUW*SF(W(RpM|VDuZf)?yHf8G?Nd&C zNz5y*Z0*_9_iao$jylPu5!SdF%JYHIy}_$H8~t3;%PoYq>Uf@YU()OA<8p71x))jqr~9|y zgRC2;`?jp>e1$e=qi3qm%gQSjULI3tf6(t_{q;sPdFHumY}{*B^S*JRxro44cWWKD zOUrXkX^H&(*dw?XzK7nhW*M(NjgsFKucHN(i3O9`Lw#QS-WIPlhTxK-A^LmHgf~1? z_dlZ9_+53Q%*|yiJw@g~U1H-pH}C$j-r*G9+wsHc#XgBwc4*aezMEL8-^WEp5$Ne0 zIR`poZvFqO{cdhP}OYrYVk#WP-)aeFneOdtBRPCwhLt*N&Y78E|8 zTBUbE(*MbwHNT%tde$qfdm6pYu^hCgc)tlNy%(IwPA~lSZ@1JXK|kd5DnE~ygm~=AtjISNSvVGM3i6d$b~+82jVGBT@Vx1IvFJq^0!R-5qw!@^}3X zFnJ(zXGF+qloN4P71ndp7_1{Y-3|Sp2JY+ckaOM`@I3x^cOL8Gtz|!t|9>C*q*$BQ zlKluq9eYRO+~PCN@rH9@@5c;z3kh||p#qW@HPBYa<0 z<#$gZFHi*?M3)ICoVD@Kv>(^Ue;xtdA%8=;Rh_vRt=P;7*{rM*^#uW2ns0ssv2Sgl0gJs2;hdMK<_{K^D}XMh5jx z@a3%|tMl*iJr=A;%gcyCu$f4QVp{CZvydFUMY4QO)rR@7uh?nw)8B-A@ps*y4Qx8~ z@oB(@=fU`{mZ@_H%i$S4au3=^Ll>|jNv!FQG3$46We<)kW_}(#YziNE5%#EhDL+@< zN6T!|8qfoMJWW+$cJ{ zXy+F(YR-}6758mI>#wyVXq_b&YkR=FtW>=JAl3qZm%W_uI{hmCrq+wVvRPh?CuLud z{exlef@{wX<>!r80#x-rBwHb0 zPap2hV6OAz8QQV`)~C5WwI2R6|H=E?9rOU&;?ILLIJR+?Q2dmio5x&TEj4ZXpVn`7 z>Er8aPqidT@y&kVjcy}ZTv>S8+S0YC@41_bt=@l)=l4aW{pc(!CtazF z3QXV^ViWL>GEK_;%g?30HFzM}-N+vIxm=F4UCE_*2im#NcRB@1{+c}gEKxPLnG4tn z0Ed{{YA#r^-;X?4jSpEDz1NA|@)a#tRi5m$R} zEsn5;@OAObYZ?=AfhkTz;9YNyYx8x4HEtY87{X8CeCip?HC_Q2IRZIyoDyM~n^kYgh4~gD0+pbUz5)!@2Lb<2Q2S z_^*2t5Et%y%eCzpU2i(qqOIUavP$Y?hldY>U&zbh%i(+c^qhP-U^)m+6?E8K!={M2 ztl-1QSG+&`^r3#s&FJC2j(gL&nG@59)yX}RcSaY#S=^k@huV$`=vz*H)87r-m$cR1 z1o}=LfyJYc53RnhzIJ<^-i35Bd4K}p)%Z*B(IYDEZEM!{1K(=mv#g2XTdIdsedFhY zJNJ&df$$vEhr;eB;=IST$deTv?k^!)fz8+(|Vf z?|5pX*Ze*LiCxvbqO1cP?hIERt1pFlv~i?!FGlxRkA|E^ z9zEk{esn0H4k3IY;onpMkModoBE$IXaMdZvc>39O4+WT}e*re*7N6qkpM|Nha&lyR88eFF#nZqY|QuR2GdUN0yWzX{Lb0fja z>r(~|o~1X>HqVcJOP9I5)eI*=9b?v4M%xBmQY4*_eRn6 z0=D$dBe>>yaMh3bX0uAxEa4ScP@iU6}-M}>C*|U<{C|bT(yq2HnQ%DYT6pxuQMtw zm>cK3dD|A1x4*=dF8a4Qa457|Z<&sLp31WS(^PJ>g0T)U+-OKidy&PK)2Afd+F?q{ z*Og({-Pe;^Ltz`dp4`3;sWgOBb=E!%Z*xGFz;T}7?8{YOAC$T|+$xD9qRqX`@<`aj ziaqk)rz}g7S>=V?r~P$|r@nH%UxGXZUA5YihA)rBw%sM$LoWv3Bi;BVd&9kLXAo9f zZ}Xzdkjep&0~foI@uc{jPuf#Ffs!$$J%}X~yQ?o4KXH3FD_x%o(*Eo^kK3N5Vb!?L zkFpOw@xkMOQ}F9Gsz;J-b?##??iKDCqi~2d`jkh( z%+jo^uk{g^c#*=6JxON*GPVkox|g`;MbKgDObYz>=kcRH(i?#Zdi-;oi*L^id6t$Y zr3347%myaCli@HZT7S~^@VC+i7pt~V@*x-E-I;mkc*%{JCjAa8Ng{YcZafqClf)cu z{cF%RudJsvdL34ComK5A>F%<^v)hdr=k}|9R)pk3HBMl8FyPvFTeYrLC#=^USa~!sIX!PVS#~v#H>VObszei}N&*$}cHmNLENw|)bKv;;Oh z%QV{IX3Q*4pxCW^QY5P_W78}8Bw)nHSzY%V`_M=&P)q+wW7PVn)(vQ#k|V6|bmVp} zM*BEC7Hb~%c9gExsk07Sd)|(HF1(*S>KHEZnxJd3dLeu?yfN?dEBm+bHlaA!dmKN| zM3$M)%6SLYr&yhW|0^->z4#lS10KT83!CyeS~%J~B%I6qm*OA$F7@7adB^Y~=bG?7 zc5Ft04WIJ8@Z_{Zdc5DPo%L_A_x`s5B^gFxvBt*SuE)O}z2|Ppv)kb#X|DP`5zDw{ znnq=J5WY5a9Pb-CDK0x66eq=%I+seEX+5%va!WM8YT2D$KQNsQN-TwBIW_v;RIP)Q zpRYgD46VG~4jrKw0{;q)P`^hC4Py_v=#n~@j7~x$;lb7Y`r-N)p(_a((@;x z*Xu!R=h?>VbA;K)SpBr>HCSr*$YxA=B&;6VUsWkZfvuNpTheAFYn=5)@5AZ&4g$xu zpFBT9jc2c5D%#$QH8GR+KJ+V=EyfOCVWPk0J_K*`gwUc->z^)9xSSuc?{$5=Pkq(Y zN)4^g4JXNuwXT|iO3^qOMY2+TsNVAEPtBv&S9Mm!pZbavwZ3%bWPP7cn#$kiQO5B` ztL>DZp0^XL;K6GXWs?3MjxBPXjzvh;28yV0I4)6TIsWLMsvCT*NO3xAQ$JMaDF{Uu}@GG<#Gp2TU= zc}(+fUlNO+H4gyW#o$CTALA36iD4A~v=Zid;I&P&B3B1|9Y!vMlbybdiW_si2#78X zV?GbrJRdSbj!XQAPUrln-imjJ`&i-XbE6%TXUfpwM@L$w9`T#+T_q8#>|CEB?TJix z0|sioS7W7Qp-a|(o>H~`gDM&s+v+z(YE0#~SSgv)GQQU-3`)!Eo_8w_u5&}&O|Df> z5iJ2VXS~$wa8D#QcJp&($Q{j}Gd1>EYDkm?s6P|#GEad&R#c+=F;*10lfiX;(=ySg zbg|QxJ#~R9J6L8SGf*;}%r>uiI^FuuM3ttQTyeTr%zv<>Hbr2nofv63y^SriOy)g zdnPb5e-7vC=a{=uIq98Ox(t%d>_J~s?}ol3CP80c9VA+Be^RE^F)Dlaz6xKT*b-j{ zJ(PV{xa~LG!FmUj^@>4MQl~k;p0<5d*@2#5&D*-^%?T|**}6# z0|T}EqHnR(=)LcUyrwKQr(R%_dpM+PN$0rOoA7%2_xp5FuPd)bzCk&2Nh1_!6@9-y z^h)LD`Z(y%FYDfp+~=Ch!3)|)CyyP^ojx|zlkw&8Jl*#NuaKAEj3=EEU-!4m`}CMs zVjMq@jiIxKHRW}|9k=5?_Oj#?AL!2^0|+11eTDgHuu^ISbrqmga(gw`Jc>OQU{Pgm zNu^^7K6tO)yLu@`-V1MDvZ(*5yn}7_9D-qZ3K~p7)@BQ!kVXPSl2P+z>miDM^!c&3 z2KtqVAK%K)l?*6dH?CqF4Bd@O;Tn5_#;>V$E4adM_04v@#;AS&x&03wxs@vSeVvO_ z8_PR8-AhN-LEQ=3+r+A&xcgN5opUXB89U<7srL;SLSM(7bZA-mw&N~3Kjmvr3-r3` ze7~=AU3N>l={|hbY1j7T;b9xwxyz33JoVV=w>hn0C|MnPd1^O$zONVII8uSX;oq8K zwH@$S(pa|#E$9w4>EN;c0YiMC)RhAlvM z-4Cu_Hvh$#hqD;O-N+;7A97XQTqj3jYu}A=Yt3{&DC#EaP&}XP^IeDt|4#h)6mUl^<*f|L2_qHAqkJYyt?Z6F60gSiSOcPje3k*v;>#=c zn$mQ&RpMlg@;)duAb#?TqcYot6KlxtcDy`j z4f^c`-Bg7@enuHjz3EqC74rWyrhG}@?ZJFL@T&JW5H}EualiIMLD6F69ZzuGIl{fh zUS-`?t69Q#)7HL?Y*bZYWXF|SwY>&163~$yHbgZ#W#!8O2UB<;j<+RkJ-w-CdR@ti z3EmlSM|OkABxBP2#oN4G83Fg)b(pdRV_$%k(EY5K3y)_Cu3Cn2A1h~?D0=;Tz>rV9 z<8z-I&_6H0zJN|fs_o78*3aTxXgv3N=Ib%XxZ}W@gb^>t%I%%={JP^(z3E|Lov~ZL z{J7%@v+{|0W99XqRMg=yUsv?u`NmO5OT!)ppw5!G4E;1Gmv{%*BD4~_cF+K-1X7jaAr@J8+@@(vTlvuc?exF-h zgPD`&J}(=tvtX6rxhbkIwMB47>HM&q%R&&1I7b7%>ALxG&|S{Q*HwclSTgt3y&jgA zRk$W&Q0hT-gia>1hNC|koU{}xWGT=&cyh||qiwOo>sRK?F?mejaAi##jLskT!nB`& z;VCSSwfR^|YRp-~Wts?gy*bdwWyEZk)|0)S6?IHHHLpFQ^=2v=#u8V#ztJa1Yy!>B zV67!1j)sbD#=hfmu+!4#nf2Dy*KDl?t|_Km*~wbqc81L?@bVR&oQGRL=8re$qm z=Xley-KS-d7F(&j_MZP#x&z48i8T50a1S5B#DF5ZKsF$EdNemDg^Fda~zwYleKTzMJ1qwX}N6Gc9(okvs8^9F(h{Z_jE{ zT~9HvPC7>(71vrb@@?DM0XAi2-=5WEPUA}5>+JprLf#LGAH*B6k>XZEDbss)R{>022ll${CewKJ%bt@t!Fb!9dZR4aK;*hn-hnT z_ZP0W>Q94CoCv`l7ST*pHCB9WF}W^fbvk9CERn@3`U0D}6AarFfBX9nPk`gF0VlE4Hl!7mHyxIpQrH4GsTm^qb->HRs8;Kc=k1Q$h>K$DbM`TP=zrM8N)nN{PUX6 z@;ya2;0rJR0h(Ju^XI{Lie1Zo1bBuBrskR{3NUBk!3>*np46DUy4GvI5T4)|W?;kb zGB3z)Z)wtc^P2grd+*kO))49yE*N4J#>n~jZ6~mRT+xGx_V};B%eXJI?kH17A@3FX zH1K#kPD8#NS1Nm=g}i5|`=qj&tDkFWkfB}uG_oSPuJ;_XuK(QaL5CuZwGXul&b{FN zgSGIYCu;9^*(@KeHP7Wi2hu5u#nh@YCgB(Nl0aRwFd4{_Z+87IKUFlyD*ou*+2e>j zIxtC((Z#E`0;ua42n%P6r}g%ynw!O~qCb&q4dvA5WA2_Fr|?%jes67-O^sF}P(#(y z$dO9M33{<~3;4+zzW+7!WjeFrS@RXl@}u4c^;ta$-hkrrE`)<;gT}xkK!an)Rbgl$ zBBt*_m9g_LG4>P%loNGEdOJ4+M%KByg%us1x56`PpxIS??W7c!G5YJK8&y=en zcCUuC8g#Z-q~1MfZL8_*RzD)8YU{OTcxAIoZ!h2F?}21@cvc?T9Srcf zd~9aOt1gzksRHC1fXNh~2 zf6JZnhI9&xvRAsxG260d>zZWLs5pqWB4o0zSbX9Rde~j<7%1qp4@CHDA_! z_Ez&}886#g{~WWmE4&fw#475Cb=1#1+WODnb951sS?3Sh{af`)iGA=(shMZ%#a%rw zVs6zn=j2sr)##$Uvf^h*L*;Lcrzt)$E?Uc8#xHaF-u16w8m;gms86RK);-&O=_6%% zYOITQ_G6dd9LA>kH(Ev7!NxmY~KVvBd~Z?le)e7^C&H>2Ki zFSrr8L#CvW{WhX@g{%w70Hfol(Aj?StHGx_2pOe{!!BKWTMt8`HI7GHU2T{jM|@TC z`eVohRXywOU>o%=9aRch89$qzG&`PG+U!AKRd0GE5+J_BGkb7^s|Vr3=dM}4si}eO z=6O|%)XSuuX=k6mS`O;*O`(o81hoo!6R>~82H3(m9`JKF2W#PeuTKKg=1}N_i}iLJHw|_=cCXSGd}tBRy=t#MkmTq z1rT|Xm-cXwh?cVSbiotk7KMjPF*4n3bEl(_DdDuSuj8pNhLwF0zsXZ&Huptmn?)3h zgo`JEFH3wmw}2k$sa59_sK6(F=+$BVWpu6IDS$kha%0&MHu^PuVsduLd>(jH=HQ)x zn)({&2a(Q0G?RY6cpY1;V>$ck=q z%;dUV*45P1sav3z#RGWwb*+E2 z{%(vQP8v(@PRvn!?_!BFq`QIpypI_Rn5BPe3~~sJlgEO8UD3W1qn2~v`zO?JKR!A< zad(h7#S2fi{_W_@exwzyv&>M1#HO0sL{H>+u+`G0)C0M{jjii5f3$bUvw6IBEmM@X zZvp)9sbPepnERvnH`cc0ZLYQN(dU)j7%6A8;GM_8v(j10(?MJ9ju&qjE=DZ1;lFor z+pn~=+|WwR+$j?Cr!$nDuwz)Sg?4}o`Y?fI-f53i$|o!P7Nwi(Z)-}w8(uhXZms!I zIT-BX;lirMI+!SH^;r%+)1`dV!@_ia&zvTWc=k?%1HNKIk%6{~V4JA?F}h)sQ{W^O zo1Ml6jC!8EkhL_8EtpngEkfj{bBf3(`fSFmFE*3n+FI2-(aK_dFZQH80kCk_D!$8* zgBNMBe4hMR_Z4qO@@Q#P^;>acu`#9cSggNzz}lAcmu|;D^ac`qD=-UP6hXESTH~W( z^P8P)t80ql8-6~FMP@pCT~PYlA--jW1s0$v8m7k&+@0@gA|Yt|ure2x+Ocm1HxS9FQo%`NczZRkXC8L#cKmLsJbz#I zZya$NqvPors(v&z1%q@#o(-Px*k#l&npHfAm2oET7f0)3@9Ur9xtqfYO1C5Luon_? zIedd_!zb2nvXf(bl_BV_SDs(V1GN^j;PP%zA&!VGI%8B<#NYfnG#Kwd*qQOPS7Q#}&i<=()tGZ@hzpPQVOHnCg~i#5sm>|e z%a)dP?Ru;&fwt(@R%d677|VvZok@7lPr&~~Ddes3m}F_zI|~V!cin(!)+d_gdGZ`+ zpWfL>V`%G77%z|6mz??;oq$w-*4F~2PVE_}>xq1XY$CLPt5(C&N^m`H&1tVgN?!~b z^kwAOrORpv%sD;zY|m%OYxi^JxO$bY59BA#636wR&1Yq0xcl5zk1&1SmaT8uA=krd zo)0`Nv%@-LdZ`_5=jd5KsELn=cYZ1Oom_pfef3#v_lHQb?(HLsutcNRvAc29$F$)@ z0<#Cu&wMV^@SYJ*$XOLMm2x&@vD%a8yjo6iAL9sXhFz6sv=i6EK_8N@D^?~`z!0=@ zRG`p$r^d3a@i@M=M2MP3-2a}qRMPqK*76#wggDtn^Z zv&|iH7t05#0-v=bh)Qb>yjsfm);dp zK@ODDO5}IqG1wE86i@RO{@stEQ+!&PA@)_?iG2M($1I|ga&_8$Qa*KbUuW{DVXgm0 z+qQBi?15YVYwwt9xO??fnmdo5NAG9+#YO1E{j>tSQ1}Yi^p-f)eptJFtn9UvH=5iJ zeIl*|8yRXaU~TRbbm2}{Zq(1L6SnJYuTM){k{>IOD1HHcomH-gf!r&x2CHeIYrPEP z11Qn8C2wu5%1Y5WP>F0bShOtIN8(=fo96lYJU8WWWSrJ?l6;RTQtQn*Z-WSJ2`%fm z`9VDML#&?K$!V^urpfYE)z1~KsQHsMiB1oKeyz+bM+`+4la*j&(IBc`tKN^l>eC*%+jSV|zc<+ZDX4Tx9-2daB&;6@oOLPk zi=Nk8v+5d(^VBYVN9gTiXagv^$JvUkrVa+LQTi(2ZU`f6lkR z7|!?8oMb8=4;ZYidxq}h=;tWoSzu;2bO`*Vy+L&3BL7G)d|6ZKgRS3BRISl>({$_e zME_ItCQ$)8qxdb7Trvadk8<1~-w3SM-8k?X`pOx+v6h6>rZvqpA44T%7Y;j|I1LPJ z&{2N-m8XG)*+gm>JWA#dR5{S*p2DCa2FcZ2wBSq(rvuft3_DQt_i|k`o_QL^ zar9z%j0g9g+uO(*)~ASY!Z-ewv5I|=7B2AH8!DV6J2?d#Cl~-j8DX9x^d#CY+Qac0 zmf}u*fVLIB>hvrBpjI>sOj1(u{$^*m?=5M@?g>k+(IIXsmt z&uC`l>R9#5p||$-(f#?YSyS+}<3R&XHO6{^e`p7dc!Q0*j8#|V4IQiqjbwb*{%p=n zdhK|DRhBtMms{Q!JJ^!@kB0oc%^5j*g@)UIa z4$aon?9GaQhu1C7smAZS(G9aZc(>N9r8D`>!5ld2;jJHID+h><71yX1HDy7?fte5L zEP(ab<-tQGt~or)T-uZQID8`IKFJJ1iQBIYR_@)S9c1&cxSozzOvd8eQB4NCIJc4cN;V!XBwL5Jo6aR-gLc9z z*bd!^owhb98mMUVsaceKL*s2mN}@Uw=)iwy_ej2*7|== zmu9OaIGqgvYgYna=t3YtQ~zsFW~uh*y|cvFo7)rlm#A6o4&F30HAm!Ke!2siUfuHV zEv_CMSs7W39?XWNuldTZKt_Htv2Kr1?r!z#JY3Te;3vT;SYypjj*6^HJDNFpdX@dv zZ8CbF@^=$guhPr&-(MQ7?qbk?FFr+L&|1jO!2~5rJ=~JHDs#?#ecjuqN*|Lshd!>- z85a3OB@0*2J(b1iW8C`NI&*0Su75gQe^s2LhPE>I&DDU=YhQ*&yEy0yYG{49%Sme2 z2E2p)z8x*LUr?Y2WJ{;D<+!#|*M=;q*nvF1I#`H<$TVeoJ&4>Nc3;`so(AdTZto}y zA-`4`HTmo0CWsV?t??~0hOMioG2O>%ABHOfEuC|d7tR5BL25QxinV?Or^Rk4VMoKM90^1o?A6ps*TOIR|Iq+Q)QjLCyy|mX z|1w-RSpg6u)$)74Xh#1czGW^rqeuslTcHH9Ucdb)^Sog~?x03lk9wHU!l&`Wx}L^- z%9hmLy`pW_Tvh=NupX>TyVbc%nULbk^Ms!!FDOmLNa(lTy1h2mFS_b~qOk81Hu}_s zwuQc?^SQ8H`njir=(j!gn42TJxFq6PA;+l%wQ?4Y*~j2grt^zr=T{C}#QYYv2~@ z{KUL%X`ei8TLX6XV}(m?OADXRQfu(GTLCh>FtY>_7``t#5B`6(8lZ7#IEaAaXyChg{q`Yag%AUbG@$#SFza(VELz z*I9$tBnw?m5T9SoYTL&e(9xVg()T#1W#{4-3?Gx?a z>*0Xx`5cyhHTbaT5a*zEM!CGscFo`ljzQaDL7}+%`mz4`9Mn}_SGy|Vg;|lw{s|B5 zGyc28sTn@oTi><*749fqgoQtf6(VCg@9lWjb=J2&kF3WNtL4H_`wAxThW08zW_IK`<3H2!eI2^r~6=wsr2Q zF?V1^6hYkzx?)?34S+j(qphM!kwV)6OCY1=5yz2!Ki^^>6JHoh1<#QkY{&C_Z5Fsc zD(e8U`pl&(@rn0s6w6$!@Hl6*Bq!E~0BPEd)ezBMjceYCQNvO8W#BK!o3PhVV9U78 z{8_kq&I06XmpD9#+9smSC@C3di~0&xf1}zEzgi-ue3; zZTgCa`Qg=g#dE2pbHCDg-w!fE-tyl zEUjE)b}rTdw%b9QtWD{}W<369z)a@M9*MAvt|9wQtf}aA+R?P2$jLE}hc! zS=M`z68v;IaOOxJpM7eqjJ4ia<}Ah>`%1S4&5^O)R)pml(NAMbT{@kx{8W@n@0NMb zy;0?<)fMtQ$Ai!TWo2!r0rTeF^eqLl4&%G_`!OEwy;>h5v!<+J+}Wk|j^mg(S6vdX36FhwpGICuzrK<0xE^?74nx9Bt=C3ey?lP^Z|10SMZ(>ofv1Gm*{)Mn zN}hHFPngc|g2$rc$?}zIeLtVo$Nb&|1n{}{$k&`|=+$dz2v_y!^k=U*rfG?Qid5l_X|62Q5miyFS zEqjL2y2$YK?b?M=-owwYx`IL5fP$y#ReD`nlXwm=xt>kSPmXn4v5D}}&A>Wwlc1yq zryeXpugVMgE_p;3hu*M@uXK5z4xYbcqaVgBbDT2gZ+SFxByUpk`%xdf!g4>$+s4l0 zeAIfevSIO6lHv}PT&J>kpuIcNVb~t^L9M3ql>uY$#go|Gtv$AFR!ZLb_}!3(uD$}R zVm?*3H;?vv(0eYpRal4f_K&)tK8m?}(zLu^59sN0qUuQvLfM^nLSvLz=;P=l;v09a z=^pEtRZtfh16oHyUe{(<;aqhCWURo(8lbMa>Mq3|yZ(+;&kJ7bj8%bhDF=A0d<8;z z0c5nLZISo3%a8p|=zUpj?bowq<})hL%DMQI{yBUbg1(iw9^<+1BGZ?+aU5qA-%QX; zW~7;x!az?yyFGQPx%yE45VM_&3OjZAe*NC7sIOpjcNk5*kgngiIUDc}ry6_kG4=cl zTg)up^|R~-;!W>xKhL>y6R!&Hf)c{m(iInOXSVe;NxfcW5aB^Mfb0?wu{K$fRW)nx zn9rvcE?I@4XmxyBtAL7`i{!cA3`ntiVDz(qmfv~X+Kb`;Zw9JsW%iDdSkohqw**%B zymXux^3AXC7%-@31`IzR;!^5S7pv7S?FndMSs$zFUunmwAvOMr=F8quOQ+>B>{*MC zK>vG@=yg42poSyV*{!|{j|~@)Eq^ln&x*2l>=j~l7@^hqSw}759Ip(0Of-8T_KNzm zO|GoWV;NRF0qqtjomS`=w2bc&HeA75Ix~D<_euc$`fC8{(r<{4VV^+hdtTP{+(NyC z$H!hv))I_JS0*be{aft&z=m4?!!5>R)*Q-|;@feGfN~V?##kRtoEX%?@4t5fAAXat ztcU&wvUPj|uuM0APP4K-FR&M$hKsQ`^}E0f&(sxesO`?b3~%*Z2S&yQPI$yokerr&#H6k*O75qiJY~cpLOb6pjo#%HZ_(% zKfbIK`M~zdavcU2$)A^e@Vn@VO+zn{`?3d*9!8^Dmhd;H<0(VlUct`Y7@4#9IPFZ4 zI&z73&OfsE)`ari@zc!x>r#}nxs-vFU)hU6S4A7ZENv$(VOR>B>-vB#R<0kx2xh!* zZJg;x8`j+(9tQ}ao}Mifo676p0kD>Ju<5zbAtj3eg`8jT9rIUU74KM&;00pEiN@eE zR-$`~rsE!E_uqZ>v^;UIwtwcrJS^Cbxrn*NwxkHn&TroHWKZ?9;^V0`)EfPxfJmIY zbRQ9vP^2Thxp{m%1))E0^;b^{dv*v2i?rno&p5MFYU^U>!**&t~nz z2unsOPup6rf_46TaJbYSErGA4<&}_J_l-{F%I4}!z&G~Gv=hBlM~D@bS;Ee@e*7HV zCyh^IdmX&`8DCEeCXc@kY(3lopSf?H-i4kF8>V~(KKYPKvZ0dZlCLqh^&s~wtU#Q4 zBlvT5CbaF7_c-kp$ngbakE}o6iPg|&|26~K;%n94;8Ph;`;{l130(yNoC1&3-SBl5 zG;<*5@T{K;T?Iv}ReO0f@1*GW&*jLtc>DeQSzb@prEO>RoP>ErE#y=7AkVql9^|`A zU+z+SVA$I0Y3bc{^zG|{$@8oOTaVt$>$-hOvQGd-iS25Bv-kdP`2Ifqofxz2Sm@U} zS=+T3w`6e8B6a0Su^E|ra#&KWUx7NyJ$^G;JGykpj7i^;L2AD-HNchfW-T3hSOP=ETUgTfW%&EJ-Ane> z^$Fl7CUm4&R%pI*zTzbL%W#$q)yZ@@dR*2I|GHBY>}CwtnC(SP$EzI~4mhUv!JW}F zAJzW1ZFRRVdBrvR;T5*a_=)5`64QsHp67^vCU+>&CT@pAI68gxyUz+)w zhqBExtdpJd$VI!n{+!Qg=o7EY*G*-(wg*#DERyMW^=y`-0=~S9SZ_ekUUamxz4*;C zQ+>Ts@BP%hRQD)9-b;Zk1 zyW&-!K;^qPzqU55-py+0vaXtftgXdu4wIf7L)QAE8LB>~b5b5zZ&xhQe)+71EK{|{ zD^G&?^-hdfXXUJt*i%r-nq&xj6zH$@N^lwPd@-Mq(a^~PdA#Wr`+3usT8`eRb|a#- zTanWsU#Jrhj)M=;Rj@*jma4@>?K-`{sCynj(^zPtXyl(1Uwm)yh3hxK zz8Fpf(#gTpe{T$&&YPd~-X!(9>Wux2x&BJ;40@o}%4O`_!!M|G5(gZlo@>=N;Z;Rp zeTWNIjCW{{jZojYpYF}ku0f}h2<{ph_37^iy$V*!ePfIOLmytEzPp1&dauDwP~vdV znpE)gmPhp!UJd+Hx#fL8^heZZTKBPjWx!T`Z`pg5_PaRHw9I!gzGaqLPFLqbm|gg~ z9bAR>2j;`0-QCleLenpWNZPP|YZmja*Voa<(=r%JWLN5jHKrK7?BmQFWq$0>e?9Pp zOcF0FgQcF=qqmV*(anznPnomCP1MUWl!AY{+hZM0z8h=O+l^0$bLo^~{IkHbV_04% zx3;tYG<@1Zu|9|1J)-D(yt#?}lm5r@)lz}A!7nS8>1K_VHn}xuLHQ(ihyI7M$13y1{OW59Gz|-0`Uj1F;E~}xtTEX)*Rfl= zl&-bH58RK;5jWBs3-;+@leb1!4tzsKm8w^7O}p_qlIwSH@;A}U%jT3tL7zvE#dFt0 z{wA;Lc8rAIS>6?|C^DZ4uRLFEPd!FoCZ_qSr@`qxx)+!*cM`>x`D;$}yi4&?LoJ-l zdjY!xHogyN_Tx7sy3R}&3J^(cM>P9mT#0hzlYAL}qYE;|`&imUF7XM7@jXk8ozwPb z4_|R#&HZDj=Hyxuy`)#UkGE;=YT@W{Ta7Vs#GI7$VOXYBT6pTY*W=}yyEgG};cRqG zEnoT6+F}`yM|he(KAq=b>BNh0?_}ojRwDC#MMlo87*QC?91vM z;ivRRmX9oXXpmx8dnYq{#7(v0d*SO8I!K!+`bVn1icA3dC+{h9g_pR+Ui3UasA7Pa~LRZ>fr;@!?3+3miv7RMeRA9Rpt5e>v#{Y4(Qg4RWp`ZHmo}Q*E z^Vv$FsoL)KF>X&^V-?5>jsG~*YNjHiv8pvYmR?~M{cNLflK9_OJ zybiO6H)j>H-df*(sr}505l09KvxmQcfGzS-+%G`|Ytz{s~+-XGz zb8B2DR=ARQu3pvgZEhaBmcnU#^?Tj=vh-e9ghG>AV*VKXO_qB7=%I$~q_|;TZ&?fN z46;auReF^NoS`zxtwIAzb4LA|UR JHr;pde*qgIA{PJv literal 71876 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 L5tUU7hmQXbt=LVH diff --git a/pkg/windows/nsis/installer/helper_StrContains.nsh b/pkg/windows/nsis/installer/helper_StrContains.nsh new file mode 100644 index 00000000000..bea8ac45146 --- /dev/null +++ b/pkg/windows/nsis/installer/helper_StrContains.nsh @@ -0,0 +1,52 @@ +#------------------------------------------------------------------------------ +# StrContains +# +# This function does a case sensitive searches for an occurrence of a substring in a string. +# It returns the substring if it is found. +# Otherwise it returns null(""). +# Written by kenglish_hi +# Adapted from StrReplace written by dandaman32 +#------------------------------------------------------------------------------ +!define StrContains "!insertmacro StrContains" +!macro StrContains OUT NEEDLE HAYSTACK + Push "${HAYSTACK}" + Push "${NEEDLE}" + Call StrContains + Pop "${OUT}" +!macroend +Function StrContains + + # Initialize variables + Var /GLOBAL STR_HAYSTACK + Var /GLOBAL STR_NEEDLE + Var /GLOBAL STR_CONTAINS_VAR_1 + Var /GLOBAL STR_CONTAINS_VAR_2 + Var /GLOBAL STR_CONTAINS_VAR_3 + Var /GLOBAL STR_CONTAINS_VAR_4 + Var /GLOBAL STR_RETURN_VAR + + Exch $STR_NEEDLE + Exch 1 + Exch $STR_HAYSTACK + # Uncomment to debug + #MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK ' + StrCpy $STR_RETURN_VAR "" + StrCpy $STR_CONTAINS_VAR_1 -1 + StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE + StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK + + loop: + IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1 + StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1 + StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found + StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done + Goto loop + + found: + StrCpy $STR_RETURN_VAR $STR_NEEDLE + Goto done + + done: + Pop $STR_NEEDLE # Prevent "invalid opcode" errors and keep the stack clean + Exch $STR_RETURN_VAR +FunctionEnd diff --git a/pkg/windows/nsis/tests/clean.ps1 b/pkg/windows/nsis/tests/clean.ps1 index 9cc7bb49e8b..a9065d41dcb 100644 --- a/pkg/windows/nsis/tests/clean.ps1 +++ b/pkg/windows/nsis/tests/clean.ps1 @@ -12,8 +12,17 @@ clean.ps1 clean.ps1 #> +param( + [Parameter(Mandatory=$false)] + [Alias("c")] +# Don't pretify the output of the Write-Result + [Switch] $CICD +) +#------------------------------------------------------------------------------- # Script Preferences +#------------------------------------------------------------------------------- + $ProgressPreference = "SilentlyContinue" $ErrorActionPreference = "Stop" @@ -21,15 +30,22 @@ $ErrorActionPreference = "Stop" # Script Variables #------------------------------------------------------------------------------- -$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName +$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName +$PROJECT_DIR = $(git rev-parse --show-toplevel) +$WINDOWS_DIR = "$PROJECT_DIR\pkg\windows" +$BUILDENV_DIR = "$WINDOWS_DIR\buildenv" #------------------------------------------------------------------------------- # Script Functions #------------------------------------------------------------------------------- function Write-Result($result, $ForegroundColor="Green") { - $position = 80 - $result.Length - [System.Console]::CursorLeft - Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + if ( $CICD ) { + Write-Host $result -ForegroundColor $ForegroundColor + } else { + $position = 80 - $result.Length - [System.Console]::CursorLeft + Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + } } #------------------------------------------------------------------------------- @@ -61,6 +77,51 @@ if ( Test-Path -Path "$SCRIPT_DIR\venv" ) { Write-Result "Success" -ForegroundColor Green } } + +#------------------------------------------------------------------------------- +# Remove buildenv directory +#------------------------------------------------------------------------------- +if ( Test-Path -Path "$BUILDENV_DIR" ) { + Write-Host "Removing buildenv directory: " -NoNewline + Remove-Item -Path "$BUILDENV_DIR" -Recurse -Force + if ( Test-Path -Path "$BUILDENV_DIR" ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + +#------------------------------------------------------------------------------- +# Make sure processes are not running +#------------------------------------------------------------------------------- +$processes = "test-setup", + "Un", + "Un_A", + "Un_B", + "Un_C", + "Un_D", + "Un_E", + "Un_F", + "Un_G" +$processes | ForEach-Object { + $proc = Get-Process -Name $_ -ErrorAction SilentlyContinue + if ( ($null -ne $proc) ) { + Write-Host "Killing $($_): " -NoNewline + $proc = Get-WmiObject -Class Win32_Process -Filter "Name='$_.exe'" + $proc.Terminate() *> $null + Start-Sleep -Seconds 5 + $proc = Get-Process -Name $_ -ErrorAction SilentlyContinue + if ( ($null -eq $proc) ) { + Write-Result "Success" -ForegroundColor Green + } else { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } + } +} + + #------------------------------------------------------------------------------- # Remove test-setup.exe #------------------------------------------------------------------------------- @@ -75,6 +136,92 @@ if ( Test-Path -Path "$SCRIPT_DIR\test-setup.exe" ) { } } +#------------------------------------------------------------------------------- +# Remove custom_conf +#------------------------------------------------------------------------------- +if ( Test-Path -Path "$SCRIPT_DIR\custom_conf" ) { + Write-Host "Removing custom_conf: " -NoNewline + Remove-Item -Path "$SCRIPT_DIR\custom_conf" -Recurse -Force + if ( Test-Path -Path "$SCRIPT_DIR\custom_conf" ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + +#------------------------------------------------------------------------------- +# Remove the salt-minion service +#------------------------------------------------------------------------------- +if ( $(Get-Service -Name salt-minion -ErrorAction SilentlyContinue).Name ) { + Write-Host "Removing salt-minion service" -NoNewline + Stop-Service -Name salt-minion + $service = Get-WmiObject -Class Win32_Service -Filter "Name='salt-minion'" + $service.delete() *> $null + if ( $(Get-Service -Name salt-minion -ErrorAction SilentlyContinue).Name ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + +#------------------------------------------------------------------------------- +# Remove Salt Project directory from Program Files +#------------------------------------------------------------------------------- +if ( Test-Path -Path "$env:ProgramFiles\Salt Project" ) { + Write-Host "Removing Salt Project from Program Files: " -NoNewline + Remove-Item -Path "$env:ProgramFiles\Salt Project" -Recurse -Force + if ( Test-Path -Path "$env:ProgramFiles\Salt Project" ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + +#------------------------------------------------------------------------------- +# Remove Salt Project directory from ProgramData +#------------------------------------------------------------------------------- +if ( Test-Path -Path "$env:ProgramData\Salt Project" ) { + Write-Host "Removing Salt Project from ProgramData: " -NoNewline + Remove-Item -Path "$env:ProgramData\Salt Project" -Recurse -Force + if ( Test-Path -Path "$env:ProgramData\Salt Project" ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + +#------------------------------------------------------------------------------- +# Remove Salt Project from Registry +#------------------------------------------------------------------------------- +if ( Test-Path -Path "HKLM:SOFTWARE\Salt Project" ) { + Write-Host "Removing Salt Project from Software: " -NoNewline + Remove-Item -Path "HKLM:SOFTWARE\Salt Project" -Recurse -Force + if ( Test-Path -Path "HKLM:SOFTWARE\Salt Project" ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + +#------------------------------------------------------------------------------- +# Remove Salt Minion directory from Registry +#------------------------------------------------------------------------------- +if ( Test-Path -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Salt Minion" ) { + Write-Host "Removing Salt Minion from the Uninstall: " -NoNewline + Remove-Item -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Salt Minion" -Recurse -Force + if ( Test-Path -Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Salt Minion" ) { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } else { + Write-Result "Success" -ForegroundColor Green + } +} + #------------------------------------------------------------------------------- # Script Completed #------------------------------------------------------------------------------- diff --git a/pkg/windows/nsis/tests/config_tests/test_custom_full_path.py b/pkg/windows/nsis/tests/config_tests/test_custom_full_path.py index 05f186f6c1b..8239b548f21 100644 --- a/pkg/windows/nsis/tests/config_tests/test_custom_full_path.py +++ b/pkg/windows/nsis/tests/config_tests/test_custom_full_path.py @@ -6,32 +6,38 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config - pytest.helpers.custom_config() - - full_path_conf = rf"{pytest.REPO_DIR}\custom_conf" - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", f"/custom-config={full_path_conf}"] - ) - yield + full_path_conf = pytest.helpers.custom_config() + # Install salt with custom config + args = ["/S", f"/custom-config={full_path_conf}"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): - assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + data_dir = pytest.DATA_DIR + data_dir_exists = os.path.exists(data_dir) + assert os.path.exists(rf"{data_dir}\conf\minion") def test_config_correct(install): # The config file should be the custom config, unchanged - with open(rf"{pytest.REPO_DIR}\custom_conf") as f: + script_dir = pytest.SCRIPT_DIR + script_dir_exists = os.path.exists(script_dir) + with open(rf"{script_dir}\custom_conf") as f: expected = f.readlines() + data_dir = pytest.DATA_DIR + data_dir_exists = os.path.exists(data_dir) with open(rf"{pytest.DATA_DIR}\conf\minion") as f: result = f.readlines() diff --git a/pkg/windows/nsis/tests/config_tests/test_custom_master.py b/pkg/windows/nsis/tests/config_tests/test_custom_master.py index d332fea1964..d3bcfa65fd5 100644 --- a/pkg/windows/nsis/tests/config_tests/test_custom_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_custom_master.py @@ -6,19 +6,21 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/custom-config=custom_conf", "/master=cli_master"] - ) - yield + # Install salt with custom config + args = ["/S", "/custom-config=custom_conf", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_custom_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_custom_master_minion.py index 0a862c12c72..4f8e4891486 100644 --- a/pkg/windows/nsis/tests/config_tests/test_custom_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_custom_master_minion.py @@ -6,25 +6,26 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + # Install salt with custom config + args = [ + "/S", + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_custom_minion.py b/pkg/windows/nsis/tests/config_tests/test_custom_minion.py index 4274defbb5d..36c6595e192 100644 --- a/pkg/windows/nsis/tests/config_tests/test_custom_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_custom_minion.py @@ -6,24 +6,21 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/minion-name=cli_minion", - ] - ) - yield + # Install salt with custom config + args = ["/S", "/custom-config=custom_conf", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_custom_rel_path.py b/pkg/windows/nsis/tests/config_tests/test_custom_rel_path.py index a54969faf20..7948b04eeba 100644 --- a/pkg/windows/nsis/tests/config_tests/test_custom_rel_path.py +++ b/pkg/windows/nsis/tests/config_tests/test_custom_rel_path.py @@ -6,17 +6,21 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/custom-config=custom_conf"]) - yield + # Install salt with custom config + args = ["/S", "/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): @@ -25,7 +29,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the custom config, unchanged - with open(rf"{pytest.REPO_DIR}\custom_conf") as f: + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_default.py b/pkg/windows/nsis/tests/config_tests/test_default.py index 7681b44e52b..70ad7a1165b 100644 --- a/pkg/windows/nsis/tests/config_tests/test_default.py +++ b/pkg/windows/nsis/tests/config_tests/test_default.py @@ -6,13 +6,18 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command([pytest.INST_BIN, "/S"]) - yield + args = ["/S"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): @@ -21,7 +26,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default config, unchanged - with open(rf"{pytest.REPO_DIR}\_files\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_default_master.py b/pkg/windows/nsis/tests/config_tests/test_default_master.py index d978f7b206a..9bdfca3ffe9 100644 --- a/pkg/windows/nsis/tests/config_tests/test_default_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_default_master.py @@ -6,13 +6,18 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/master=cli_master"]) - yield + args = ["/S", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_default_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_default_master_minion.py index 4a23c362995..b04896a000f 100644 --- a/pkg/windows/nsis/tests/config_tests/test_default_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_default_master_minion.py @@ -6,15 +6,18 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/master=cli_master", "/minion-name=cli_minion"] - ) - yield + args = ["/S", "/master=cli_master", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_default_minion.py b/pkg/windows/nsis/tests/config_tests/test_default_minion.py index c3f165a8ef9..7959c26e29b 100644 --- a/pkg/windows/nsis/tests/config_tests/test_default_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_default_minion.py @@ -6,13 +6,18 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/minion-name=cli_minion"]) - yield + args = ["/S", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing.py b/pkg/windows/nsis/tests/config_tests/test_existing.py index 64baced527e..479792d0172 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing.py @@ -6,17 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/S"]) - yield + args = ["/S"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_custom.py b/pkg/windows/nsis/tests/config_tests/test_existing_custom.py index 6fb147739f2..46c552d0b9e 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_custom.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_custom.py @@ -6,20 +6,22 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/custom-config=custom_conf"]) - yield + args = ["/S", "/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): @@ -28,7 +30,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the custom config, unchanged - with open(rf"{pytest.REPO_DIR}\custom_conf") as f: + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_custom_master.py b/pkg/windows/nsis/tests/config_tests/test_existing_custom_master.py index 78e80cea265..3eb53d45cf1 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_custom_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_custom_master.py @@ -6,22 +6,22 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/custom-config=custom_conf", "/master=cli_master"] - ) - yield + args = ["/S", "/custom-config=custom_conf", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_custom_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_existing_custom_master_minion.py index 66e36c41262..bb6ad116ca0 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_custom_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_custom_master_minion.py @@ -6,28 +6,27 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_custom_minion.py b/pkg/windows/nsis/tests/config_tests/test_existing_custom_minion.py index 545e8219537..a7f8e342452 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_custom_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_custom_minion.py @@ -8,24 +8,20 @@ def install(): pytest.helpers.clean_env() # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/minion-name=cli_minion", - ] - ) - yield + args = ["/S", "/custom-config=custom_conf", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_default.py b/pkg/windows/nsis/tests/config_tests/test_existing_default.py index aaaa2622e02..fba4e1a1c06 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_default.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_default.py @@ -6,17 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/default-config"]) - yield + args = ["/S", "/default-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): @@ -25,7 +28,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default config, unchanged - with open(rf"{pytest.REPO_DIR}\_files\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_default_master.py b/pkg/windows/nsis/tests/config_tests/test_existing_default_master.py index 456080e4996..dc02133f8c1 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_default_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_default_master.py @@ -6,19 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/default-config", "/master=cli_master"] - ) - yield + args = ["/S", "/default-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_default_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_existing_default_master_minion.py index 90d262e9b0e..74b95290a8b 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_default_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_default_master_minion.py @@ -6,25 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/default-config", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = ["/S", "/default-config", "/master=cli_master", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_existing_default_minion.py b/pkg/windows/nsis/tests/config_tests/test_existing_default_minion.py index 16e41035c66..cdc22e421e9 100644 --- a/pkg/windows/nsis/tests/config_tests/test_existing_default_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_existing_default_minion.py @@ -6,19 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/default-config", "/minion-name=cli_minion"] - ) - yield + args = ["/S", "/default-config", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") + # This will show the contents of the directory on failure + inst_dir = pytest.INST_DIR + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom.py index a2fce64fe36..e11895122bc 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom.py @@ -10,24 +10,19 @@ def inst_dir(): @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - + pytest.helpers.clean_env() # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - f"/install-dir={inst_dir}", - "/custom-config=custom_conf", - ] - ) - yield + args = ["/S", f"/install-dir={inst_dir}", "/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") @@ -37,7 +32,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the custom config, unchanged - with open(rf"{pytest.REPO_DIR}\custom_conf") as f: + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master.py index d47abd1df83..267bf516eb9 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master.py @@ -10,25 +10,24 @@ def inst_dir(): @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - + pytest.helpers.clean_env() # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - f"/install-dir={inst_dir}", - "/custom-config=custom_conf", - "/master=cli_master", - ] - ) - yield + args = [ + "/S", + f"/install-dir={inst_dir}", + "/custom-config=custom_conf", + "/master=cli_master", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master_minion.py index bf039af4c20..a6919a822c7 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_master_minion.py @@ -10,26 +10,25 @@ def inst_dir(): @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - + pytest.helpers.clean_env() # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - f"/install-dir={inst_dir}", - "/custom-config=custom_conf", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + f"/install-dir={inst_dir}", + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_minion.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_minion.py index fcdf2146e0a..7f46ea88def 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_custom_minion.py @@ -10,25 +10,24 @@ def inst_dir(): @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - + pytest.helpers.clean_env() # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - f"/install-dir={inst_dir}", - "/custom-config=custom_conf", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + f"/install-dir={inst_dir}", + "/custom-config=custom_conf", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_default.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_default.py index ac3c403e2e6..f5674685243 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_default.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_default.py @@ -10,13 +10,17 @@ def inst_dir(): @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - pytest.helpers.run_command([pytest.INST_BIN, "/S", f"/install-dir={inst_dir}"]) - yield + pytest.helpers.clean_env() + args = ["/S", f"/install-dir={inst_dir}"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") @@ -26,7 +30,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default config, unchanged - with open(rf"{pytest.REPO_DIR}\_files\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master.py index 2ac36f87e27..2de9fe76a95 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master.py @@ -5,20 +5,22 @@ import pytest @pytest.fixture(scope="module") def inst_dir(): - return r"C:\custom_location" + return "C:\\custom_location" @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", f"/install-dir={inst_dir}", "/master=cli_master"] - ) - yield + pytest.helpers.clean_env() + args = ["/S", f"/install-dir={inst_dir}", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master_minion.py index a2996764dd6..9ec9d329bc2 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_default_master_minion.py @@ -5,26 +5,27 @@ import pytest @pytest.fixture(scope="module") def inst_dir(): - return r"C:\custom_location" + return "C:\\custom_location" @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - f"/install-dir={inst_dir}", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + pytest.helpers.clean_env() + args = [ + "/S", + f"/install-dir={inst_dir}", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_default_minion.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_default_minion.py index 6f8f9dc8590..dbe73e7e24c 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_default_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_default_minion.py @@ -5,20 +5,22 @@ import pytest @pytest.fixture(scope="module") def inst_dir(): - return r"C:\custom_location" + return "C:\\custom_location" @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", f"/install-dir={inst_dir}", "/minion-name=cli_minion"] - ) - yield {"inst_dir": inst_dir} + pytest.helpers.clean_env() + args = ["/S", f"/install-dir={inst_dir}", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_existing.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_existing.py index f28a61de692..f785dc2d94c 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_existing.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_existing.py @@ -5,22 +5,24 @@ import pytest @pytest.fixture(scope="module") def inst_dir(): - return r"C:\custom_location" + return "C:\\custom_location" @pytest.fixture(scope="module") def install(inst_dir): - pytest.helpers.clean_env(inst_dir) - + pytest.helpers.clean_env() # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", f"/install-dir={inst_dir}"]) - yield + args = ["/S", f"/install-dir={inst_dir}"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env(inst_dir) def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) assert os.path.exists(rf"{inst_dir}\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_install_dir_move_old_install.py b/pkg/windows/nsis/tests/config_tests/test_install_dir_move_old_install.py index a556a2c3a98..b2423996600 100644 --- a/pkg/windows/nsis/tests/config_tests/test_install_dir_move_old_install.py +++ b/pkg/windows/nsis/tests/config_tests/test_install_dir_move_old_install.py @@ -5,24 +5,23 @@ import pytest @pytest.fixture(scope="module") def inst_dir(): - return r"C:\custom_location" + return "C:\\custom_location" @pytest.fixture(scope="module") def install(inst_dir): pytest.helpers.clean_env() - # Create old install pytest.helpers.old_install() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", f"/install-dir={inst_dir}", "/move-config"] - ) - yield + args = ["/S", f"/install-dir={inst_dir}", "/move-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") # Apparently we don't move the binaries even if they pass install-dir # TODO: Decide if this is expected behavior assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install.py b/pkg/windows/nsis/tests/config_tests/test_old_install.py index f4ac2f8204f..2db0aa56e4e 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install.py @@ -6,20 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command([pytest.INST_BIN, "/S"]) - yield + args = ["/S"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_custom.py b/pkg/windows/nsis/tests/config_tests/test_old_install_custom.py index 4e3dfdf3f78..3c792052acc 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_custom.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_custom.py @@ -6,23 +6,22 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/custom-config=custom_conf"]) - yield + args = ["/S", "/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") @@ -32,7 +31,7 @@ def test_config_present_old_location(install): def test_config_correct(install): # The config file should be the custom config, unchanged - with open(rf"{pytest.REPO_DIR}\custom_conf") as f: + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: expected = f.readlines() with open(rf"{pytest.OLD_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master.py b/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master.py index 441221e9841..094642bf899 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master.py @@ -6,25 +6,22 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/custom-config=custom_conf", "/master=cli_master"] - ) - yield + args = ["/S", "/custom-config=custom_conf", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master_minion.py index 0eb22436351..bee83a7ee9e 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_custom_master_minion.py @@ -6,31 +6,27 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_custom_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_custom_minion.py index 0f265fd4fbe..e542f799a4c 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_custom_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_custom_minion.py @@ -6,25 +6,22 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/custom-config=custom_conf", "/minion-name=cli_minion"] - ) - yield + args = ["/S", "/custom-config=custom_conf", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_default.py b/pkg/windows/nsis/tests/config_tests/test_old_install_default.py index d3aed4f5fb1..e5a85d6ceb5 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_default.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_default.py @@ -6,20 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - - # Create old config + # Create old install pytest.helpers.old_install() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/default-config"]) - yield + args = ["/S", "/default-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") @@ -29,7 +29,7 @@ def test_config_present_old_location(install): def test_config_correct(install): # The config file should be the default config, unchanged - with open(rf"{pytest.REPO_DIR}\_files\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(rf"{pytest.OLD_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_default_master.py b/pkg/windows/nsis/tests/config_tests/test_old_install_default_master.py index e0546759046..998dc23c57f 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_default_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_default_master.py @@ -6,22 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/default-config", "/master=cli_master"] - ) - yield + args = ["/S", "/default-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_default_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_default_master_minion.py index c4f418a4a19..a08306c7911 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_default_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_default_master_minion.py @@ -6,28 +6,25 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/default-config", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/default-config", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_default_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_default_minion.py index 563b8125b48..5365800667e 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_default_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_default_minion.py @@ -6,22 +6,20 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/default-config", "/minion-name=cli_minion"] - ) - yield + args = ["/S", "/default-config", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move.py index d5328d82b3e..aaf1a10f9f3 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move.py @@ -6,24 +6,24 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command([pytest.INST_BIN, "/S", "/move-config"]) - yield + args = ["/S", "/move-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom.py index eadd2fd10fa..11ef683ea3f 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom.py @@ -6,35 +6,32 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/custom-config=custom_conf", "/move-config"] - ) - yield + args = ["/S", "/custom-config=custom_conf", "/move-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") def test_config_correct(install): # The config file should be the custom config in the new location, unchanged - with open(rf"{pytest.REPO_DIR}\custom_conf") as f: + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master.py index 5d0aa67d52a..9698bcdce4a 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master.py @@ -6,35 +6,26 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/move-config", - "/master=cli_master", - ] - ) - yield + args = ["/S", "/custom-config=custom_conf", "/move-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master_minion.py index da3e2916eb6..01ab2117630 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_master_minion.py @@ -6,36 +6,32 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/move-config", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/custom-config=custom_conf", + "/move-config", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_minion.py index 621c840ccd0..e3c4ed35b15 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_custom_minion.py @@ -6,35 +6,31 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/custom-config=custom_conf", - "/move-config", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/custom-config=custom_conf", + "/move-config", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default.py index 216a0b40c50..b0151e83b8f 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default.py @@ -6,32 +6,30 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/move-config", "/default-config"] - ) - yield + args = ["/S", "/move-config", "/default-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") def test_config_correct(install): # The config file should be the default config in the new location, unchanged - with open(rf"{pytest.REPO_DIR}\_files\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(rf"{pytest.DATA_DIR}\conf\minion") as f: diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master.py index 1d2d2a158c5..73c09cf6851 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master.py @@ -6,26 +6,24 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/S", "/default-config", "/move-config", "/master=cli_master"] - ) - yield + args = ["/S", "/default-config", "/move-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master_minion.py index a46e1e5243d..95fd52594e1 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_master_minion.py @@ -6,33 +6,30 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/default-config", - "/move-config", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/default-config", + "/move-config", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_minion.py b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_minion.py index 2fdada9f21f..3691b2366d3 100644 --- a/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_minion.py +++ b/pkg/windows/nsis/tests/config_tests/test_old_install_move_default_minion.py @@ -6,32 +6,29 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create old config pytest.helpers.old_install() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/S", - "/default-config", - "/move-config", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/S", + "/default-config", + "/move-config", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() -def test_ssm_present_old_location(install): - assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") - - def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") -def test_config_present_old_location(install): +def test_config_present_new_location(install): assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") diff --git a/pkg/windows/nsis/tests/conftest.py b/pkg/windows/nsis/tests/conftest.py index 5fe43bdb428..be44a7c2221 100644 --- a/pkg/windows/nsis/tests/conftest.py +++ b/pkg/windows/nsis/tests/conftest.py @@ -1,4 +1,5 @@ import os +import re import shutil import subprocess import time @@ -49,16 +50,33 @@ INST_DIR = r"C:\Program Files\Salt Project\Salt" DATA_DIR = r"C:\ProgramData\Salt Project\Salt" SYSTEM_DRIVE = os.environ.get("SystemDrive") OLD_DIR = f"{SYSTEM_DRIVE}\\salt" +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +INST_BIN = rf"{SCRIPT_DIR}\test-setup.exe" +PROCESSES = [ + os.path.basename(INST_BIN), + "uninst.exe", + "Un.exe", + "Un_A.exe", + "Un_B.exe", + "Un_C.exe", + "Un_D.exe", + "Un_D.exe", + "Un_F.exe", + "Un_G.exe", +] def reg_key_exists(hive=winreg.HKEY_LOCAL_MACHINE, key=None): + """ + Helper function to determine if a registry key exists. It does this by + opening the key. If the connection is successful, the key exists. Otherwise + an error is returned, which means the key does not exist + """ try: with winreg.OpenKey(hive, key, 0, winreg.KEY_READ): - exists = True + return True except: - exists = False - - return exists + return False def delete_key(hive=winreg.HKEY_LOCAL_MACHINE, key=None): @@ -66,60 +84,97 @@ def delete_key(hive=winreg.HKEY_LOCAL_MACHINE, key=None): parent, _, base = key.rpartition("\\") with winreg.OpenKey(hive, parent, 0, winreg.KEY_ALL_ACCESS) as reg: winreg.DeleteKey(reg, base) + assert not reg_key_exists(hive=hive, key=key) def pytest_configure(): pytest.DATA_DIR = DATA_DIR pytest.INST_DIR = INST_DIR - pytest.REPO_DIR = REPO_DIR pytest.INST_BIN = INST_BIN pytest.OLD_DIR = OLD_DIR + pytest.SCRIPT_DIR = SCRIPT_DIR pytest.EXISTING_CONTENT = existing_content pytest.CUSTOM_CONTENT = custom_content pytest.OLD_CONTENT = old_content -@pytest.helpers.register -def clean_env(inst_dir=INST_DIR): - # Run uninstaller - for uninst_bin in [f"{inst_dir}\\uninst.exe", f"{OLD_DIR}\\uninst.exe"]: - if os.path.exists(uninst_bin): - run_command([uninst_bin, "/S", "/delete-root-dir", "/delete-install-dir"]) - # This is needed to avoid a race condition where the uninstall is completing - start_time = time.time() - while "Un_A.exe" in (p.name() for p in psutil.process_iter()): - # Sometimes the Uninstall binary hangs... we'll kill it after 10 seconds - if (time.time() - start_time) > 10: - for proc in psutil.process_iter(): - if proc.name() == "Un_A.exe": - proc.kill() - time.sleep(0.1) - - # This is needed to avoid a race condition where the installer isn't closed - start_time = time.time() - while os.path.basename(INST_BIN) in (p.name() for p in psutil.process_iter()): - if (time.time() - start_time) > 10: - # If it's not dead after 10 seconds, kill it - for proc in psutil.process_iter(): - if proc.name() == os.path.basename(INST_BIN): - proc.kill() - time.sleep(0.1) - +def clean_fragments(inst_dir=INST_DIR): # Remove root_dir if os.path.exists(DATA_DIR): shutil.rmtree(DATA_DIR) + assert not os.path.exists(DATA_DIR) + # Remove install dir if os.path.exists(inst_dir): shutil.rmtree(inst_dir) + assert not os.path.exists(inst_dir) + # Remove old salt dir (C:\salt) if os.path.exists(OLD_DIR): shutil.rmtree(OLD_DIR) + assert not os.path.exists(OLD_DIR) + # Remove custom config - if os.path.exists(rf"{REPO_DIR}\custom_conf"): - os.remove(rf"{REPO_DIR}\custom_conf") + if os.path.exists(rf"{SCRIPT_DIR}\custom_conf"): + os.remove(rf"{SCRIPT_DIR}\custom_conf") + assert not os.path.exists(rf"{SCRIPT_DIR}\custom_conf") + # Remove registry entries delete_key(key="SOFTWARE\\Salt Project\\Salt") + assert not reg_key_exists( + hive=winreg.HKEY_LOCAL_MACHINE, key="SOFTWARE\\Salt Project\\Salt" + ) + delete_key(key="SOFTWARE\\Salt Project") + assert not reg_key_exists( + hive=winreg.HKEY_LOCAL_MACHINE, key="SOFTWARE\\Salt Project" + ) + + return True + + +@pytest.helpers.register +def clean_env(inst_dir=INST_DIR, timeout=300): + # Let's make sure none of the install/uninstall processes are running + for proc in PROCESSES: + try: + assert proc not in (p.name() for p in psutil.process_iter()) + except psutil.NoSuchProcess: + continue + + # Uninstall existing installation + # Run the uninstaller. + for uninst_bin in [f"{inst_dir}\\uninst.exe", f"{OLD_DIR}\\uninst.exe"]: + if os.path.exists(uninst_bin): + install_dir = os.path.dirname(uninst_bin) + cmd = [f'"{uninst_bin}"', "/S", "/delete-root-dir", "/delete-install-dir"] + run_command(cmd) + + # Uninst.exe launches a 2nd binary (Un.exe or Un_*.exe) + # Let's get the name of the process + proc_name = "" + for proc in PROCESSES: + try: + if proc in (p.name() for p in psutil.process_iter()): + proc_name = proc + except psutil.NoSuchProcess: + continue + + # We need to give the process time to exit + if proc_name: + elapsed_time = 0 + while elapsed_time < timeout: + try: + if proc_name not in (p.name() for p in psutil.process_iter()): + break + except psutil.NoSuchProcess: + continue + elapsed_time += 0.1 + time.sleep(0.1) + + assert clean_fragments(inst_dir=install_dir) + + return True @pytest.helpers.register @@ -134,12 +189,15 @@ def existing_config(): @pytest.helpers.register def custom_config(): - if os.path.exists(rf"{REPO_DIR}\custom_conf"): - os.remove(rf"{REPO_DIR}\custom_conf") + conf_file = rf"{SCRIPT_DIR}\custom_conf" + if os.path.exists(conf_file): + os.remove(conf_file) # Create a custom config - with open(rf"{REPO_DIR}\custom_conf", "w") as f: + with open(conf_file, "w") as f: # \n characters are converted to os.linesep f.writelines(custom_content) + assert os.path.exists(conf_file) + return conf_file @pytest.helpers.register @@ -158,25 +216,78 @@ def old_install(): with open(f"{OLD_DIR}\\conf\\minion", "w") as f: # \n characters are converted to os.linesep f.writelines(old_content) - while not (os.path.exists(f"{OLD_DIR}\\bin\\python.exe")): - time.sleep(0.1) - while not (os.path.exists(f"{OLD_DIR}\\bin\\ssm.exe")): - time.sleep(0.1) - while not (os.path.exists(f"{OLD_DIR}\\conf\\minion")): - time.sleep(0.1) + assert os.path.exists(f"{OLD_DIR}\\bin\\python.exe") assert os.path.exists(f"{OLD_DIR}\\bin\\ssm.exe") assert os.path.exists(f"{OLD_DIR}\\conf\\minion") @pytest.helpers.register -def run_command(cmd): - result = subprocess.run(cmd, capture_output=True, text=True) - return result.stdout.strip().replace("/", "\\") +def install_salt(args): + """ + Cleans the environment and installs salt with passed arguments + """ + cmd = [f'"{INST_BIN}"'] + if isinstance(args, str): + cmd.append(args) + elif isinstance(args, list): + cmd.extend(args) + else: + raise TypeError(f"Invalid args format: {args}") + run_command(cmd) + + # Let's make sure none of the install/uninstall processes are running + try: + assert os.path.basename(INST_BIN) not in ( + p.name() for p in psutil.process_iter() + ) + except psutil.NoSuchProcess: + pass -# These are at the bottom because they depend on some of the functions -REPO_DIR = run_command(["git", "rev-parse", "--show-toplevel"]) -REPO_DIR = rf"{REPO_DIR}\pkg\windows\nsis\tests" -os.chdir(REPO_DIR) -INST_BIN = rf"{REPO_DIR}\test-setup.exe" +def is_file_locked(path): + """ + Try to see if a file is locked + """ + if not (os.path.exists(path)): + return False + try: + f = open(path) + f.close() + except OSError: + return True + return False + + +@pytest.helpers.register +def run_command(cmd_args, timeout=300): + if isinstance(cmd_args, list): + cmd_args = " ".join(cmd_args) + + bin_file = re.findall(r'"(.*?)"', cmd_args)[0] + + elapsed_time = 0 + while ( + os.path.exists(bin_file) and is_file_locked(bin_file) and elapsed_time < timeout + ): + elapsed_time += 0.1 + time.sleep(0.1) + + proc = subprocess.Popen(cmd_args, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + + elapsed_time = 0 + while ( + os.path.exists(bin_file) and is_file_locked(bin_file) and elapsed_time < timeout + ): + elapsed_time += 0.1 + time.sleep(0.1) + + try: + out, err = proc.communicate(timeout=timeout) + assert proc.returncode == 0 + except subprocess.TimeoutExpired: + # This hides the hung installer/uninstaller problem + proc.kill() + out = "process killed" + + return out diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_full_path.py b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_full_path.py index 6c543c1ccf9..1c2c160651f 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_full_path.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_full_path.py @@ -6,14 +6,12 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config - pytest.helpers.custom_config() - - full_path_conf = f"{pytest.REPO_DIR}\\custom_conf" - - pytest.helpers.run_command([pytest.INST_BIN, f"/custom-config={full_path_conf}"]) - yield + full_path_conf = pytest.helpers.custom_config() + # Install salt passing custom-config + args = [f"/custom-config={full_path_conf}"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() @@ -27,7 +25,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default, unchanged - with open(f"{pytest.REPO_DIR}\\custom_conf") as f: + with open(f"{pytest.SCRIPT_DIR}\\custom_conf") as f: expected = f.readlines() with open(f"{pytest.DATA_DIR}\\conf\\minion") as f: diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master.py index e95df53ff11..a93b7b68dbe 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master.py @@ -6,14 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/custom-config=custom_conf", "/master=cli_master"] - ) - yield + args = ["/custom-config=custom_conf", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master_minion.py index b6fbc71d778..5ee86d2bb41 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_master_minion.py @@ -6,19 +6,15 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/custom-config=custom_conf", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_minion.py index c90bfb159cf..2a91d9fedf0 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_minion.py @@ -6,14 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/custom-config=custom_conf", "/minion-name=cli_minion"] - ) - yield + args = ["/custom-config=custom_conf", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_rel_path.py b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_rel_path.py index 61458486a43..bbb949dc2d3 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_custom_rel_path.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_custom_rel_path.py @@ -6,12 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/custom-config=custom_conf"]) - yield + args = ["/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() @@ -25,7 +24,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default, unchanged - with open(f"{pytest.REPO_DIR}\\custom_conf") as f: + with open(f"{pytest.SCRIPT_DIR}\\custom_conf") as f: expected = f.readlines() with open(f"{pytest.DATA_DIR}\\conf\\minion") as f: diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_default.py b/pkg/windows/nsis/tests/manual_tests/test_manual_default.py index 3ad8cbde51f..b3cd13cc038 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_default.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_default.py @@ -6,8 +6,9 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command([pytest.INST_BIN]) - yield + args = [] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() @@ -21,7 +22,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default, unchanged - with open(f"{pytest.REPO_DIR}\\tests\\_files\\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(f"{pytest.DATA_DIR}\\conf\\minion") as f: diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_default_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_default_master.py index 1b819c7db7d..5935981d362 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_default_master.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_default_master.py @@ -6,13 +6,14 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command([pytest.INST_BIN, "/master=cli_master"]) - yield + args = ["/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() def test_binaries_present(install): - assert os.path.exists(f"{pytest.INST_DIR}\\bsm.exe") + assert os.path.exists(f"{pytest.INST_DIR}\\ssm.exe") def test_config_present(install): diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_default_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_default_master_minion.py index 101238d4623..acd4d313b4f 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_default_master_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_default_master_minion.py @@ -6,10 +6,9 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command( - [pytest.INST_BIN, "/master=cli_master", "/minion-name=cli_minion"] - ) - yield + args = ["/master=cli_master", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_default_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_default_minion.py index 538b6328968..79d9e452dc1 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_default_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_default_minion.py @@ -6,8 +6,9 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - pytest.helpers.run_command([pytest.INST_BIN, "/minion-name=cli_minion"]) - yield + args = ["/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing.py index 926637081c0..a150adb48a8 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing.py @@ -6,12 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command([pytest.INST_BIN]) - yield + args = [] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom.py index 6d164e98a9c..af6292cf282 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom.py @@ -6,15 +6,13 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/custom-config=custom_conf"]) - yield + args = ["/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() @@ -28,7 +26,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default, unchanged - with open(f"{pytest.REPO_DIR}\\custom_conf") as f: + with open(f"{pytest.SCRIPT_DIR}\\custom_conf") as f: expected = f.readlines() with open(f"{pytest.DATA_DIR}\\conf\\minion") as f: diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master.py index 26d182ca95b..252c5801ff4 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master.py @@ -6,17 +6,13 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/custom-config=custom_conf", "/master=cli_master"] - ) - yield + args = ["/custom-config=custom_conf", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master_minion.py index 2c8ac4aafee..f2e079f7439 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_master_minion.py @@ -6,22 +6,17 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/custom-config=custom_conf", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = [ + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_minion.py index 092857b39b9..b31ad3db90b 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_custom_minion.py @@ -8,14 +8,11 @@ def install(): pytest.helpers.clean_env() # Create an existing config pytest.helpers.existing_config() - # Create a custom config pytest.helpers.custom_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/custom-config=custom_conf", "/minion-name=cli_minion"] - ) - yield + args = ["/custom-config=custom_conf", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default.py index 1007fcb97d4..515b835394c 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default.py @@ -6,12 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command([pytest.INST_BIN, "/default-config"]) - yield + args = ["/default-config"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() @@ -25,7 +24,7 @@ def test_config_present(install): def test_config_correct(install): # The config file should be the default, unchanged - with open(f"{pytest.REPO_DIR}\\tests\\_files\\minion") as f: + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: expected = f.readlines() with open(f"{pytest.DATA_DIR}\\conf\\minion") as f: diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master.py index 81d66801cb5..f054cbfbe9c 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master.py @@ -6,14 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/default-config", "/master=cli_master"] - ) - yield + args = ["/default-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manulal_existing_default_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master_minion.py similarity index 83% rename from pkg/windows/nsis/tests/manual_tests/test_manulal_existing_default_master_minion.py rename to pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master_minion.py index 65c7dc8b0df..ee5703740c5 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manulal_existing_default_master_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_master_minion.py @@ -6,19 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command( - [ - pytest.INST_BIN, - "/default-config", - "/master=cli_master", - "/minion-name=cli_minion", - ] - ) - yield + args = ["/default-config", "/master=cli_master", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_minion.py index 09db2177d5f..a5d0f4f6f3b 100644 --- a/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_minion.py +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_existing_default_minion.py @@ -6,14 +6,11 @@ import pytest @pytest.fixture(scope="module") def install(): pytest.helpers.clean_env() - # Create an existing config pytest.helpers.existing_config() - - pytest.helpers.run_command( - [pytest.INST_BIN, "/default-config", "/minion-name=cli_minion"] - ) - yield + args = ["/default-config", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args pytest.helpers.clean_env() diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom.py new file mode 100644 index 00000000000..cd8213b9f39 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom.py @@ -0,0 +1,41 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + # Create a custom config + pytest.helpers.custom_config() + args = [f"/install-dir={inst_dir}", "/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config, unchanged + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: + expected = f.readlines() + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master.py new file mode 100644 index 00000000000..1ddbd4948af --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master.py @@ -0,0 +1,53 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + # Create a custom config + pytest.helpers.custom_config() + args = [ + f"/install-dir={inst_dir}", + "/custom-config=custom_conf", + "/master=cli_master", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config with only master set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: cli_master\n", + "# Custom config from test suite line 2/6\n", + "id: custom_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master_minion.py new file mode 100644 index 00000000000..eadc478ad40 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_master_minion.py @@ -0,0 +1,54 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + # Create a custom config + pytest.helpers.custom_config() + args = [ + f"/install-dir={inst_dir}", + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config with master and minion set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: cli_master\n", + "# Custom config from test suite line 2/6\n", + "id: cli_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_minion.py new file mode 100644 index 00000000000..f896ed8c63c --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_custom_minion.py @@ -0,0 +1,53 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + # Create a custom config + pytest.helpers.custom_config() + args = [ + f"/install-dir={inst_dir}", + "/custom-config=custom_conf", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config with only minion set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: custom_master\n", + "# Custom config from test suite line 2/6\n", + "id: cli_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default.py new file mode 100644 index 00000000000..c42bb50e02e --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default.py @@ -0,0 +1,39 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + args = [f"/install-dir={inst_dir}"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config, unchanged + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: + expected = f.readlines() + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master.py new file mode 100644 index 00000000000..291d110f8d9 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master.py @@ -0,0 +1,47 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + args = [f"/install-dir={inst_dir}", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config with only master set + expected = [ + "# Default config from test suite line 1/6\n", + "master: cli_master\n", + "# Default config from test suite line 2/6\n", + "#id:\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master_minion.py new file mode 100644 index 00000000000..44c364b9615 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_master_minion.py @@ -0,0 +1,47 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + args = [f"/install-dir={inst_dir}", "/master=cli_master", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config with master and minion set + expected = [ + "# Default config from test suite line 1/6\n", + "master: cli_master\n", + "# Default config from test suite line 2/6\n", + "id: cli_minion\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_minion.py new file mode 100644 index 00000000000..b964852d9dc --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_default_minion.py @@ -0,0 +1,47 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + args = [f"/install-dir={inst_dir}", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config with just the minion set + expected = [ + "# Default config from test suite line 1/6\n", + "#master: salt\n", + "# Default config from test suite line 2/6\n", + "id: cli_minion\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_existing.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_existing.py new file mode 100644 index 00000000000..4f61c24eae3 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_existing.py @@ -0,0 +1,40 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + # Create an existing config + pytest.helpers.existing_config() + args = [f"/install-dir={inst_dir}"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env(inst_dir) + + +def test_binaries_present(install, inst_dir): + # This will show the contents of the directory on failure + inst_dir_exists = os.path.exists(inst_dir) + dir_contents = os.listdir(inst_dir) + assert os.path.exists(rf"{inst_dir}\ssm.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the existing config, unchanged + expected = pytest.EXISTING_CONTENT + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_move_old_install.py b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_move_old_install.py new file mode 100644 index 00000000000..0ccd54aab99 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_install_dir_move_old_install.py @@ -0,0 +1,42 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def inst_dir(): + return "C:\\custom_location" + + +@pytest.fixture(scope="module") +def install(inst_dir): + pytest.helpers.clean_env() + # Create old install + pytest.helpers.old_install() + args = [f"/install-dir={inst_dir}", "/move-config"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the existing config in the new location, unchanged + expected = pytest.OLD_CONTENT + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install.py new file mode 100644 index 00000000000..6afcb0af507 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install.py @@ -0,0 +1,37 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = [] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the old existing config, unchanged + expected = pytest.OLD_CONTENT + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom.py new file mode 100644 index 00000000000..037a4fa2b44 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom.py @@ -0,0 +1,40 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = ["/custom-config=custom_conf"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config, unchanged + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: + expected = f.readlines() + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master.py new file mode 100644 index 00000000000..765d378307e --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master.py @@ -0,0 +1,48 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = ["/custom-config=custom_conf", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config with only master set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: cli_master\n", + "# Custom config from test suite line 2/6\n", + "id: custom_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master_minion.py new file mode 100644 index 00000000000..b247fd33277 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_master_minion.py @@ -0,0 +1,52 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = [ + "/custom-config=custom_conf", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config with master and minion set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: cli_master\n", + "# Custom config from test suite line 2/6\n", + "id: cli_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_minion.py new file mode 100644 index 00000000000..23fce833cea --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_custom_minion.py @@ -0,0 +1,48 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = ["/custom-config=custom_conf", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config with only minion set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: custom_master\n", + "# Custom config from test suite line 2/6\n", + "id: cli_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default.py new file mode 100644 index 00000000000..0f782538e3a --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default.py @@ -0,0 +1,38 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old install + pytest.helpers.old_install() + args = ["/default-config"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config, unchanged + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: + expected = f.readlines() + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master.py new file mode 100644 index 00000000000..77085dc6403 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master.py @@ -0,0 +1,46 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = ["/default-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config with only master set + expected = [ + "# Default config from test suite line 1/6\n", + "master: cli_master\n", + "# Default config from test suite line 2/6\n", + "#id:\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master_minion.py new file mode 100644 index 00000000000..0b00cb6c992 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_master_minion.py @@ -0,0 +1,50 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = [ + "/default-config", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config with master and minion set + expected = [ + "# Default config from test suite line 1/6\n", + "master: cli_master\n", + "# Default config from test suite line 2/6\n", + "id: cli_minion\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_minion.py new file mode 100644 index 00000000000..db4d10b1c0c --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_default_minion.py @@ -0,0 +1,46 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = ["/default-config", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_old_location(install): + assert os.path.exists(rf"{pytest.OLD_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default with only minion set + expected = [ + "# Default config from test suite line 1/6\n", + "#master: salt\n", + "# Default config from test suite line 2/6\n", + "id: cli_minion\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.OLD_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move.py new file mode 100644 index 00000000000..cfa48e0b716 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move.py @@ -0,0 +1,37 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = ["/move-config"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the old existing config in the new location, unchanged + expected = pytest.OLD_CONTENT + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom.py new file mode 100644 index 00000000000..b711f78eace --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom.py @@ -0,0 +1,40 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = ["/custom-config=custom_conf", "/move-config"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config in the new location, unchanged + with open(rf"{pytest.SCRIPT_DIR}\custom_conf") as f: + expected = f.readlines() + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master.py new file mode 100644 index 00000000000..cd2410d311d --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master.py @@ -0,0 +1,48 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = ["/custom-config=custom_conf", "/move-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config in the new location with only master set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: cli_master\n", + "# Custom config from test suite line 2/6\n", + "id: custom_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master_minion.py new file mode 100644 index 00000000000..32deccfe4cd --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_master_minion.py @@ -0,0 +1,53 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = [ + "/custom-config=custom_conf", + "/move-config", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config in the new location with master and minion set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: cli_master\n", + "# Custom config from test suite line 2/6\n", + "id: cli_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_minion.py new file mode 100644 index 00000000000..6ff619ed9a5 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_custom_minion.py @@ -0,0 +1,48 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + # Create a custom config + pytest.helpers.custom_config() + args = ["/custom-config=custom_conf", "/move-config", "/minion-name=cli_minion"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the custom config in the new location with only minion set + expected = [ + "# Custom config from test suite line 1/6\n", + "master: custom_master\n", + "# Custom config from test suite line 2/6\n", + "id: cli_minion\n", + "# Custom config from test suite line 3/6\n", + "# Custom config from test suite line 4/6\n", + "# Custom config from test suite line 5/6\n", + "# Custom config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default.py new file mode 100644 index 00000000000..5a64d7e4b28 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default.py @@ -0,0 +1,38 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = ["/move-config", "/default-config"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config in the new location, unchanged + with open(rf"{pytest.SCRIPT_DIR}\_files\minion") as f: + expected = f.readlines() + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master.py new file mode 100644 index 00000000000..bd37b2565fe --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master.py @@ -0,0 +1,46 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = ["/default-config", "/move-config", "/master=cli_master"] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config in the new location with only master set + expected = [ + "# Default config from test suite line 1/6\n", + "master: cli_master\n", + "# Default config from test suite line 2/6\n", + "#id:\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master_minion.py new file mode 100644 index 00000000000..bc8413aea16 --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_master_minion.py @@ -0,0 +1,51 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = [ + "/default-config", + "/move-config", + "/master=cli_master", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config in the new location with master and minion set + expected = [ + "# Default config from test suite line 1/6\n", + "master: cli_master\n", + "# Default config from test suite line 2/6\n", + "id: cli_minion\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_minion.py b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_minion.py new file mode 100644 index 00000000000..0d90d00f0df --- /dev/null +++ b/pkg/windows/nsis/tests/manual_tests/test_manual_old_install_move_default_minion.py @@ -0,0 +1,50 @@ +import os + +import pytest + + +@pytest.fixture(scope="module") +def install(): + pytest.helpers.clean_env() + # Create old config + pytest.helpers.old_install() + args = [ + "/default-config", + "/move-config", + "/minion-name=cli_minion", + ] + pytest.helpers.install_salt(args) + yield args + pytest.helpers.clean_env() + + +def test_binaries_present_old_location(install): + # This will show the contents of the directory on failure + dir_contents = os.listdir(rf"{pytest.OLD_DIR}\bin") + # Apparently we don't move the binaries even if they pass install-dir + # TODO: Decide if this is expected behavior + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\ssm.exe") + assert os.path.exists(rf"{pytest.OLD_DIR}\bin\python.exe") + + +def test_config_present_new_location(install): + assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") + + +def test_config_correct(install): + # The config file should be the default config in the new location with only minion set + expected = [ + "# Default config from test suite line 1/6\n", + "#master: salt\n", + "# Default config from test suite line 2/6\n", + "id: cli_minion\n", + "# Default config from test suite line 3/6\n", + "# Default config from test suite line 4/6\n", + "# Default config from test suite line 5/6\n", + "# Default config from test suite line 6/6\n", + ] + + with open(rf"{pytest.DATA_DIR}\conf\minion") as f: + result = f.readlines() + + assert result == expected diff --git a/pkg/windows/nsis/tests/pytest.ini b/pkg/windows/nsis/tests/pytest.ini new file mode 100644 index 00000000000..eea2c180278 --- /dev/null +++ b/pkg/windows/nsis/tests/pytest.ini @@ -0,0 +1 @@ +[pytest] diff --git a/pkg/windows/nsis/tests/quick_setup.ps1 b/pkg/windows/nsis/tests/quick_setup.ps1 new file mode 100644 index 00000000000..454acc937c3 --- /dev/null +++ b/pkg/windows/nsis/tests/quick_setup.ps1 @@ -0,0 +1,154 @@ +<# +.SYNOPSIS +Script that sets up the environment for testing + +.DESCRIPTION +This script creates the directory structure and files needed build a mock salt +installer for testing + +.EXAMPLE +setup.ps1 +#> +param( + [Parameter(Mandatory=$false)] + [Alias("c")] +# Don't pretify the output of the Write-Result + [Switch] $CICD +) + +#------------------------------------------------------------------------------- +# Script Preferences +#------------------------------------------------------------------------------- + +$ProgressPreference = "SilentlyContinue" +$ErrorActionPreference = "Stop" + +#------------------------------------------------------------------------------- +# Script Functions +#------------------------------------------------------------------------------- + +function Write-Result($result, $ForegroundColor="Green") { + if ( $CICD ) { + Write-Host $result -ForegroundColor $ForegroundColor + } else { + $position = 80 - $result.Length - [System.Console]::CursorLeft + Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + } +} + +#------------------------------------------------------------------------------- +# Script Variables +#------------------------------------------------------------------------------- + +$PROJECT_DIR = $(git rev-parse --show-toplevel) +$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName +$WINDOWS_DIR = "$PROJECT_DIR\pkg\windows" +$NSIS_DIR = "$WINDOWS_DIR\nsis" +$BUILDENV_DIR = "$WINDOWS_DIR\buildenv" +$NSIS_BIN = "$( ${env:ProgramFiles(x86)} )\NSIS\makensis.exe" +$SALT_DEP_URL = "https://repo.saltproject.io/windows/dependencies/64" + +#------------------------------------------------------------------------------- +# Script Start +#------------------------------------------------------------------------------- + +Write-Host $("=" * 80) +Write-Host "Build Test Environment for NSIS Tests" -ForegroundColor Cyan +Write-Host $("-" * 80) + +#------------------------------------------------------------------------------- +# Setup Directories +#------------------------------------------------------------------------------- + +$directories = "$BUILDENV_DIR", + "$BUILDENV_DIR\configs" +$directories | ForEach-Object { + if ( ! (Test-Path -Path "$_") ) { + Write-Host "Creating $_`: " -NoNewline + New-Item -Path $_ -ItemType Directory | Out-Null + if ( Test-Path -Path "$_" ) { + Write-Result "Success" + } else { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } + } +} + +#------------------------------------------------------------------------------- +# Create binaries +#------------------------------------------------------------------------------- + +$binary_files = @("python.exe") +$binary_files | ForEach-Object { + Write-Host "Creating $_`: " -NoNewline + Set-Content -Path "$BUILDENV_DIR\$_" -Value "binary" + if ( Test-Path -Path "$BUILDENV_DIR\$_" ) { + Write-Result "Success" + } else { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } +} + +# Make sure ssm.exe is present. This is needed for VMtools +if ( ! (Test-Path -Path "$BUILDENV_DIR\ssm.exe") ) { + Write-Host "Copying SSM to Build Env: " -NoNewline + Invoke-WebRequest -Uri "$SALT_DEP_URL/ssm-2.24-103-gdee49fc.exe" -OutFile "$BUILDENV_DIR\ssm.exe" + if ( Test-Path -Path "$BUILDENV_DIR\ssm.exe" ) { + Write-Result "Success" -ForegroundColor Green + } else { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } +} + +#------------------------------------------------------------------------------- +# Copy Configs +#------------------------------------------------------------------------------- + +Write-Host "Copy testing minion config: " -NoNewline +Copy-Item -Path "$NSIS_DIR\tests\_files\minion" ` + -Destination "$BUILDENV_DIR\configs\" +if ( Test-Path -Path "$BUILDENV_DIR\configs\minion" ) { + Write-Result "Success" +} else { + Write-Result "Failed" -ForegroundColor Red + exit 1 +} + +#------------------------------------------------------------------------------- +# Build mock installer +#------------------------------------------------------------------------------- +Write-Host "Building mock installer: " -NoNewline +Start-Process -FilePath $NSIS_BIN ` + -ArgumentList "/DSaltVersion=test", ` + "/DPythonArchitecture=AMD64", ` + "$NSIS_DIR\installer\Salt-Minion-Setup.nsi" ` + -Wait -WindowStyle Hidden +$installer = "$NSIS_DIR\installer\Salt-Minion-test-Py3-AMD64-Setup.exe" +if ( Test-Path -Path "$installer" ) { + Write-Result "Success" +} else { + Write-Result "Failed" -ForegroundColor Red + Write-Host "$NSIS_BIN /DSaltVersion=test /DPythonArchitecture=AMD64 $NSIS_DIR\installer\Salt-Minion-Setup.nsi" + exit 1 +} + +Write-Host "Moving mock installer: " -NoNewline +$test_installer = "$NSIS_DIR\tests\test-setup.exe" +Move-Item -Path $installer -Destination "$test_installer" -Force +if ( Test-Path -Path "$test_installer" ) { + Write-Result "Success" +} else { + Write-Result "Failed" -ForegroundColor Red + exit 1 +} + +#------------------------------------------------------------------------------- +# Script Complete +#------------------------------------------------------------------------------- + +Write-Host $("-" * 80) +Write-Host "Build Test Environment for NSIS Tests Complete" -ForegroundColor Cyan +Write-Host $("=" * 80) diff --git a/pkg/windows/nsis/tests/setup.ps1 b/pkg/windows/nsis/tests/setup.ps1 index c5d8b7459a6..cd3307e339e 100644 --- a/pkg/windows/nsis/tests/setup.ps1 +++ b/pkg/windows/nsis/tests/setup.ps1 @@ -9,6 +9,12 @@ installer for testing .EXAMPLE setup.ps1 #> +param( + [Parameter(Mandatory=$false)] + [Alias("c")] +# Don't pretify the output of the Write-Result + [Switch] $CICD +) #------------------------------------------------------------------------------- # Script Preferences @@ -22,8 +28,12 @@ $ErrorActionPreference = "Stop" #------------------------------------------------------------------------------- function Write-Result($result, $ForegroundColor="Green") { - $position = 80 - $result.Length - [System.Console]::CursorLeft - Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + if ( $CICD ) { + Write-Host $result -ForegroundColor $ForegroundColor + } else { + $position = 80 - $result.Length - [System.Console]::CursorLeft + Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + } } #------------------------------------------------------------------------------- @@ -36,6 +46,7 @@ $WINDOWS_DIR = "$PROJECT_DIR\pkg\windows" $NSIS_DIR = "$WINDOWS_DIR\nsis" $BUILDENV_DIR = "$WINDOWS_DIR\buildenv" $NSIS_BIN = "$( ${env:ProgramFiles(x86)} )\NSIS\makensis.exe" +$SALT_DEP_URL = "https://repo.saltproject.io/windows/dependencies/64" #------------------------------------------------------------------------------- # Script Start @@ -68,8 +79,7 @@ $directories | ForEach-Object { # Create binaries #------------------------------------------------------------------------------- -$binary_files = "ssm.exe", - "python.exe" +$binary_files = @("python.exe") $binary_files | ForEach-Object { Write-Host "Creating $_`: " -NoNewline Set-Content -Path "$BUILDENV_DIR\$_" -Value "binary" @@ -81,11 +91,23 @@ $binary_files | ForEach-Object { } } +# Make sure ssm.exe is present. This is needed for VMtools +if ( ! (Test-Path -Path "$BUILDENV_DIR\ssm.exe") ) { + Write-Host "Copying SSM to Build Env: " -NoNewline + Invoke-WebRequest -Uri "$SALT_DEP_URL/ssm-2.24-103-gdee49fc.exe" -OutFile "$BUILDENV_DIR\ssm.exe" + if ( Test-Path -Path "$BUILDENV_DIR\ssm.exe" ) { + Write-Result "Success" -ForegroundColor Green + } else { + Write-Result "Failed" -ForegroundColor Red + exit 1 + } +} + #------------------------------------------------------------------------------- # Copy Configs #------------------------------------------------------------------------------- -Write-Host "Copy minion config: " -NoNewline +Write-Host "Copy testing minion config: " -NoNewline Copy-Item -Path "$NSIS_DIR\tests\_files\minion" ` -Destination "$BUILDENV_DIR\configs\" if ( Test-Path -Path "$BUILDENV_DIR\configs\minion" ) { @@ -109,6 +131,7 @@ if ( Test-Path -Path "$installer" ) { Write-Result "Success" } else { Write-Result "Failed" -ForegroundColor Red + Write-Host "$NSIS_BIN /DSaltVersion=test /DPythonArchitecture=AMD64 $NSIS_DIR\installer\Salt-Minion-Setup.nsi" exit 1 } @@ -127,7 +150,7 @@ if ( Test-Path -Path "$test_installer" ) { #------------------------------------------------------------------------------- Write-Host "Setting up venv: " -NoNewline -python.exe -m venv venv +python.exe -m venv "$SCRIPT_DIR\venv" if ( Test-Path -Path "$SCRIPT_DIR\venv" ) { Write-Result "Success" } else { @@ -136,7 +159,7 @@ if ( Test-Path -Path "$SCRIPT_DIR\venv" ) { } Write-Host "Activating venv: " -NoNewline -.\venv\Scripts\activate +& $SCRIPT_DIR\venv\Scripts\activate.ps1 if ( "$env:VIRTUAL_ENV" ) { Write-Result "Success" } else { diff --git a/pkg/windows/nsis/tests/stress_tests/test_hang.py b/pkg/windows/nsis/tests/stress_tests/test_hang.py new file mode 100644 index 00000000000..bea2458a362 --- /dev/null +++ b/pkg/windows/nsis/tests/stress_tests/test_hang.py @@ -0,0 +1,26 @@ +import os + +import pytest + + +@pytest.fixture +def install(): + assert pytest.helpers.clean_env() + args = ["/S"] + pytest.helpers.install_salt(args) + yield args + assert pytest.helpers.clean_env() + + +@pytest.mark.parametrize("execution_number", range(100)) +def test_repeatedly_install_uninstall(execution_number, install): + # Make sure the binaries exists. If they don't, the install failed + assert os.path.exists( + f"{pytest.INST_DIR}\\python.exe" + ), "Installation failed. `python.exe` not found" + assert os.path.exists( + f"{pytest.INST_DIR}\\ssm.exe" + ), "Installation failed. `ssm.exe` not found" + assert os.path.exists( + f"{pytest.INST_DIR}\\uninst.exe" + ), "Installation failed. `uninst.exe` not found" diff --git a/pkg/windows/nsis/tests/test.ps1 b/pkg/windows/nsis/tests/test.ps1 index 015c8b8c60e..c386a69acd9 100644 --- a/pkg/windows/nsis/tests/test.ps1 +++ b/pkg/windows/nsis/tests/test.ps1 @@ -8,6 +8,16 @@ This script activates the venv and launches pytest .EXAMPLE test.ps1 #> +param( + [Parameter(Mandatory=$false)] + [Alias("c")] +# Don't pretify the output of the Write-Result + [Switch] $CICD=$false, + + [Parameter(Mandatory=$false, ValueFromRemainingArguments=$true)] +# Don't pretify the output of the Write-Result + [String]$Tests +) #------------------------------------------------------------------------------- # Script Preferences @@ -21,10 +31,20 @@ $ErrorActionPreference = "Stop" #------------------------------------------------------------------------------- function Write-Result($result, $ForegroundColor="Green") { - $position = 80 - $result.Length - [System.Console]::CursorLeft - Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + if ( $CICD ) { + Write-Host $result -ForegroundColor $ForegroundColor + } else { + $position = 80 - $result.Length - [System.Console]::CursorLeft + Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") + } } +#------------------------------------------------------------------------------- +# Script Variables +#------------------------------------------------------------------------------- + +$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName + #------------------------------------------------------------------------------- # Script Start #------------------------------------------------------------------------------- @@ -36,9 +56,13 @@ Write-Host $("-" * 80) #------------------------------------------------------------------------------- # Activating venv #------------------------------------------------------------------------------- +if ( !(Test-Path -Path "$SCRIPT_DIR\venv\Scripts\activate.ps1") ) { + Write-Host "Could not find virtual environment" + Write-Host "You must run setup.cmd before running this script" +} Write-Host "Activating venv: " -NoNewline -.\venv\Scripts\activate +& $SCRIPT_DIR\venv\Scripts\activate.ps1 if ( "$env:VIRTUAL_ENV" ) { Write-Result "Success" } else { @@ -46,9 +70,27 @@ if ( "$env:VIRTUAL_ENV" ) { exit 1 } +Write-Host "Setting working directory: " -NoNewline +Set-Location -Path $SCRIPT_DIR +if ( $(Get-Location).Path -eq $SCRIPT_DIR ) { + Write-Result "Success" +} else { + Write-Result "Failed" -ForegroundColor Red + exit 1 +} + +Write-Host $("-" * 80) +Write-Host "" Write-Host "Running pytest..." Write-Host "" -pytest -vvv -- .\config_tests\ + +if ($Tests) { + $pytest_args = -join $Tests +} else { + $pytest_args = ".\config_tests\" +} + +pytest -vvv -rPx --showlocals -- $pytest_args #------------------------------------------------------------------------------- # Script Complete From 64ef4b134982dab84c4283cd443e9112f3c37084 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Fri, 12 Jul 2024 14:47:55 -0600 Subject: [PATCH 082/157] Add simple workflow for Windows Installer Tests --- .../test-installer-action-windows.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/test-installer-action-windows.yml diff --git a/.github/workflows/test-installer-action-windows.yml b/.github/workflows/test-installer-action-windows.yml new file mode 100644 index 00000000000..cf0b48556bb --- /dev/null +++ b/.github/workflows/test-installer-action-windows.yml @@ -0,0 +1,38 @@ +--- +name: Test Windows Installer + +on: pull_request + +permissions: + contents: read + +jobs: + Test-Windows-Installer: + runs-on: + - windows-latest + + steps: + + - name: Checkout Salt + uses: actions/checkout@v4 + + - name: Set Up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install NSIS + run: .\pkg\windows\install_nsis.cmd -CICD + shell: cmd + + - name: Build Test Installer + run: .\pkg\windows\nsis\tests\setup.cmd -CICD + shell: cmd + + - name: Run Stress Test + run: .\pkg\windows\nsis\tests\test.cmd -CICD .\stress_tests + shell: cmd + + - name: Run Config Tests + run: .\pkg\windows\nsis\tests\test.cmd -CICD .\config_tests + shell: cmd From 853f1441ad18a364368254b4a34ee7da3a7d9c85 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Tue, 16 Jul 2024 11:09:28 -0600 Subject: [PATCH 083/157] Tie windows installer action into ci.yml --- .github/workflows/ci.yml | 12 ++++++++++++ .github/workflows/nightly.yml | 12 ++++++++++++ .github/workflows/scheduled.yml | 12 ++++++++++++ .github/workflows/staging.yml | 12 ++++++++++++ .github/workflows/templates/build-packages.yml.jinja | 1 + .github/workflows/templates/ci.yml.jinja | 12 ++++++++++++ .github/workflows/templates/layout.yml.jinja | 3 +++ ...tion-windows.yml => windows-installer-action.yml} | 10 ++++------ 8 files changed, 68 insertions(+), 6 deletions(-) rename .github/workflows/{test-installer-action-windows.yml => windows-installer-action.yml} (85%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20769929078..7bdf4170ad4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,6 +134,9 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified + windows-installer: + - added|modified: + - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -245,6 +248,12 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" + windows-installer-check: + name: Windows Installer Check + if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} + uses: ./.github/workflows/windows-installer-action.yml + needs: + - prepare-workflow lint: name: Lint @@ -441,6 +450,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -455,6 +465,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -2130,6 +2141,7 @@ jobs: needs: - prepare-workflow - pre-commit + - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 93c4c09f55e..435f6060c50 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -183,6 +183,9 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified + windows-installer: + - added|modified: + - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -294,6 +297,12 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" + windows-installer-check: + name: Windows Installer Check + if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} + uses: ./.github/workflows/windows-installer-action.yml + needs: + - prepare-workflow lint: name: Lint @@ -495,6 +504,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -513,6 +523,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -3025,6 +3036,7 @@ jobs: - trigger-branch-nightly-builds - prepare-workflow - pre-commit + - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 2ab7dc11b6d..7cb09487032 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -173,6 +173,9 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified + windows-installer: + - added|modified: + - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -284,6 +287,12 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" + windows-installer-check: + name: Windows Installer Check + if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} + uses: ./.github/workflows/windows-installer-action.yml + needs: + - prepare-workflow lint: name: Lint @@ -480,6 +489,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -494,6 +504,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -2171,6 +2182,7 @@ jobs: - trigger-branch-scheduled-builds - prepare-workflow - pre-commit + - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 1313812f8ed..bacd750547c 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -164,6 +164,9 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified + windows-installer: + - added|modified: + - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -284,6 +287,12 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" + windows-installer-check: + name: Windows Installer Check + if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} + uses: ./.github/workflows/windows-installer-action.yml + needs: + - prepare-workflow lint: name: Lint @@ -480,6 +489,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -498,6 +508,7 @@ jobs: needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -3028,6 +3039,7 @@ jobs: - check-requirements - prepare-workflow - pre-commit + - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/templates/build-packages.yml.jinja b/.github/workflows/templates/build-packages.yml.jinja index 745bcc3c9ca..cf64d3d80ac 100644 --- a/.github/workflows/templates/build-packages.yml.jinja +++ b/.github/workflows/templates/build-packages.yml.jinja @@ -10,6 +10,7 @@ needs: - prepare-workflow - build-salt-onedir + - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" diff --git a/.github/workflows/templates/ci.yml.jinja b/.github/workflows/templates/ci.yml.jinja index eef2e77ba84..e323909c45a 100644 --- a/.github/workflows/templates/ci.yml.jinja +++ b/.github/workflows/templates/ci.yml.jinja @@ -23,6 +23,18 @@ <%- endif %> + <%- set job_name = "windows-installer-check" %> + <%- if includes.get(job_name, True) %> + <{ job_name }>: + <%- do conclusion_needs.append(job_name) %> + name: Windows Installer Check + if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} + uses: ./.github/workflows/windows-installer-action.yml + needs: + - prepare-workflow + + <%- endif %> + <%- set job_name = "lint" %> <%- if includes.get(job_name, True) %> diff --git a/.github/workflows/templates/layout.yml.jinja b/.github/workflows/templates/layout.yml.jinja index 0f0e795c0c6..f832bdca866 100644 --- a/.github/workflows/templates/layout.yml.jinja +++ b/.github/workflows/templates/layout.yml.jinja @@ -182,6 +182,9 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified + windows-installer: + - added|modified: + - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 diff --git a/.github/workflows/test-installer-action-windows.yml b/.github/workflows/windows-installer-action.yml similarity index 85% rename from .github/workflows/test-installer-action-windows.yml rename to .github/workflows/windows-installer-action.yml index cf0b48556bb..0b3644bc3a3 100644 --- a/.github/workflows/test-installer-action-windows.yml +++ b/.github/workflows/windows-installer-action.yml @@ -1,13 +1,11 @@ --- -name: Test Windows Installer +name: Windows Installer Check -on: pull_request - -permissions: - contents: read +on: workflow_call jobs: - Test-Windows-Installer: + windows-installer-check: + name: Windows Installer Check runs-on: - windows-latest From b8a2e80c4d7ff91f05d8de01c3cf5e38c7642342 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Fri, 12 Jul 2024 15:11:38 -0700 Subject: [PATCH 084/157] Add regression test for CVE-2024-37088 Add validation for the way RemotePillar and AsyncRemotePillar handle pillar result validation. --- .../pytests/integration/cli/test_salt_call.py | 81 +++++++++++++++++-- tests/pytests/unit/test_pillar.py | 40 +++++++++ 2 files changed, 116 insertions(+), 5 deletions(-) diff --git a/tests/pytests/integration/cli/test_salt_call.py b/tests/pytests/integration/cli/test_salt_call.py index 1d770c0ffbe..8e6549f8cff 100644 --- a/tests/pytests/integration/cli/test_salt_call.py +++ b/tests/pytests/integration/cli/test_salt_call.py @@ -1,6 +1,7 @@ import copy import logging import os +import pathlib import pprint import re import sys @@ -12,7 +13,8 @@ import salt.utils.files import salt.utils.json import salt.utils.platform import salt.utils.yaml -from tests.support.helpers import PRE_PYTEST_SKIP, PRE_PYTEST_SKIP_REASON +import tests.conftest +import tests.support.helpers pytestmark = [ pytest.mark.core_test, @@ -95,7 +97,7 @@ def test_local_salt_call(salt_call_cli): assert contents.count("foo") == 1, contents -@pytest.mark.skip_on_windows(reason=PRE_PYTEST_SKIP_REASON) +@pytest.mark.skip_on_windows(reason=tests.support.helpers.PRE_PYTEST_SKIP_REASON) def test_user_delete_kw_output(salt_call_cli): ret = salt_call_cli.run("-d", "user.delete", _timeout=120) assert ret.returncode == 0 @@ -126,7 +128,7 @@ def test_issue_6973_state_highstate_exit_code(salt_call_cli): assert expected_comment in ret.stdout -@PRE_PYTEST_SKIP +@tests.support.helpers.PRE_PYTEST_SKIP def test_issue_15074_output_file_append(salt_call_cli): with pytest.helpers.temp_file(name="issue-15074") as output_file_append: @@ -154,7 +156,7 @@ def test_issue_15074_output_file_append(salt_call_cli): assert second_run_output == first_run_output + first_run_output -@PRE_PYTEST_SKIP +@tests.support.helpers.PRE_PYTEST_SKIP def test_issue_14979_output_file_permissions(salt_call_cli): with pytest.helpers.temp_file(name="issue-14979") as output_file: with salt.utils.files.set_umask(0o077): @@ -307,7 +309,7 @@ def test_syslog_file_not_found(salt_minion, salt_call_cli, tmp_path): assert "Failed to setup the Syslog logging handler" in ret.stderr -@PRE_PYTEST_SKIP +@tests.support.helpers.PRE_PYTEST_SKIP @pytest.mark.skip_on_windows def test_return(salt_call_cli, salt_run_cli): command = "echo returnTOmaster" @@ -429,3 +431,72 @@ def test_local_salt_call_no_function_no_retcode(salt_call_cli): assert "test" in ret.data assert ret.data["test"] == "'test' is not available." assert "test.echo" in ret.data + + +@pytest.fixture +def salt_master_alt(salt_master_factory): + """ + A running salt-master fixture + """ + extmods = pathlib.Path(salt_master_factory.config["extension_modules"]) + cache = extmods / "cache" + cache.mkdir() + localfs = cache / "localfs.py" + localfs.write_text( + tests.support.helpers.dedent( + """ + from salt.exceptions import SaltClientError + def store(bank, key, data): # , cachedir): + raise SaltClientError("TEST") + """ + ) + ) + with salt_master_factory.started(): + yield salt_master_factory + + +@pytest.fixture +def salt_call_alt(salt_master_alt, salt_minion_id): + minion_factory = salt_master_alt.salt_minion_daemon( + salt_minion_id, + overrides={ + "file_roots": salt_master_alt.config["file_roots"].copy(), + "pillar_roots": salt_master_alt.config["pillar_roots"].copy(), + "fips_mode": tests.conftest.FIPS_TESTRUN, + "encryption_algorithm": ( + "OAEP-SHA224" if tests.conftest.FIPS_TESTRUN else "OAEP-SHA1" + ), + "signing_algorithm": ( + "PKCS1v15-SHA224" if tests.conftest.FIPS_TESTRUN else "PKCS1v15-SHA1" + ), + }, + ) + return minion_factory.salt_call_cli() + + +def test_cve_2024_37088(salt_master_alt, salt_call_alt, tmp_path, caplog): + with salt_master_alt.pillar_tree.base.temp_file( + "cve_2024_37088.sls", "foobar: bang" + ): + with salt_master_alt.state_tree.base.temp_file( + "cve_2024_37088.sls", + """ + # cvs_2024_37088.sls + {{%- set var = salt ['pillar.get']('foobar', 'state default') %}} + + test: + file.managed: + - name: {0} + - contents: {{{{ var }}}} + """.format( + tmp_path / "cve_2024_37088.txt" + ), + ): + with caplog.at_level(logging.ERROR): + ret = salt_call_alt.run("state.sls", "cve_2024_37088") + assert ret.returncode == 1 + assert ret.data is None + assert ( + "Got a bad pillar from master, type str, expecting dict" + in caplog.text + ) diff --git a/tests/pytests/unit/test_pillar.py b/tests/pytests/unit/test_pillar.py index d44a337981f..1b29c26248d 100644 --- a/tests/pytests/unit/test_pillar.py +++ b/tests/pytests/unit/test_pillar.py @@ -1259,3 +1259,43 @@ def test_compile_pillar_disk_cache(master_opts, grains): "mocked_minion": {"base": {"foo": "bar"}, "dev": {"foo": "baz"}} } assert pillar.cache._dict == expected_cache + + +def test_remote_pillar_bad_return(grains, tmp_pki): + opts = { + "pki_dir": tmp_pki, + "id": "minion", + "master_uri": "tcp://127.0.0.1:4505", + "__role": "minion", + "keysize": 2048, + "saltenv": "base", + "pillarenv": "base", + } + pillar = salt.pillar.RemotePillar(opts, grains, "mocked-minion", "dev") + + async def crypted_transfer_mock(): + return "" + + pillar.channel.crypted_transfer_decode_dictentry = crypted_transfer_mock + with pytest.raises(salt.exceptions.SaltClientError): + pillar.compile_pillar() + + +async def test_async_remote_pillar_bad_return(grains, tmp_pki): + opts = { + "pki_dir": tmp_pki, + "id": "minion", + "master_uri": "tcp://127.0.0.1:4505", + "__role": "minion", + "keysize": 2048, + "saltenv": "base", + "pillarenv": "base", + } + pillar = salt.pillar.AsyncRemotePillar(opts, grains, "mocked-minion", "dev") + + async def crypted_transfer_mock(): + return "" + + pillar.channel.crypted_transfer_decode_dictentry = crypted_transfer_mock + with pytest.raises(salt.exceptions.SaltClientError): + await pillar.compile_pillar() From a504c4cd73767c0baa311e34fb143411c3422bd1 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Fri, 12 Jul 2024 15:13:37 -0700 Subject: [PATCH 085/157] RemotePillar raises an exception on bad data If the master returns a bad pillar data response the pillar client should raise an exception. This changes RemotePillar and AsyncRemotePillar classes to use the same logic for validating pillar data from the master. Fixes CVE-2024-37088 by causing salt-call to fail with a non zero exit code rather than continuing to execute a state when pillar data rendering fails on the master. --- salt/pillar/__init__.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/salt/pillar/__init__.py b/salt/pillar/__init__.py index 02b1006b5ef..e29e6542103 100644 --- a/salt/pillar/__init__.py +++ b/salt/pillar/__init__.py @@ -196,6 +196,15 @@ class RemotePillarMixin: log.trace("ext_pillar_extra_data = %s", extra_data) return extra_data + def validate_return(self, data): + if not isinstance(data, dict): + msg = "Got a bad pillar from master, type {}, expecting dict: {}".format( + type(data).__name__, data + ) + log.error(msg) + # raise an exception! Pillar isn't empty, we can't sync it! + raise SaltClientError(msg) + class AsyncRemotePillar(RemotePillarMixin): """ @@ -275,14 +284,7 @@ class AsyncRemotePillar(RemotePillarMixin): except Exception: # pylint: disable=broad-except log.exception("Exception getting pillar:") raise SaltClientError("Exception getting pillar.") - - if not isinstance(ret_pillar, dict): - msg = "Got a bad pillar from master, type {}, expecting dict: {}".format( - type(ret_pillar).__name__, ret_pillar - ) - log.error(msg) - # raise an exception! Pillar isn't empty, we can't sync it! - raise SaltClientError(msg) + self.validate_return(ret_pillar) raise salt.ext.tornado.gen.Return(ret_pillar) def destroy(self): @@ -373,14 +375,7 @@ class RemotePillar(RemotePillarMixin): except Exception: # pylint: disable=broad-except log.exception("Exception getting pillar:") raise SaltClientError("Exception getting pillar.") - - if not isinstance(ret_pillar, dict): - log.error( - "Got a bad pillar from master, type %s, expecting dict: %s", - type(ret_pillar).__name__, - ret_pillar, - ) - return {} + self.validate_return(ret_pillar) return ret_pillar def destroy(self): From 4a2733a8275831a0c8423bc80177464c95550f1c Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Fri, 12 Jul 2024 15:21:09 -0700 Subject: [PATCH 086/157] Add changelog for #66702 --- changelog/66702.security.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/66702.security.md diff --git a/changelog/66702.security.md b/changelog/66702.security.md new file mode 100644 index 00000000000..4fdd6b4ea3f --- /dev/null +++ b/changelog/66702.security.md @@ -0,0 +1,2 @@ +CVE-2024-37088 salt-call will fail with exit code 1 if bad pillar data is +encountered. From 610cdaaec684ae506baf35f1a481f773a02159d3 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 17 Jul 2024 01:20:07 -0700 Subject: [PATCH 087/157] Test fix --- .../pytests/integration/cli/test_salt_call.py | 109 +++++++++++------- 1 file changed, 70 insertions(+), 39 deletions(-) diff --git a/tests/pytests/integration/cli/test_salt_call.py b/tests/pytests/integration/cli/test_salt_call.py index 8e6549f8cff..f927f499c85 100644 --- a/tests/pytests/integration/cli/test_salt_call.py +++ b/tests/pytests/integration/cli/test_salt_call.py @@ -4,9 +4,11 @@ import os import pathlib import pprint import re +import shutil import sys import pytest +from saltfactories.utils import random_string import salt.defaults.exitcodes import salt.utils.files @@ -15,6 +17,8 @@ import salt.utils.platform import salt.utils.yaml import tests.conftest import tests.support.helpers +from tests.conftest import FIPS_TESTRUN +from tests.support.runtests import RUNTIME_VARS pytestmark = [ pytest.mark.core_test, @@ -434,51 +438,59 @@ def test_local_salt_call_no_function_no_retcode(salt_call_cli): @pytest.fixture -def salt_master_alt(salt_master_factory): +def master_id_alt(): + master_id = random_string("master-") + yield master_id + + +@pytest.fixture +def minion_id_alt(): + master_id = random_string("minion-") + yield master_id + + +@pytest.fixture +def salt_master_alt(salt_factories, tmp_path, master_id_alt): """ A running salt-master fixture """ - extmods = pathlib.Path(salt_master_factory.config["extension_modules"]) - cache = extmods / "cache" + root_dir = salt_factories.get_root_dir_for_daemon(master_id_alt) + conf_dir = root_dir / "conf" + conf_dir.mkdir(exist_ok=True) + extension_modules_path = str(root_dir / "extension_modules") + if not os.path.exists(extension_modules_path): + shutil.copytree( + os.path.join(RUNTIME_VARS.FILES, "extension_modules"), + extension_modules_path, + ) + cache = pathlib.Path(extension_modules_path) / "cache" cache.mkdir() localfs = cache / "localfs.py" localfs.write_text( tests.support.helpers.dedent( """ - from salt.exceptions import SaltClientError - def store(bank, key, data): # , cachedir): - raise SaltClientError("TEST") - """ + from salt.exceptions import SaltClientError + def store(bank, key, data): # , cachedir): + raise SaltClientError("TEST") + """ ) ) - with salt_master_factory.started(): - yield salt_master_factory - - -@pytest.fixture -def salt_call_alt(salt_master_alt, salt_minion_id): - minion_factory = salt_master_alt.salt_minion_daemon( - salt_minion_id, + factory = salt_factories.salt_master_daemon( + master_id_alt, + defaults={ + "root_dir": str(root_dir), + "extension_modules": extension_modules_path, + "auto_accept": True, + }, overrides={ - "file_roots": salt_master_alt.config["file_roots"].copy(), - "pillar_roots": salt_master_alt.config["pillar_roots"].copy(), - "fips_mode": tests.conftest.FIPS_TESTRUN, - "encryption_algorithm": ( - "OAEP-SHA224" if tests.conftest.FIPS_TESTRUN else "OAEP-SHA1" - ), - "signing_algorithm": ( - "PKCS1v15-SHA224" if tests.conftest.FIPS_TESTRUN else "PKCS1v15-SHA1" + "fips_mode": FIPS_TESTRUN, + "publish_signing_algorithm": ( + "PKCS1v15-SHA224" if FIPS_TESTRUN else "PKCS1v15-SHA1" ), }, ) - return minion_factory.salt_call_cli() - - -def test_cve_2024_37088(salt_master_alt, salt_call_alt, tmp_path, caplog): - with salt_master_alt.pillar_tree.base.temp_file( - "cve_2024_37088.sls", "foobar: bang" - ): - with salt_master_alt.state_tree.base.temp_file( + with factory.pillar_tree.base.temp_file("cve_2024_37088.sls", "foobar: bang"): + with factory.state_tree.base.temp_file( "cve_2024_37088.sls", """ # cvs_2024_37088.sls @@ -492,11 +504,30 @@ def test_cve_2024_37088(salt_master_alt, salt_call_alt, tmp_path, caplog): tmp_path / "cve_2024_37088.txt" ), ): - with caplog.at_level(logging.ERROR): - ret = salt_call_alt.run("state.sls", "cve_2024_37088") - assert ret.returncode == 1 - assert ret.data is None - assert ( - "Got a bad pillar from master, type str, expecting dict" - in caplog.text - ) + with factory.started(): + yield factory + + +@pytest.fixture +def salt_call_alt(salt_master_alt, minion_id_alt): + minion_factory = salt_master_alt.salt_minion_daemon( + minion_id_alt, + overrides={ + "fips_mode": tests.conftest.FIPS_TESTRUN, + "encryption_algorithm": ( + "OAEP-SHA224" if tests.conftest.FIPS_TESTRUN else "OAEP-SHA1" + ), + "signing_algorithm": ( + "PKCS1v15-SHA224" if tests.conftest.FIPS_TESTRUN else "PKCS1v15-SHA1" + ), + }, + ) + return minion_factory.salt_call_cli() + + +def test_cve_2024_37088(salt_master_alt, salt_call_alt, caplog): + with caplog.at_level(logging.ERROR): + ret = salt_call_alt.run("state.sls", "cve_2024_37088") + assert ret.returncode == 1 + assert ret.data is None + assert "Got a bad pillar from master, type str, expecting dict" in caplog.text From d7446d9a32ca23a67037eea043af3de395076a06 Mon Sep 17 00:00:00 2001 From: jeanluc Date: Tue, 14 May 2024 10:36:21 +0200 Subject: [PATCH 088/157] Add test for issues #66514 and #53538 --- .../integration/ssh/state/test_parallel.py | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/pytests/integration/ssh/state/test_parallel.py diff --git a/tests/pytests/integration/ssh/state/test_parallel.py b/tests/pytests/integration/ssh/state/test_parallel.py new file mode 100644 index 00000000000..8ff9d7db139 --- /dev/null +++ b/tests/pytests/integration/ssh/state/test_parallel.py @@ -0,0 +1,61 @@ +""" +Verify salt-ssh states support ``parallel``. +""" + +import pytest + +pytestmark = [ + pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.slow_test, +] + + +@pytest.fixture(scope="module", autouse=True) +def state_tree_parallel(base_env_state_tree_root_dir): + top_file = """ + base: + 'localhost': + - parallel + '127.0.0.1': + - parallel + """ + state_file = """ + {%- for i in range(5) %} + This runs in parallel {{ i }}: + cmd.run: + - name: sleep 0.{{ i }} + - parallel: true + {%- endfor %} + """ + top_tempfile = pytest.helpers.temp_file( + "top.sls", top_file, base_env_state_tree_root_dir + ) + state_tempfile = pytest.helpers.temp_file( + "parallel.sls", state_file, base_env_state_tree_root_dir + ) + with top_tempfile, state_tempfile: + yield + + +@pytest.mark.parametrize( + "args", + ( + pytest.param(("state.sls", "parallel"), id="sls"), + pytest.param(("state.highstate",), id="highstate"), + pytest.param(("state.top", "top.sls"), id="top"), + ), +) +def test_it(salt_ssh_cli, args): + """ + Ensure states with ``parallel: true`` do not cause a crash. + This does not check that they were actually run in parallel + since that would result either in a long-running or flaky test. + """ + ret = salt_ssh_cli.run(*args) + assert ret.returncode == 0 + assert isinstance(ret.data, dict) + for i in range(5): + key = f"cmd_|-This runs in parallel {i}_|-sleep 0.{i}_|-run" + assert key in ret.data + assert "pid" in ret.data[key]["changes"] + assert ret.data[key]["changes"]["retcode"] == 0 From 14edbcf19c457f0faa1a9b13a15cd3c5d0846400 Mon Sep 17 00:00:00 2001 From: jeanluc Date: Tue, 14 May 2024 10:37:39 +0200 Subject: [PATCH 089/157] Fix parallel state execution with Salt-SSH --- changelog/66514.fixed.md | 1 + salt/state.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 changelog/66514.fixed.md diff --git a/changelog/66514.fixed.md b/changelog/66514.fixed.md new file mode 100644 index 00000000000..9c579378ac3 --- /dev/null +++ b/changelog/66514.fixed.md @@ -0,0 +1 @@ +Fixed parallel state execution with Salt-SSH diff --git a/salt/state.py b/salt/state.py index 899736c84fb..d60d78c334f 100644 --- a/salt/state.py +++ b/salt/state.py @@ -39,6 +39,7 @@ import salt.utils.event import salt.utils.files import salt.utils.hashutils import salt.utils.immutabletypes as immutabletypes +import salt.utils.jid import salt.utils.msgpack import salt.utils.platform import salt.utils.process @@ -757,7 +758,21 @@ class State: loader="states", initial_pillar=None, file_client=None, + __invocation_id=None, ): + """ + When instantiating an object of this class, do not pass + ``__invocation_id``. It is an internal field for tracking + parallel executions where no jid is available (Salt-SSH) and + only exposed as an init argument to work on spawning platforms. + """ + if jid is not None: + __invocation_id = jid + if __invocation_id is None: + # For salt-ssh parallel states, we need a unique identifier + # for a single execution. self.jid should not be set there + # since it's used for other purposes as well. + __invocation_id = salt.utils.jid.gen_jid(opts) self._init_kwargs = { "opts": opts, "pillar_override": pillar_override, @@ -768,6 +783,7 @@ class State: "mocked": mocked, "loader": loader, "initial_pillar": initial_pillar, + "__invocation_id": __invocation_id, } self.states_loader = loader if "grains" not in opts: @@ -814,6 +830,7 @@ class State: self.pre = {} self.__run_num = 0 self.jid = jid + self.invocation_id = __invocation_id self.instance_id = str(id(self)) self.inject_globals = {} self.mocked = mocked @@ -2237,7 +2254,7 @@ class State: ] ) - troot = os.path.join(instance.opts["cachedir"], instance.jid) + troot = os.path.join(instance.opts["cachedir"], instance.invocation_id) tfile = os.path.join(troot, salt.utils.hashutils.sha1_digest(tag)) if not os.path.isdir(troot): try: @@ -2821,7 +2838,7 @@ class State: if not proc.is_alive(): ret_cache = os.path.join( self.opts["cachedir"], - self.jid, + self.invocation_id, salt.utils.hashutils.sha1_digest(tag), ) if not os.path.isfile(ret_cache): From 15112db8026af48e2e0f1c8a349ff5076af9ea97 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Thu, 18 Jul 2024 14:42:39 -0700 Subject: [PATCH 090/157] Fix new linter errors that poped up on nightlys --- tests/pytests/unit/transport/test_zeromq.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pytests/unit/transport/test_zeromq.py b/tests/pytests/unit/transport/test_zeromq.py index 7def553a6bd..0fb7bd76539 100644 --- a/tests/pytests/unit/transport/test_zeromq.py +++ b/tests/pytests/unit/transport/test_zeromq.py @@ -806,7 +806,7 @@ async def test_req_chan_decode_data_dict_entry_v2(minion_opts, master_opts, pki_ "ver": "2", "cmd": "_pillar", } - ret = await client.crypted_transfer_decode_dictentry( + ret = await client.crypted_transfer_decode_dictentry( # pylint: disable=E1121,E1123 load, dictkey="pillar", ) @@ -884,7 +884,7 @@ async def test_req_chan_decode_data_dict_entry_v2_bad_nonce( } with pytest.raises(salt.crypt.AuthenticationError) as excinfo: - ret = await client.crypted_transfer_decode_dictentry( + ret = await client.crypted_transfer_decode_dictentry( # pylint: disable=E1121,E1123 load, dictkey="pillar", ) @@ -972,7 +972,7 @@ async def test_req_chan_decode_data_dict_entry_v2_bad_signature( } with pytest.raises(salt.crypt.AuthenticationError) as excinfo: - ret = await client.crypted_transfer_decode_dictentry( + ret = await client.crypted_transfer_decode_dictentry( # pylint: disable=E1121,E1123 load, dictkey="pillar", ) @@ -1063,7 +1063,7 @@ async def test_req_chan_decode_data_dict_entry_v2_bad_key( } try: with pytest.raises(salt.crypt.AuthenticationError) as excinfo: - await client.crypted_transfer_decode_dictentry( + await client.crypted_transfer_decode_dictentry( # pylint: disable=E1121,E1123 load, dictkey="pillar", ) From 76ae4a687576eb2e4971523f30b64023bdd68f21 Mon Sep 17 00:00:00 2001 From: Max Arnold Date: Mon, 19 Feb 2024 15:50:39 +0700 Subject: [PATCH 091/157] Make sure the root minion process handles SIGUSR1 --- changelog/66095.fixed.md | 1 + salt/scripts.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 changelog/66095.fixed.md diff --git a/changelog/66095.fixed.md b/changelog/66095.fixed.md new file mode 100644 index 00000000000..42823db5738 --- /dev/null +++ b/changelog/66095.fixed.md @@ -0,0 +1 @@ +Make sure the root minion process handles SIGUSR1 and emits a traceback like the child minion processes diff --git a/salt/scripts.py b/salt/scripts.py index 662104a7142..4e0faff3004 100644 --- a/salt/scripts.py +++ b/salt/scripts.py @@ -162,9 +162,12 @@ def salt_minion(): """ import signal + import salt.utils.debug import salt.utils.platform import salt.utils.process + salt.utils.debug.enable_sigusr1_handler() + salt.utils.process.notify_systemd() import multiprocessing From 84b4e96db265946ed40364eb9ed90fcfb544cea9 Mon Sep 17 00:00:00 2001 From: Max Arnold Date: Tue, 20 Feb 2024 10:20:27 +0700 Subject: [PATCH 092/157] Add integration test --- changelog/66095.fixed.md | 2 +- tests/pytests/integration/cli/test_salt.py | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/changelog/66095.fixed.md b/changelog/66095.fixed.md index 42823db5738..c82f646aed2 100644 --- a/changelog/66095.fixed.md +++ b/changelog/66095.fixed.md @@ -1 +1 @@ -Make sure the root minion process handles SIGUSR1 and emits a traceback like the child minion processes +Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes diff --git a/tests/pytests/integration/cli/test_salt.py b/tests/pytests/integration/cli/test_salt.py index 37925160ca6..90e3eed6d78 100644 --- a/tests/pytests/integration/cli/test_salt.py +++ b/tests/pytests/integration/cli/test_salt.py @@ -2,6 +2,7 @@ :codeauthor: Thayne Harbaugh (tharbaug@adobe.com) """ +import glob import logging import os import shutil @@ -276,3 +277,28 @@ def test_minion_65400(salt_cli, salt_minion, salt_minion_2, salt_master): for minion_id in ret.data: assert ret.data[minion_id] != "Error: test.configurable_test_state" assert isinstance(ret.data[minion_id], dict) + + +@pytest.mark.skip_on_windows(reason="Windows does not support SIGUSR1") +def test_sigusr1_handler(salt_master, salt_minion): + """ + Ensure SIGUSR1 handler works. + + Refer to https://docs.saltproject.io/en/latest/topics/troubleshooting/minion.html#live-python-debug-output for more details. + """ + tb_glob = os.path.join(tempfile.gettempdir(), "salt-debug-*.log") + tracebacks_before = glob.glob(tb_glob) + os.kill(salt_minion.pid, signal.SIGUSR1) + for i in range(10): + if len(glob.glob(tb_glob)) - len(tracebacks_before) == 1: + break + time.sleep(1) + + os.kill(salt_master.pid, signal.SIGUSR1) + for i in range(10): + if len(glob.glob(tb_glob)) - len(tracebacks_before) == 2: + break + time.sleep(1) + + tracebacks_after = glob.glob(tb_glob) + assert len(tracebacks_after) - len(tracebacks_before) == 2 From 176bd3aca8f71c04da1cd74184cc22ad16e906e1 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Thu, 18 Jul 2024 14:09:17 -0700 Subject: [PATCH 093/157] Update certifi in answer to dependabot --- requirements/base.txt | 6 ++++-- requirements/static/ci/common.in | 2 -- requirements/static/ci/py3.10/cloud.txt | 7 +++---- requirements/static/ci/py3.10/darwin.txt | 7 +++---- requirements/static/ci/py3.10/docs.txt | 5 +++-- requirements/static/ci/py3.10/freebsd.txt | 7 +++---- requirements/static/ci/py3.10/lint.txt | 7 +++---- requirements/static/ci/py3.10/linux.txt | 7 +++---- requirements/static/ci/py3.10/windows.txt | 8 +++----- requirements/static/ci/py3.11/cloud.txt | 7 +++---- requirements/static/ci/py3.11/darwin.txt | 7 +++---- requirements/static/ci/py3.11/docs.txt | 5 +++-- requirements/static/ci/py3.11/freebsd.txt | 7 +++---- requirements/static/ci/py3.11/lint.txt | 7 +++---- requirements/static/ci/py3.11/linux.txt | 7 +++---- requirements/static/ci/py3.11/windows.txt | 8 +++----- requirements/static/ci/py3.12/cloud.txt | 7 +++---- requirements/static/ci/py3.12/darwin.txt | 7 +++---- requirements/static/ci/py3.12/docs.txt | 5 +++-- requirements/static/ci/py3.12/freebsd.txt | 7 +++---- requirements/static/ci/py3.12/lint.txt | 7 +++---- requirements/static/ci/py3.12/linux.txt | 7 +++---- requirements/static/ci/py3.12/windows.txt | 8 +++----- requirements/static/ci/py3.7/cloud.txt | 7 +++---- requirements/static/ci/py3.7/docs.txt | 5 +++-- requirements/static/ci/py3.7/freebsd.txt | 7 +++---- requirements/static/ci/py3.7/linux.txt | 7 +++---- requirements/static/ci/py3.7/windows.txt | 8 +++----- requirements/static/ci/py3.8/cloud.txt | 7 +++---- requirements/static/ci/py3.8/docs.txt | 5 +++-- requirements/static/ci/py3.8/freebsd.txt | 7 +++---- requirements/static/ci/py3.8/lint.txt | 7 +++---- requirements/static/ci/py3.8/linux.txt | 7 +++---- requirements/static/ci/py3.8/windows.txt | 8 +++----- requirements/static/ci/py3.9/cloud.txt | 7 +++---- requirements/static/ci/py3.9/darwin.txt | 7 +++---- requirements/static/ci/py3.9/docs.txt | 5 +++-- requirements/static/ci/py3.9/freebsd.txt | 7 +++---- requirements/static/ci/py3.9/lint.txt | 7 +++---- requirements/static/ci/py3.9/linux.txt | 7 +++---- requirements/static/ci/py3.9/windows.txt | 8 +++----- requirements/static/pkg/py3.10/darwin.txt | 8 +++++--- requirements/static/pkg/py3.10/freebsd.txt | 8 +++++--- requirements/static/pkg/py3.10/linux.txt | 8 +++++--- requirements/static/pkg/py3.10/windows.txt | 6 +++--- requirements/static/pkg/py3.11/darwin.txt | 8 +++++--- requirements/static/pkg/py3.11/freebsd.txt | 8 +++++--- requirements/static/pkg/py3.11/linux.txt | 8 +++++--- requirements/static/pkg/py3.11/windows.txt | 6 +++--- requirements/static/pkg/py3.12/darwin.txt | 8 +++++--- requirements/static/pkg/py3.12/freebsd.txt | 8 +++++--- requirements/static/pkg/py3.12/linux.txt | 8 +++++--- requirements/static/pkg/py3.12/windows.txt | 6 +++--- requirements/static/pkg/py3.7/freebsd.txt | 8 +++++--- requirements/static/pkg/py3.7/linux.txt | 8 +++++--- requirements/static/pkg/py3.7/windows.txt | 6 +++--- requirements/static/pkg/py3.8/freebsd.txt | 8 +++++--- requirements/static/pkg/py3.8/linux.txt | 8 +++++--- requirements/static/pkg/py3.8/windows.txt | 6 +++--- requirements/static/pkg/py3.9/darwin.txt | 8 +++++--- requirements/static/pkg/py3.9/freebsd.txt | 8 +++++--- requirements/static/pkg/py3.9/linux.txt | 8 +++++--- requirements/static/pkg/py3.9/windows.txt | 6 +++--- requirements/windows.txt | 2 -- 64 files changed, 219 insertions(+), 222 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 73010291794..de9cbaab17b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -5,8 +5,10 @@ jmespath msgpack>=1.0.0 PyYAML MarkupSafe -requests>=2.31.0 ; python_version < '3.8' -requests>=2.32.0 ; python_version >= '3.8' +requests<2.32.0 ; python_version < '3.10' +requests>=2.32.3 ; python_version >= '3.10' +certifi==2023.07.22; python_version < '3.10' +certifi>=2024.7.4; python_version >= '3.10' distro>=1.0.1 psutil>=5.0.0 packaging>=21.3 diff --git a/requirements/static/ci/common.in b/requirements/static/ci/common.in index 76983495f42..7611baf7373 100644 --- a/requirements/static/ci/common.in +++ b/requirements/static/ci/common.in @@ -7,7 +7,6 @@ apache-libcloud>=1.5.0; sys_platform != 'win32' boto3>=1.17.67 boto>=2.46.0 cassandra-driver>=2.0 -certifi>=2022.12.07 cffi>=1.14.6 cherrypy>=17.4.1 clustershell @@ -35,7 +34,6 @@ pycparser>=2.21; python_version >= '3.9' pyinotify>=0.9.6; sys_platform != 'win32' and sys_platform != 'darwin' and platform_system != "openbsd" python-etcd>0.4.2 pyvmomi -requests rfc3987 sqlparse>=0.4.4 strict_rfc3339>=0.7 diff --git a/requirements/static/ci/py3.10/cloud.txt b/requirements/static/ci/py3.10/cloud.txt index a997fa33723..ac9e868a1dc 100644 --- a/requirements/static/ci/py3.10/cloud.txt +++ b/requirements/static/ci/py3.10/cloud.txt @@ -67,11 +67,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.10/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/linux.txt # -c requirements/static/ci/py3.10/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -562,12 +562,11 @@ pyzmq==23.2.0 # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/linux.txt # -c requirements/static/ci/py3.10/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.10/darwin.txt b/requirements/static/ci/py3.10/darwin.txt index c830a95799b..1fcec03349a 100644 --- a/requirements/static/ci/py3.10/darwin.txt +++ b/requirements/static/ci/py3.10/darwin.txt @@ -48,10 +48,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/darwin.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -397,11 +397,10 @@ pyzmq==25.1.2 ; sys_platform == "darwin" # -c requirements/static/ci/../pkg/py3.10/darwin.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/darwin.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.10/docs.txt b/requirements/static/ci/py3.10/docs.txt index e5f2fa06df0..4aa8cfefe77 100644 --- a/requirements/static/ci/py3.10/docs.txt +++ b/requirements/static/ci/py3.10/docs.txt @@ -8,9 +8,10 @@ alabaster==0.7.12 # via sphinx babel==2.9.1 # via sphinx -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/py3.10/linux.txt + # -r requirements/base.txt # requests charset-normalizer==3.2.0 # via @@ -148,7 +149,7 @@ pyzmq==23.2.0 # via # -c requirements/static/ci/py3.10/linux.txt # -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/py3.10/linux.txt # -r requirements/base.txt diff --git a/requirements/static/ci/py3.10/freebsd.txt b/requirements/static/ci/py3.10/freebsd.txt index 316c7659cd4..695496a31fc 100644 --- a/requirements/static/ci/py3.10/freebsd.txt +++ b/requirements/static/ci/py3.10/freebsd.txt @@ -45,10 +45,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.24.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/freebsd.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -390,11 +390,10 @@ pyzmq==23.2.0 # -c requirements/static/ci/../pkg/py3.10/freebsd.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/freebsd.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.10/lint.txt b/requirements/static/ci/py3.10/lint.txt index 486f5600846..74febbd1a63 100644 --- a/requirements/static/ci/py3.10/lint.txt +++ b/requirements/static/ci/py3.10/lint.txt @@ -77,11 +77,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.10/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/linux.txt # -c requirements/static/ci/py3.10/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -532,12 +532,11 @@ redis==3.5.3 # via # -c requirements/static/ci/py3.10/linux.txt # redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/linux.txt # -c requirements/static/ci/py3.10/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.10/linux.txt b/requirements/static/ci/py3.10/linux.txt index 408bb559306..2d58958d020 100644 --- a/requirements/static/ci/py3.10/linux.txt +++ b/requirements/static/ci/py3.10/linux.txt @@ -53,10 +53,10 @@ cachetools==4.2.2 # python-telegram-bot cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -419,11 +419,10 @@ redis-py-cluster==2.1.3 # via -r requirements/static/ci/linux.in redis==3.5.3 # via redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.10/windows.txt b/requirements/static/ci/py3.10/windows.txt index 7b8227fe106..d382d567843 100644 --- a/requirements/static/ci/py3.10/windows.txt +++ b/requirements/static/ci/py3.10/windows.txt @@ -35,11 +35,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/windows.txt - # -r requirements/static/ci/common.in - # -r requirements/windows.txt + # -r requirements/base.txt # kubernetes # requests cffi==1.14.6 @@ -379,11 +378,10 @@ pyzmq==25.0.2 ; sys_platform == "win32" # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.10/windows.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # -r requirements/windows.txt # docker # etcd3-py diff --git a/requirements/static/ci/py3.11/cloud.txt b/requirements/static/ci/py3.11/cloud.txt index eb7685c6fe3..a83527ee15b 100644 --- a/requirements/static/ci/py3.11/cloud.txt +++ b/requirements/static/ci/py3.11/cloud.txt @@ -63,11 +63,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.11/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/linux.txt # -c requirements/static/ci/py3.11/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -524,12 +524,11 @@ pyzmq==23.2.0 # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/linux.txt # -c requirements/static/ci/py3.11/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.11/darwin.txt b/requirements/static/ci/py3.11/darwin.txt index 0474319bf16..7fd5ffd488e 100644 --- a/requirements/static/ci/py3.11/darwin.txt +++ b/requirements/static/ci/py3.11/darwin.txt @@ -44,10 +44,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/darwin.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -367,11 +367,10 @@ pyzmq==25.1.2 ; sys_platform == "darwin" # -c requirements/static/ci/../pkg/py3.11/darwin.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/darwin.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.11/docs.txt b/requirements/static/ci/py3.11/docs.txt index 67257cbc16a..eeb248be3f8 100644 --- a/requirements/static/ci/py3.11/docs.txt +++ b/requirements/static/ci/py3.11/docs.txt @@ -8,9 +8,10 @@ alabaster==0.7.12 # via sphinx babel==2.9.1 # via sphinx -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/py3.11/linux.txt + # -r requirements/base.txt # requests charset-normalizer==3.2.0 # via @@ -148,7 +149,7 @@ pyzmq==23.2.0 # via # -c requirements/static/ci/py3.11/linux.txt # -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/py3.11/linux.txt # -r requirements/base.txt diff --git a/requirements/static/ci/py3.11/freebsd.txt b/requirements/static/ci/py3.11/freebsd.txt index a343e3b7825..b6fc17085ae 100644 --- a/requirements/static/ci/py3.11/freebsd.txt +++ b/requirements/static/ci/py3.11/freebsd.txt @@ -43,10 +43,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.24.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/freebsd.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -365,11 +365,10 @@ pyzmq==23.2.0 # -c requirements/static/ci/../pkg/py3.11/freebsd.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/freebsd.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.11/lint.txt b/requirements/static/ci/py3.11/lint.txt index 0f82eeb9812..dfc0dd7c8b8 100644 --- a/requirements/static/ci/py3.11/lint.txt +++ b/requirements/static/ci/py3.11/lint.txt @@ -73,11 +73,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.11/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/linux.txt # -c requirements/static/ci/py3.11/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -497,12 +497,11 @@ redis==3.5.3 # via # -c requirements/static/ci/py3.11/linux.txt # redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/linux.txt # -c requirements/static/ci/py3.11/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.11/linux.txt b/requirements/static/ci/py3.11/linux.txt index 50f9d2e6c23..e4dee258e06 100644 --- a/requirements/static/ci/py3.11/linux.txt +++ b/requirements/static/ci/py3.11/linux.txt @@ -51,10 +51,10 @@ cachetools==4.2.2 # python-telegram-bot cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -394,11 +394,10 @@ redis-py-cluster==2.1.3 # via -r requirements/static/ci/linux.in redis==3.5.3 # via redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.11/windows.txt b/requirements/static/ci/py3.11/windows.txt index bba963d83c4..a2d42e2f6ef 100644 --- a/requirements/static/ci/py3.11/windows.txt +++ b/requirements/static/ci/py3.11/windows.txt @@ -33,11 +33,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/windows.txt - # -r requirements/static/ci/common.in - # -r requirements/windows.txt + # -r requirements/base.txt # kubernetes # requests cffi==1.14.6 @@ -375,11 +374,10 @@ pyzmq==25.0.2 ; sys_platform == "win32" # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.11/windows.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # -r requirements/windows.txt # docker # etcd3-py diff --git a/requirements/static/ci/py3.12/cloud.txt b/requirements/static/ci/py3.12/cloud.txt index b8ef4534c2d..a7aca219fc5 100644 --- a/requirements/static/ci/py3.12/cloud.txt +++ b/requirements/static/ci/py3.12/cloud.txt @@ -63,11 +63,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.12/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/linux.txt # -c requirements/static/ci/py3.12/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -524,12 +524,11 @@ pyzmq==23.2.0 # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/linux.txt # -c requirements/static/ci/py3.12/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.12/darwin.txt b/requirements/static/ci/py3.12/darwin.txt index ffbbd194ec6..5830968b7c2 100644 --- a/requirements/static/ci/py3.12/darwin.txt +++ b/requirements/static/ci/py3.12/darwin.txt @@ -44,10 +44,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/darwin.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -367,11 +367,10 @@ pyzmq==25.1.2 ; sys_platform == "darwin" # -c requirements/static/ci/../pkg/py3.12/darwin.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/darwin.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.12/docs.txt b/requirements/static/ci/py3.12/docs.txt index b32b4b18a24..c9695c7f880 100644 --- a/requirements/static/ci/py3.12/docs.txt +++ b/requirements/static/ci/py3.12/docs.txt @@ -8,9 +8,10 @@ alabaster==0.7.12 # via sphinx babel==2.9.1 # via sphinx -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/py3.12/linux.txt + # -r requirements/base.txt # requests charset-normalizer==3.2.0 # via @@ -148,7 +149,7 @@ pyzmq==23.2.0 # via # -c requirements/static/ci/py3.12/linux.txt # -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/py3.12/linux.txt # -r requirements/base.txt diff --git a/requirements/static/ci/py3.12/freebsd.txt b/requirements/static/ci/py3.12/freebsd.txt index 3ec1479d319..b0359448665 100644 --- a/requirements/static/ci/py3.12/freebsd.txt +++ b/requirements/static/ci/py3.12/freebsd.txt @@ -43,10 +43,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.24.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/freebsd.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -365,11 +365,10 @@ pyzmq==23.2.0 # -c requirements/static/ci/../pkg/py3.12/freebsd.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/freebsd.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.12/lint.txt b/requirements/static/ci/py3.12/lint.txt index 561121643c3..814acff00ac 100644 --- a/requirements/static/ci/py3.12/lint.txt +++ b/requirements/static/ci/py3.12/lint.txt @@ -73,11 +73,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.12/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/linux.txt # -c requirements/static/ci/py3.12/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -497,12 +497,11 @@ redis==3.5.3 # via # -c requirements/static/ci/py3.12/linux.txt # redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/linux.txt # -c requirements/static/ci/py3.12/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.12/linux.txt b/requirements/static/ci/py3.12/linux.txt index b5f17364acf..c0a9ce436b3 100644 --- a/requirements/static/ci/py3.12/linux.txt +++ b/requirements/static/ci/py3.12/linux.txt @@ -51,10 +51,10 @@ cachetools==4.2.2 # python-telegram-bot cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -394,11 +394,10 @@ redis-py-cluster==2.1.3 # via -r requirements/static/ci/linux.in redis==3.5.3 # via redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.12/windows.txt b/requirements/static/ci/py3.12/windows.txt index 10db47cc116..fe29b72443e 100644 --- a/requirements/static/ci/py3.12/windows.txt +++ b/requirements/static/ci/py3.12/windows.txt @@ -33,11 +33,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/windows.txt - # -r requirements/static/ci/common.in - # -r requirements/windows.txt + # -r requirements/base.txt # kubernetes # requests cffi==1.14.6 @@ -375,11 +374,10 @@ pyzmq==25.0.2 ; sys_platform == "win32" # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -c requirements/static/ci/../pkg/py3.12/windows.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # -r requirements/windows.txt # docker # etcd3-py diff --git a/requirements/static/ci/py3.7/cloud.txt b/requirements/static/ci/py3.7/cloud.txt index d2da47f844b..a124d4c40a7 100644 --- a/requirements/static/ci/py3.7/cloud.txt +++ b/requirements/static/ci/py3.7/cloud.txt @@ -71,11 +71,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.7/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/linux.txt # -c requirements/static/ci/py3.7/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -611,12 +611,11 @@ pyzmq==23.2.0 # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/linux.txt # -c requirements/static/ci/py3.7/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.7/docs.txt b/requirements/static/ci/py3.7/docs.txt index f47c5ecee2e..3792e50f542 100644 --- a/requirements/static/ci/py3.7/docs.txt +++ b/requirements/static/ci/py3.7/docs.txt @@ -8,9 +8,10 @@ alabaster==0.7.12 # via sphinx babel==2.9.1 # via sphinx -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/py3.7/linux.txt + # -r requirements/base.txt # requests charset-normalizer==3.2.0 # via @@ -152,7 +153,7 @@ pyzmq==23.2.0 # via # -c requirements/static/ci/py3.7/linux.txt # -r requirements/zeromq.txt -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/py3.7/linux.txt # -r requirements/base.txt diff --git a/requirements/static/ci/py3.7/freebsd.txt b/requirements/static/ci/py3.7/freebsd.txt index 486489b96fd..41265a081f7 100644 --- a/requirements/static/ci/py3.7/freebsd.txt +++ b/requirements/static/ci/py3.7/freebsd.txt @@ -49,10 +49,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.24.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/freebsd.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -432,11 +432,10 @@ pyzmq==23.2.0 # -c requirements/static/ci/../pkg/py3.7/freebsd.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/freebsd.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.7/linux.txt b/requirements/static/ci/py3.7/linux.txt index 4cef9ee8a92..03b9b6a2e88 100644 --- a/requirements/static/ci/py3.7/linux.txt +++ b/requirements/static/ci/py3.7/linux.txt @@ -55,10 +55,10 @@ cachetools==4.2.2 # python-telegram-bot cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -455,11 +455,10 @@ redis-py-cluster==2.1.3 # via -r requirements/static/ci/linux.in redis==3.5.3 # via redis-py-cluster -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.7/windows.txt b/requirements/static/ci/py3.7/windows.txt index f80bc01b0fe..fc175262e15 100644 --- a/requirements/static/ci/py3.7/windows.txt +++ b/requirements/static/ci/py3.7/windows.txt @@ -41,11 +41,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/windows.txt - # -r requirements/static/ci/common.in - # -r requirements/windows.txt + # -r requirements/base.txt # kubernetes # requests cffi==1.14.6 @@ -395,11 +394,10 @@ pyzmq==25.0.2 ; sys_platform == "win32" # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.7/windows.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # -r requirements/windows.txt # docker # etcd3-py diff --git a/requirements/static/ci/py3.8/cloud.txt b/requirements/static/ci/py3.8/cloud.txt index dad71be79ec..92138a595db 100644 --- a/requirements/static/ci/py3.8/cloud.txt +++ b/requirements/static/ci/py3.8/cloud.txt @@ -67,11 +67,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.8/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/linux.txt # -c requirements/static/ci/py3.8/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -597,12 +597,11 @@ pyzmq==23.2.0 # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/linux.txt # -c requirements/static/ci/py3.8/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.8/docs.txt b/requirements/static/ci/py3.8/docs.txt index 88f29939285..d1a767aff5e 100644 --- a/requirements/static/ci/py3.8/docs.txt +++ b/requirements/static/ci/py3.8/docs.txt @@ -8,9 +8,10 @@ alabaster==0.7.12 # via sphinx babel==2.9.1 # via sphinx -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/py3.8/linux.txt + # -r requirements/base.txt # requests charset-normalizer==3.2.0 # via @@ -148,7 +149,7 @@ pyzmq==23.2.0 # via # -c requirements/static/ci/py3.8/linux.txt # -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/py3.8/linux.txt # -r requirements/base.txt diff --git a/requirements/static/ci/py3.8/freebsd.txt b/requirements/static/ci/py3.8/freebsd.txt index fb29adecf8b..00cdba1b225 100644 --- a/requirements/static/ci/py3.8/freebsd.txt +++ b/requirements/static/ci/py3.8/freebsd.txt @@ -45,10 +45,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.24.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/freebsd.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -418,11 +418,10 @@ pyzmq==23.2.0 # -c requirements/static/ci/../pkg/py3.8/freebsd.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/freebsd.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.8/lint.txt b/requirements/static/ci/py3.8/lint.txt index 10379323d13..90e1576cda2 100644 --- a/requirements/static/ci/py3.8/lint.txt +++ b/requirements/static/ci/py3.8/lint.txt @@ -73,11 +73,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.8/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/linux.txt # -c requirements/static/ci/py3.8/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -559,12 +559,11 @@ redis==3.5.3 # via # -c requirements/static/ci/py3.8/linux.txt # redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/linux.txt # -c requirements/static/ci/py3.8/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.8/linux.txt b/requirements/static/ci/py3.8/linux.txt index 81e4f5887dd..594b8c106b7 100644 --- a/requirements/static/ci/py3.8/linux.txt +++ b/requirements/static/ci/py3.8/linux.txt @@ -51,10 +51,10 @@ cachetools==4.2.2 # python-telegram-bot cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -441,11 +441,10 @@ redis-py-cluster==2.1.3 # via -r requirements/static/ci/linux.in redis==3.5.3 # via redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.8/windows.txt b/requirements/static/ci/py3.8/windows.txt index 6e4fc76fa20..7df0ed905fc 100644 --- a/requirements/static/ci/py3.8/windows.txt +++ b/requirements/static/ci/py3.8/windows.txt @@ -37,11 +37,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/windows.txt - # -r requirements/static/ci/common.in - # -r requirements/windows.txt + # -r requirements/base.txt # kubernetes # requests cffi==1.14.6 @@ -381,11 +380,10 @@ pyzmq==25.0.2 ; sys_platform == "win32" # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.8/windows.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # -r requirements/windows.txt # docker # etcd3-py diff --git a/requirements/static/ci/py3.9/cloud.txt b/requirements/static/ci/py3.9/cloud.txt index 0fa77246a8f..647fc725be9 100644 --- a/requirements/static/ci/py3.9/cloud.txt +++ b/requirements/static/ci/py3.9/cloud.txt @@ -67,11 +67,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.9/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/linux.txt # -c requirements/static/ci/py3.9/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -599,12 +599,11 @@ pyzmq==23.2.0 # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/linux.txt # -c requirements/static/ci/py3.9/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.9/darwin.txt b/requirements/static/ci/py3.9/darwin.txt index c3ea1d2c1f2..12a75bae3d9 100644 --- a/requirements/static/ci/py3.9/darwin.txt +++ b/requirements/static/ci/py3.9/darwin.txt @@ -48,10 +48,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/darwin.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -427,11 +427,10 @@ pyzmq==25.1.2 ; sys_platform == "darwin" # -c requirements/static/ci/../pkg/py3.9/darwin.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/darwin.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.9/docs.txt b/requirements/static/ci/py3.9/docs.txt index f143242e05a..70e1fdc800a 100644 --- a/requirements/static/ci/py3.9/docs.txt +++ b/requirements/static/ci/py3.9/docs.txt @@ -8,9 +8,10 @@ alabaster==0.7.12 # via sphinx babel==2.9.1 # via sphinx -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/py3.9/linux.txt + # -r requirements/base.txt # requests charset-normalizer==3.2.0 # via @@ -152,7 +153,7 @@ pyzmq==23.2.0 # via # -c requirements/static/ci/py3.9/linux.txt # -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/py3.9/linux.txt # -r requirements/base.txt diff --git a/requirements/static/ci/py3.9/freebsd.txt b/requirements/static/ci/py3.9/freebsd.txt index 2aea4421744..f56f2ea6544 100644 --- a/requirements/static/ci/py3.9/freebsd.txt +++ b/requirements/static/ci/py3.9/freebsd.txt @@ -45,10 +45,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.24.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/freebsd.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # requests certvalidator==0.11.1 @@ -420,11 +420,10 @@ pyzmq==23.2.0 # -c requirements/static/ci/../pkg/py3.9/freebsd.txt # -r requirements/zeromq.txt # pytest-salt-factories -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/freebsd.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.9/lint.txt b/requirements/static/ci/py3.9/lint.txt index 1d9c6c700e8..201d3042e40 100644 --- a/requirements/static/ci/py3.9/lint.txt +++ b/requirements/static/ci/py3.9/lint.txt @@ -69,11 +69,11 @@ cassandra-driver==3.23.0 # via # -c requirements/static/ci/py3.9/linux.txt # -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/linux.txt # -c requirements/static/ci/py3.9/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -557,12 +557,11 @@ redis==3.5.3 # via # -c requirements/static/ci/py3.9/linux.txt # redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/linux.txt # -c requirements/static/ci/py3.9/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.9/linux.txt b/requirements/static/ci/py3.9/linux.txt index b51f0334b34..772d1601a6c 100644 --- a/requirements/static/ci/py3.9/linux.txt +++ b/requirements/static/ci/py3.9/linux.txt @@ -49,10 +49,10 @@ cachetools==4.2.2 # python-telegram-bot cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/linux.txt - # -r requirements/static/ci/common.in + # -r requirements/base.txt # kubernetes # python-telegram-bot # requests @@ -441,11 +441,10 @@ redis-py-cluster==2.1.3 # via -r requirements/static/ci/linux.in redis==3.5.3 # via redis-py-cluster -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/linux.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # apache-libcloud # docker # etcd3-py diff --git a/requirements/static/ci/py3.9/windows.txt b/requirements/static/ci/py3.9/windows.txt index df626b9c650..4e6e2182046 100644 --- a/requirements/static/ci/py3.9/windows.txt +++ b/requirements/static/ci/py3.9/windows.txt @@ -37,11 +37,10 @@ cachetools==3.1.0 # via google-auth cassandra-driver==3.23.0 # via -r requirements/static/ci/common.in -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/windows.txt - # -r requirements/static/ci/common.in - # -r requirements/windows.txt + # -r requirements/base.txt # kubernetes # requests cffi==1.14.6 @@ -382,11 +381,10 @@ pyzmq==25.0.2 ; sys_platform == "win32" # pytest-salt-factories requests-ntlm==1.1.0 # via pywinrm -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -c requirements/static/ci/../pkg/py3.9/windows.txt # -r requirements/base.txt - # -r requirements/static/ci/common.in # -r requirements/windows.txt # docker # etcd3-py diff --git a/requirements/static/pkg/py3.10/darwin.txt b/requirements/static/pkg/py3.10/darwin.txt index 352e85425db..b9dd0a54313 100644 --- a/requirements/static/pkg/py3.10/darwin.txt +++ b/requirements/static/pkg/py3.10/darwin.txt @@ -6,8 +6,10 @@ # apache-libcloud==2.5.0 # via -r requirements/darwin.txt -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -99,7 +101,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.1.2 ; sys_platform == "darwin" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -r requirements/base.txt # apache-libcloud diff --git a/requirements/static/pkg/py3.10/freebsd.txt b/requirements/static/pkg/py3.10/freebsd.txt index 5b70eee0931..063a0c1a7ad 100644 --- a/requirements/static/pkg/py3.10/freebsd.txt +++ b/requirements/static/pkg/py3.10/freebsd.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -89,7 +91,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via -r requirements/base.txt setproctitle==1.3.2 # via -r requirements/static/pkg/freebsd.in diff --git a/requirements/static/pkg/py3.10/linux.txt b/requirements/static/pkg/py3.10/linux.txt index 9837af9d246..96b8248f0ac 100644 --- a/requirements/static/pkg/py3.10/linux.txt +++ b/requirements/static/pkg/py3.10/linux.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -87,7 +89,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via -r requirements/base.txt rpm-vercmp==0.1.2 # via -r requirements/static/pkg/linux.in diff --git a/requirements/static/pkg/py3.10/windows.txt b/requirements/static/pkg/py3.10/windows.txt index bfe57f0e836..323a0a4ab1b 100644 --- a/requirements/static/pkg/py3.10/windows.txt +++ b/requirements/static/pkg/py3.10/windows.txt @@ -4,9 +4,9 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/windows.txt requirements/static/pkg/windows.in requirements/windows.txt # -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via - # -r requirements/windows.txt + # -r requirements/base.txt # requests cffi==1.14.6 # via @@ -106,7 +106,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.0.2 ; sys_platform == "win32" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -r requirements/base.txt # -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.11/darwin.txt b/requirements/static/pkg/py3.11/darwin.txt index 8aa87b6d47e..d403e84ad32 100644 --- a/requirements/static/pkg/py3.11/darwin.txt +++ b/requirements/static/pkg/py3.11/darwin.txt @@ -6,8 +6,10 @@ # apache-libcloud==2.5.0 # via -r requirements/darwin.txt -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -99,7 +101,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.1.2 ; sys_platform == "darwin" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -r requirements/base.txt # apache-libcloud diff --git a/requirements/static/pkg/py3.11/freebsd.txt b/requirements/static/pkg/py3.11/freebsd.txt index 34217f8d845..651e7d4da8b 100644 --- a/requirements/static/pkg/py3.11/freebsd.txt +++ b/requirements/static/pkg/py3.11/freebsd.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.11/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -89,7 +91,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via -r requirements/base.txt setproctitle==1.3.2 # via -r requirements/static/pkg/freebsd.in diff --git a/requirements/static/pkg/py3.11/linux.txt b/requirements/static/pkg/py3.11/linux.txt index fdda37052ce..11f449c7875 100644 --- a/requirements/static/pkg/py3.11/linux.txt +++ b/requirements/static/pkg/py3.11/linux.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.11/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -87,7 +89,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via -r requirements/base.txt rpm-vercmp==0.1.2 # via -r requirements/static/pkg/linux.in diff --git a/requirements/static/pkg/py3.11/windows.txt b/requirements/static/pkg/py3.11/windows.txt index e06961fc0b4..d9281f889f4 100644 --- a/requirements/static/pkg/py3.11/windows.txt +++ b/requirements/static/pkg/py3.11/windows.txt @@ -4,9 +4,9 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.11/windows.txt requirements/static/pkg/windows.in requirements/windows.txt # -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via - # -r requirements/windows.txt + # -r requirements/base.txt # requests cffi==1.14.6 # via @@ -106,7 +106,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.0.2 ; sys_platform == "win32" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -r requirements/base.txt # -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.12/darwin.txt b/requirements/static/pkg/py3.12/darwin.txt index aa0a2da85cd..41a493ed588 100644 --- a/requirements/static/pkg/py3.12/darwin.txt +++ b/requirements/static/pkg/py3.12/darwin.txt @@ -6,8 +6,10 @@ # apache-libcloud==2.5.0 # via -r requirements/darwin.txt -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -99,7 +101,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.1.2 ; sys_platform == "darwin" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -r requirements/base.txt # apache-libcloud diff --git a/requirements/static/pkg/py3.12/freebsd.txt b/requirements/static/pkg/py3.12/freebsd.txt index 5f0118af88c..2185eee5298 100644 --- a/requirements/static/pkg/py3.12/freebsd.txt +++ b/requirements/static/pkg/py3.12/freebsd.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.12/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -89,7 +91,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via -r requirements/base.txt setproctitle==1.3.2 # via -r requirements/static/pkg/freebsd.in diff --git a/requirements/static/pkg/py3.12/linux.txt b/requirements/static/pkg/py3.12/linux.txt index c7acdd062a7..2b833422400 100644 --- a/requirements/static/pkg/py3.12/linux.txt +++ b/requirements/static/pkg/py3.12/linux.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.12/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2024.7.4 ; python_version >= "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -87,7 +89,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via -r requirements/base.txt rpm-vercmp==0.1.2 # via -r requirements/static/pkg/linux.in diff --git a/requirements/static/pkg/py3.12/windows.txt b/requirements/static/pkg/py3.12/windows.txt index cc34a95759e..6c9aa944bc2 100644 --- a/requirements/static/pkg/py3.12/windows.txt +++ b/requirements/static/pkg/py3.12/windows.txt @@ -4,9 +4,9 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.12/windows.txt requirements/static/pkg/windows.in requirements/windows.txt # -certifi==2023.07.22 +certifi==2024.7.4 ; python_version >= "3.10" # via - # -r requirements/windows.txt + # -r requirements/base.txt # requests cffi==1.14.6 # via @@ -106,7 +106,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.0.2 ; sys_platform == "win32" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.32.3 ; python_version >= "3.10" # via # -r requirements/base.txt # -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.7/freebsd.txt b/requirements/static/pkg/py3.7/freebsd.txt index db76b8d06af..85f182959c5 100644 --- a/requirements/static/pkg/py3.7/freebsd.txt +++ b/requirements/static/pkg/py3.7/freebsd.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.7/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -87,7 +89,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via -r requirements/base.txt setproctitle==1.3.2 # via -r requirements/static/pkg/freebsd.in diff --git a/requirements/static/pkg/py3.7/linux.txt b/requirements/static/pkg/py3.7/linux.txt index 96aee564ac4..813d798eed8 100644 --- a/requirements/static/pkg/py3.7/linux.txt +++ b/requirements/static/pkg/py3.7/linux.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.7/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -85,7 +87,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via -r requirements/base.txt rpm-vercmp==0.1.2 # via -r requirements/static/pkg/linux.in diff --git a/requirements/static/pkg/py3.7/windows.txt b/requirements/static/pkg/py3.7/windows.txt index 3643bf7d4e1..c72e597ba09 100644 --- a/requirements/static/pkg/py3.7/windows.txt +++ b/requirements/static/pkg/py3.7/windows.txt @@ -4,9 +4,9 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.7/windows.txt requirements/static/pkg/windows.in requirements/windows.txt # -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via - # -r requirements/windows.txt + # -r requirements/base.txt # requests cffi==1.14.6 # via @@ -107,7 +107,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.0.2 ; sys_platform == "win32" # via -r requirements/zeromq.txt -requests==2.31.0 ; python_version < "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -r requirements/base.txt # -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.8/freebsd.txt b/requirements/static/pkg/py3.8/freebsd.txt index bbea4709b00..7e4336de18c 100644 --- a/requirements/static/pkg/py3.8/freebsd.txt +++ b/requirements/static/pkg/py3.8/freebsd.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.8/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -87,7 +89,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via -r requirements/base.txt setproctitle==1.3.2 # via -r requirements/static/pkg/freebsd.in diff --git a/requirements/static/pkg/py3.8/linux.txt b/requirements/static/pkg/py3.8/linux.txt index 6c5ed4a3008..0cd5288ade7 100644 --- a/requirements/static/pkg/py3.8/linux.txt +++ b/requirements/static/pkg/py3.8/linux.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.8/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -85,7 +87,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via -r requirements/base.txt rpm-vercmp==0.1.2 # via -r requirements/static/pkg/linux.in diff --git a/requirements/static/pkg/py3.8/windows.txt b/requirements/static/pkg/py3.8/windows.txt index d90856f7480..2aeef579a94 100644 --- a/requirements/static/pkg/py3.8/windows.txt +++ b/requirements/static/pkg/py3.8/windows.txt @@ -4,9 +4,9 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.8/windows.txt requirements/static/pkg/windows.in requirements/windows.txt # -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via - # -r requirements/windows.txt + # -r requirements/base.txt # requests cffi==1.14.6 # via @@ -107,7 +107,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.0.2 ; sys_platform == "win32" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -r requirements/base.txt # -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.9/darwin.txt b/requirements/static/pkg/py3.9/darwin.txt index a9559e40b8b..db297a4d1a8 100644 --- a/requirements/static/pkg/py3.9/darwin.txt +++ b/requirements/static/pkg/py3.9/darwin.txt @@ -6,8 +6,10 @@ # apache-libcloud==2.5.0 # via -r requirements/darwin.txt -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -99,7 +101,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.1.2 ; sys_platform == "darwin" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -r requirements/base.txt # apache-libcloud diff --git a/requirements/static/pkg/py3.9/freebsd.txt b/requirements/static/pkg/py3.9/freebsd.txt index 93e263fb218..5d40272ea6f 100644 --- a/requirements/static/pkg/py3.9/freebsd.txt +++ b/requirements/static/pkg/py3.9/freebsd.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -89,7 +91,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via -r requirements/base.txt setproctitle==1.3.2 # via -r requirements/static/pkg/freebsd.in diff --git a/requirements/static/pkg/py3.9/linux.txt b/requirements/static/pkg/py3.9/linux.txt index acc0aacd5fa..dde6cb7889a 100644 --- a/requirements/static/pkg/py3.9/linux.txt +++ b/requirements/static/pkg/py3.9/linux.txt @@ -4,8 +4,10 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt # -certifi==2023.07.22 - # via requests +certifi==2023.07.22 ; python_version < "3.10" + # via + # -r requirements/base.txt + # requests cffi==1.14.6 # via cryptography charset-normalizer==3.2.0 @@ -87,7 +89,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==23.2.0 # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via -r requirements/base.txt rpm-vercmp==0.1.2 # via -r requirements/static/pkg/linux.in diff --git a/requirements/static/pkg/py3.9/windows.txt b/requirements/static/pkg/py3.9/windows.txt index b41378856dd..a11256b8269 100644 --- a/requirements/static/pkg/py3.9/windows.txt +++ b/requirements/static/pkg/py3.9/windows.txt @@ -4,9 +4,9 @@ # # pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/windows.txt requirements/static/pkg/windows.in requirements/windows.txt # -certifi==2023.07.22 +certifi==2023.07.22 ; python_version < "3.10" # via - # -r requirements/windows.txt + # -r requirements/base.txt # requests cffi==1.14.6 # via @@ -107,7 +107,7 @@ pyyaml==6.0.1 # via -r requirements/base.txt pyzmq==25.0.2 ; sys_platform == "win32" # via -r requirements/zeromq.txt -requests==2.32.3 ; python_version >= "3.8" +requests==2.31.0 ; python_version < "3.10" # via # -r requirements/base.txt # -r requirements/windows.txt diff --git a/requirements/windows.txt b/requirements/windows.txt index ecb512cf343..9f9f6ad2e21 100644 --- a/requirements/windows.txt +++ b/requirements/windows.txt @@ -5,8 +5,6 @@ pywin32>=305 wmi>=1.5.1 pythonnet>=3.0.1 - -certifi>=2022.12.07 cffi>=1.14.5 cherrypy>=18.6.1 cryptography>=41.0.3 From 0fcde710627b8a29ff48de542fe9f88905add3ee Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Wed, 17 Jul 2024 14:47:14 -0600 Subject: [PATCH 094/157] Fixes cmd.run with requisites on Windows Formats the command properly for powershell Adds changelog and tests --- changelog/66596.fixed.md | 2 + salt/modules/cmdmod.py | 7 +- .../functional/states/cmd/test_cmd_run.py | 64 +++++++++++++++++++ tests/pytests/unit/modules/test_cmdmod.py | 13 +++- tests/pytests/unit/modules/test_pip.py | 4 +- 5 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 changelog/66596.fixed.md create mode 100644 tests/pytests/functional/states/cmd/test_cmd_run.py diff --git a/changelog/66596.fixed.md b/changelog/66596.fixed.md new file mode 100644 index 00000000000..a4a27151f2c --- /dev/null +++ b/changelog/66596.fixed.md @@ -0,0 +1,2 @@ +Fixed an issue with cmd.run with requirements when the shell is not the +default diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index 0b50b14dbb9..c76357ee1ac 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -290,7 +290,11 @@ def _prep_powershell_cmd(win_shell, cmd, encoded_cmd): # Strip whitespace if isinstance(cmd, list): cmd = " ".join(cmd) - new_cmd.extend(["-Command", f"& {{{cmd.strip()}}}"]) + + if cmd.startswith("$"): + new_cmd.extend(["-Command", f"{cmd.strip()}"]) + else: + new_cmd.extend(["-Command", f"& {cmd.strip()}"]) log.debug(new_cmd) return new_cmd @@ -4104,6 +4108,7 @@ def powershell( cmd = salt.utils.stringutils.to_str(cmd) encoded_cmd = True else: + cmd = f"{{{cmd}}}" encoded_cmd = False # Retrieve the response, while overriding shell with 'powershell' diff --git a/tests/pytests/functional/states/cmd/test_cmd_run.py b/tests/pytests/functional/states/cmd/test_cmd_run.py new file mode 100644 index 00000000000..22a5ba65698 --- /dev/null +++ b/tests/pytests/functional/states/cmd/test_cmd_run.py @@ -0,0 +1,64 @@ +import os + +import pytest + +import salt.utils.path + +pytestmark = [ + pytest.mark.windows_whitelisted, + pytest.mark.skip_unless_on_windows, + pytest.mark.destructive_test, + pytest.mark.slow_test, +] + + +@pytest.fixture(params=["powershell", "pwsh"]) +def shell(request): + """ + This will run the test on powershell and powershell core (pwsh). If + powershell core is not installed that test run will be skipped + """ + + if request.param == "pwsh" and salt.utils.path.which("pwsh") is None: + pytest.skip("Powershell 7 Not Present") + return request.param + + +def test_cmd_run_unless_true(shell, cmd): + # We need a directory that we know exists that has stuff in it + win_dir = os.getenv("WINDIR") + ret = cmd.run(name="echo foo", unless=f"ls {win_dir}", shell=shell) + assert ret.filtered["result"] is True + assert ret.filtered["name"] == "echo foo" + assert ret.filtered["comment"] == "unless condition is true" + assert ret.filtered["changes"] == {} + + +def test_cmd_run_unless_false(shell, cmd): + # We need a directory that we know does not exist + win_dir = "C:\\This\\Dir\\Does\\Not\\Exist" + ret = cmd.run(name="echo foo", unless=f"ls {win_dir}", shell=shell) + assert ret.filtered["result"] is True + assert ret.filtered["name"] == "echo foo" + assert ret.filtered["comment"] == 'Command "echo foo" run' + assert ret.filtered["changes"]["stdout"] == "foo" + + +def test_cmd_run_onlyif_true(shell, cmd): + # We need a directory that we know exists that has stuff in it + win_dir = os.getenv("WINDIR") + ret = cmd.run(name="echo foo", onlyif=f"ls {win_dir}", shell=shell) + assert ret.filtered["result"] is True + assert ret.filtered["name"] == "echo foo" + assert ret.filtered["comment"] == 'Command "echo foo" run' + assert ret.filtered["changes"]["stdout"] == "foo" + + +def test_cmd_run_onlyif_false(shell, cmd): + # We need a directory that we know does not exist + win_dir = "C:\\This\\Dir\\Does\\Not\\Exist" + ret = cmd.run(name="echo foo", onlyif=f"ls {win_dir}", shell=shell) + assert ret.filtered["result"] is True + assert ret.filtered["name"] == "echo foo" + assert ret.filtered["comment"] == "onlyif condition is false" + assert ret.filtered["changes"] == {} diff --git a/tests/pytests/unit/modules/test_cmdmod.py b/tests/pytests/unit/modules/test_cmdmod.py index cfc031fc063..e1f2a604cd1 100644 --- a/tests/pytests/unit/modules/test_cmdmod.py +++ b/tests/pytests/unit/modules/test_cmdmod.py @@ -1059,7 +1059,14 @@ def test_prep_powershell_cmd_no_powershell(): ) -def test_prep_powershell_cmd(): +@pytest.mark.parametrize( + "cmd, parsed", + [ + ("Write-Host foo", "& Write-Host foo"), + ("$PSVersionTable", "$PSVersionTable"), + ], +) +def test_prep_powershell_cmd(cmd, parsed): """ Tests _prep_powershell_cmd returns correct cmd """ @@ -1068,7 +1075,7 @@ def test_prep_powershell_cmd(): "salt.utils.path.which", return_value="C:\\powershell.exe" ): ret = cmdmod._prep_powershell_cmd( - win_shell="powershell", cmd="$PSVersionTable", encoded_cmd=False + win_shell="powershell", cmd=cmd, encoded_cmd=False ) expected = [ "C:\\powershell.exe", @@ -1077,7 +1084,7 @@ def test_prep_powershell_cmd(): "-ExecutionPolicy", "Bypass", "-Command", - "& {$PSVersionTable}", + parsed, ] assert ret == expected diff --git a/tests/pytests/unit/modules/test_pip.py b/tests/pytests/unit/modules/test_pip.py index c003e74aacb..87ffe29a857 100644 --- a/tests/pytests/unit/modules/test_pip.py +++ b/tests/pytests/unit/modules/test_pip.py @@ -474,10 +474,10 @@ def test_install_venv(): ) -def test_install_log_argument_in_resulting_command(python_binary): +def test_install_log_argument_in_resulting_command(python_binary, tmp_path): with patch("os.access") as mock_path: pkg = "pep8" - log_path = "/tmp/pip-install.log" + log_path = str(tmp_path / "pip-install.log") mock = MagicMock(return_value={"retcode": 0, "stdout": ""}) with patch.dict(pip.__salt__, {"cmd.run_all": mock}): pip.install(pkg, log=log_path) From 68d18b2ad3bb962ac2a30e9101e9253699db8819 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Mon, 22 Jul 2024 08:32:24 -0600 Subject: [PATCH 095/157] Fix win_dsc tests --- salt/modules/cmdmod.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/salt/modules/cmdmod.py b/salt/modules/cmdmod.py index c76357ee1ac..1891c044fb0 100644 --- a/salt/modules/cmdmod.py +++ b/salt/modules/cmdmod.py @@ -291,8 +291,14 @@ def _prep_powershell_cmd(win_shell, cmd, encoded_cmd): if isinstance(cmd, list): cmd = " ".join(cmd) - if cmd.startswith("$"): - new_cmd.extend(["-Command", f"{cmd.strip()}"]) + # Commands that are a specific keyword behave differently. They fail if + # you add a "&" to the front. Add those here as we find them: + keywords = ["$", "&", ".", "Configuration"] + + for keyword in keywords: + if cmd.startswith(keyword): + new_cmd.extend(["-Command", f"{cmd.strip()}"]) + break else: new_cmd.extend(["-Command", f"& {cmd.strip()}"]) From 137a6b7119d19fef833b070aea37a849434df2fc Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Mon, 22 Jul 2024 17:55:34 -0700 Subject: [PATCH 096/157] Revert windows installer check change --- .github/workflows/ci.yml | 12 ------------ .github/workflows/nightly.yml | 12 ------------ .github/workflows/scheduled.yml | 12 ------------ .github/workflows/staging.yml | 12 ------------ .github/workflows/templates/build-packages.yml.jinja | 1 - .github/workflows/templates/ci.yml.jinja | 12 ------------ .github/workflows/templates/layout.yml.jinja | 3 --- ...-action.yml => test-installer-action-windows.yml} | 10 ++++++---- 8 files changed, 6 insertions(+), 68 deletions(-) rename .github/workflows/{windows-installer-action.yml => test-installer-action-windows.yml} (85%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bdf4170ad4..20769929078 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,9 +134,6 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified - windows-installer: - - added|modified: - - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -248,12 +245,6 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" - windows-installer-check: - name: Windows Installer Check - if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} - uses: ./.github/workflows/windows-installer-action.yml - needs: - - prepare-workflow lint: name: Lint @@ -450,7 +441,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -465,7 +455,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -2141,7 +2130,6 @@ jobs: needs: - prepare-workflow - pre-commit - - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 435f6060c50..93c4c09f55e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -183,9 +183,6 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified - windows-installer: - - added|modified: - - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -297,12 +294,6 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" - windows-installer-check: - name: Windows Installer Check - if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} - uses: ./.github/workflows/windows-installer-action.yml - needs: - - prepare-workflow lint: name: Lint @@ -504,7 +495,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -523,7 +513,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -3036,7 +3025,6 @@ jobs: - trigger-branch-nightly-builds - prepare-workflow - pre-commit - - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 7cb09487032..2ab7dc11b6d 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -173,9 +173,6 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified - windows-installer: - - added|modified: - - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -287,12 +284,6 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" - windows-installer-check: - name: Windows Installer Check - if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} - uses: ./.github/workflows/windows-installer-action.yml - needs: - - prepare-workflow lint: name: Lint @@ -489,7 +480,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -504,7 +494,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -2182,7 +2171,6 @@ jobs: - trigger-branch-scheduled-builds - prepare-workflow - pre-commit - - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index bacd750547c..1313812f8ed 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -164,9 +164,6 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified - windows-installer: - - added|modified: - - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -287,12 +284,6 @@ jobs: cache-seed: ${{ needs.prepare-workflow.outputs.cache-seed }} changed-files: ${{ needs.prepare-workflow.outputs.changed-files }} pre-commit-version: "3.0.4" - windows-installer-check: - name: Windows Installer Check - if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} - uses: ./.github/workflows/windows-installer-action.yml - needs: - - prepare-workflow lint: name: Lint @@ -489,7 +480,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -508,7 +498,6 @@ jobs: needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" @@ -3039,7 +3028,6 @@ jobs: - check-requirements - prepare-workflow - pre-commit - - windows-installer-check - lint - build-docs - build-deps-onedir diff --git a/.github/workflows/templates/build-packages.yml.jinja b/.github/workflows/templates/build-packages.yml.jinja index cf64d3d80ac..745bcc3c9ca 100644 --- a/.github/workflows/templates/build-packages.yml.jinja +++ b/.github/workflows/templates/build-packages.yml.jinja @@ -10,7 +10,6 @@ needs: - prepare-workflow - build-salt-onedir - - windows-installer-check uses: ./.github/workflows/build-packages.yml with: salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}" diff --git a/.github/workflows/templates/ci.yml.jinja b/.github/workflows/templates/ci.yml.jinja index e323909c45a..eef2e77ba84 100644 --- a/.github/workflows/templates/ci.yml.jinja +++ b/.github/workflows/templates/ci.yml.jinja @@ -23,18 +23,6 @@ <%- endif %> - <%- set job_name = "windows-installer-check" %> - <%- if includes.get(job_name, True) %> - <{ job_name }>: - <%- do conclusion_needs.append(job_name) %> - name: Windows Installer Check - if: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] && fromJSON(needs.prepare-workflow.outputs.changed-files)['windows-installer'] }} - uses: ./.github/workflows/windows-installer-action.yml - needs: - - prepare-workflow - - <%- endif %> - <%- set job_name = "lint" %> <%- if includes.get(job_name, True) %> diff --git a/.github/workflows/templates/layout.yml.jinja b/.github/workflows/templates/layout.yml.jinja index f832bdca866..0f0e795c0c6 100644 --- a/.github/workflows/templates/layout.yml.jinja +++ b/.github/workflows/templates/layout.yml.jinja @@ -182,9 +182,6 @@ jobs: - *salt_added_modified - *tests_added_modified - *pkg_tests_added_modified - windows-installer: - - added|modified: - - pkg/windows/** - name: Set up Python 3.10 uses: actions/setup-python@v5 diff --git a/.github/workflows/windows-installer-action.yml b/.github/workflows/test-installer-action-windows.yml similarity index 85% rename from .github/workflows/windows-installer-action.yml rename to .github/workflows/test-installer-action-windows.yml index 0b3644bc3a3..cf0b48556bb 100644 --- a/.github/workflows/windows-installer-action.yml +++ b/.github/workflows/test-installer-action-windows.yml @@ -1,11 +1,13 @@ --- -name: Windows Installer Check +name: Test Windows Installer -on: workflow_call +on: pull_request + +permissions: + contents: read jobs: - windows-installer-check: - name: Windows Installer Check + Test-Windows-Installer: runs-on: - windows-latest From 22f3d2670896ca81c77be2ff4b689fbf4644aaa4 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Tue, 23 Jul 2024 01:30:07 -0700 Subject: [PATCH 097/157] Test check_version fix --- tests/pytests/pkg/integration/test_version.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 00b6e983607..8023cc5ee43 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -146,6 +146,10 @@ def test_compare_pkg_versions_redhat_rc(version, install_salt): package of the same version. For example, v3004~rc1 should be less than v3004. """ + if install_salt.downgrade: + version = install_salt.prev_version + else: + version = install_salt.version if install_salt.distro_id not in ( "almalinux", "rocky", From 962f7529fb0ee4cb4f2f4f6474b1ca9b18790132 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Tue, 23 Jul 2024 10:23:09 -0600 Subject: [PATCH 098/157] Accept 2 as a valid exitcode for the nsis installer --- tests/pytests/pkg/download/test_pkg_download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytests/pkg/download/test_pkg_download.py b/tests/pytests/pkg/download/test_pkg_download.py index 9a0fbd76bad..db91de0c93c 100644 --- a/tests/pytests/pkg/download/test_pkg_download.py +++ b/tests/pytests/pkg/download/test_pkg_download.py @@ -496,7 +496,7 @@ def setup_windows( ret = shell.run( "msiexec", "/qn", "/i", str(pkg_path), 'START_MINION=""' ) - assert ret.returncode == 0, ret + assert ret.returncode in (0, 2), ret log.debug("Removing installed salt-minion service") ret = shell.run( @@ -508,7 +508,7 @@ def setup_windows( "confirm", check=False, ) - assert ret.returncode == 0, ret + assert ret.returncode in (0, 2), ret else: # We are testing the onedir download onedir_name = f"salt-{salt_release}-onedir-windows-{arch}.zip" From f39b7992d7dd485ca50a16debc21d9bf3803b435 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 24 Jul 2024 00:42:24 -0700 Subject: [PATCH 099/157] Revert "Test check_version fix" This reverts commit 2cd8eb7e564ff2ce89c0c78231f0e962ae8d6534. --- tests/pytests/pkg/integration/test_version.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 8023cc5ee43..00b6e983607 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -146,10 +146,6 @@ def test_compare_pkg_versions_redhat_rc(version, install_salt): package of the same version. For example, v3004~rc1 should be less than v3004. """ - if install_salt.downgrade: - version = install_salt.prev_version - else: - version = install_salt.version if install_salt.distro_id not in ( "almalinux", "rocky", From 8f4565c42d563690b107b4483f7a1c3348cd9958 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 24 Jul 2024 00:49:01 -0700 Subject: [PATCH 100/157] Use artifact version for compare_versions test --- tests/pytests/pkg/integration/test_version.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 00b6e983607..48cf7081702 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -84,10 +84,11 @@ def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): @pytest.mark.parametrize( "binary", ["master", "cloud", "syndic", "minion", "call", "api"] ) -def test_compare_versions(version, binary, install_salt): +def test_compare_versions(binary, install_salt): """ Test compare versions """ + version = install_salt.artifact_version if binary in install_salt.binary_paths: if install_salt.upgrade: install_salt.install() From 6b0690e5afe52feae8e3deebbecbb09631cd08fd Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 25 Jul 2024 14:52:23 -0600 Subject: [PATCH 101/157] Remove debug output from shell scripts for packaging --- changelog/66747.fixed.md | 1 + pkg/debian/salt-api.postinst | 2 +- pkg/debian/salt-api.preinst | 2 +- pkg/debian/salt-cloud.postinst | 2 +- pkg/debian/salt-master.postinst | 2 +- pkg/debian/salt-master.preinst | 2 +- pkg/debian/salt-minion.postinst | 2 +- pkg/debian/salt-minion.preinst | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 changelog/66747.fixed.md diff --git a/changelog/66747.fixed.md b/changelog/66747.fixed.md new file mode 100644 index 00000000000..cd47b65a359 --- /dev/null +++ b/changelog/66747.fixed.md @@ -0,0 +1 @@ +Remove debug output from shell scripts for packaging diff --git a/pkg/debian/salt-api.postinst b/pkg/debian/salt-api.postinst index 923d8e65cf2..3b78211922a 100644 --- a/pkg/debian/salt-api.postinst +++ b/pkg/debian/salt-api.postinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule diff --git a/pkg/debian/salt-api.preinst b/pkg/debian/salt-api.preinst index b04068ac18d..ddc7c9e0ec7 100644 --- a/pkg/debian/salt-api.preinst +++ b/pkg/debian/salt-api.preinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule diff --git a/pkg/debian/salt-cloud.postinst b/pkg/debian/salt-cloud.postinst index 597584cf548..a6c3c2119a9 100644 --- a/pkg/debian/salt-cloud.postinst +++ b/pkg/debian/salt-cloud.postinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule diff --git a/pkg/debian/salt-master.postinst b/pkg/debian/salt-master.postinst index 37d2c667672..be7064f9bad 100644 --- a/pkg/debian/salt-master.postinst +++ b/pkg/debian/salt-master.postinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule diff --git a/pkg/debian/salt-master.preinst b/pkg/debian/salt-master.preinst index 3c31a65c430..af978b8e508 100644 --- a/pkg/debian/salt-master.preinst +++ b/pkg/debian/salt-master.preinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule diff --git a/pkg/debian/salt-minion.postinst b/pkg/debian/salt-minion.postinst index 94c61b9300e..13d1cf50901 100644 --- a/pkg/debian/salt-minion.postinst +++ b/pkg/debian/salt-minion.postinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule diff --git a/pkg/debian/salt-minion.preinst b/pkg/debian/salt-minion.preinst index cbbf1e23ad9..4a4cd949c64 100644 --- a/pkg/debian/salt-minion.preinst +++ b/pkg/debian/salt-minion.preinst @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . /usr/share/debconf/confmodule From 1b66ffc3acd71d43034126913e56094b381b3804 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 24 Jul 2024 11:13:03 -0600 Subject: [PATCH 102/157] Replace use of pygit2 deprecated and removed (1.15.0) oid with id --- salt/utils/gitfs.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py index 8cfdfd0e614..0c1bb4befe7 100644 --- a/salt/utils/gitfs.py +++ b/salt/utils/gitfs.py @@ -1803,7 +1803,7 @@ class Pygit2(GitProvider): # remote ref. self.repo.checkout(checkout_ref) if branch: - self.repo.reset(oid, pygit2.GIT_RESET_HARD) + self.repo.reset(pygit2_id, pygit2.GIT_RESET_HARD) return True except GitLockError as exc: if exc.errno == errno.EEXIST: @@ -1832,11 +1832,11 @@ class Pygit2(GitProvider): tag_ref = "refs/tags/" + tgt_ref if remote_ref in refs: # Get commit id for the remote ref - oid = self.peel(self.repo.lookup_reference(remote_ref)).id + pygit2_id = self.peel(self.repo.lookup_reference(remote_ref)).id if local_ref not in refs: # No local branch for this remote, so create one and point # it at the commit id of the remote ref - self.repo.create_reference(local_ref, oid) + self.repo.create_reference(local_ref, pygit2_id) try: target_sha = self.peel(self.repo.lookup_reference(remote_ref)).hex @@ -1867,7 +1867,7 @@ class Pygit2(GitProvider): # cachedir). head_ref = local_head.target # If head_ref is not a string, it will point to a - # pygit2.Oid object and we are in detached HEAD mode. + # pygit2.id object and we are in detached HEAD mode. # Therefore, there is no need to add a local reference. If # head_ref == local_ref, then the local reference for HEAD # in refs/heads/ already exists and again, no need to add. @@ -2036,10 +2036,10 @@ class Pygit2(GitProvider): the empty directories within it in the "blobs" list """ for entry in iter(tree): - if entry.oid not in self.repo: + if entry.id not in self.repo: # Entry is a submodule, skip it continue - blob = self.repo[entry.oid] + blob = self.repo[entry.id] if not isinstance(blob, pygit2.Tree): continue blobs.append( @@ -2058,8 +2058,8 @@ class Pygit2(GitProvider): return ret if self.root(tgt_env): try: - oid = tree[self.root(tgt_env)].oid - tree = self.repo[oid] + pygit2_id = tree[self.root(tgt_env)].id + tree = self.repo[pygit2_id] except KeyError: return ret if not isinstance(tree, pygit2.Tree): @@ -2179,17 +2179,17 @@ class Pygit2(GitProvider): the file paths and symlink info in the "blobs" dict """ for entry in iter(tree): - if entry.oid not in self.repo: + if entry.id not in self.repo: # Entry is a submodule, skip it continue - obj = self.repo[entry.oid] + obj = self.repo[entry.id] if isinstance(obj, pygit2.Blob): repo_path = salt.utils.path.join( prefix, entry.name, use_posixpath=True ) blobs.setdefault("files", []).append(repo_path) if stat.S_ISLNK(tree[entry.name].filemode): - link_tgt = self.repo[tree[entry.name].oid].data + link_tgt = self.repo[tree[entry.name].id].data blobs.setdefault("symlinks", {})[repo_path] = link_tgt elif isinstance(obj, pygit2.Tree): _traverse( @@ -2208,8 +2208,8 @@ class Pygit2(GitProvider): try: # This might need to be changed to account for a root that # spans more than one directory - oid = tree[self.root(tgt_env)].oid - tree = self.repo[oid] + pygit2_id = tree[self.root(tgt_env)].id + tree = self.repo[pygit2_id] except KeyError: return files, symlinks if not isinstance(tree, pygit2.Tree): @@ -2262,12 +2262,12 @@ class Pygit2(GitProvider): # path's object ID will be the target of the symlink. Follow # the symlink and set path to the location indicated # in the blob data. - link_tgt = self.repo[entry.oid].data + link_tgt = self.repo[entry.id].data path = salt.utils.path.join( os.path.dirname(path), link_tgt, use_posixpath=True ) else: - blob = self.repo[entry.oid] + blob = self.repo[entry.id] if isinstance(blob, pygit2.Tree): # Path is a directory, not a file. blob = None From c25c8d55e83a679384e60f3fdcb52fce780fa794 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 24 Jul 2024 14:36:11 -0600 Subject: [PATCH 103/157] Updated comment --- salt/utils/gitfs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py index 0c1bb4befe7..e988959109e 100644 --- a/salt/utils/gitfs.py +++ b/salt/utils/gitfs.py @@ -1867,7 +1867,8 @@ class Pygit2(GitProvider): # cachedir). head_ref = local_head.target # If head_ref is not a string, it will point to a - # pygit2.id object and we are in detached HEAD mode. + # pygit2.id object (oid is deprecated and removed) and + # we are in detached HEAD mode. # Therefore, there is no need to add a local reference. If # head_ref == local_ref, then the local reference for HEAD # in refs/heads/ already exists and again, no need to add. From a2b850557cde0e3e8e02be884e1642582162f063 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Fri, 26 Jul 2024 13:53:22 -0600 Subject: [PATCH 104/157] Make sure installer/uninstaller isn't running --- .../pytests/pkg/download/test_pkg_download.py | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/tests/pytests/pkg/download/test_pkg_download.py b/tests/pytests/pkg/download/test_pkg_download.py index db91de0c93c..0c0b5a21493 100644 --- a/tests/pytests/pkg/download/test_pkg_download.py +++ b/tests/pytests/pkg/download/test_pkg_download.py @@ -7,8 +7,10 @@ import logging import os import pathlib import shutil +import time import packaging.version +import psutil import pytest from pytestskipmarkers.utils import platform @@ -460,6 +462,7 @@ def setup_windows( repo_subpath, package_type, onedir_install_path, + timeout=300, ): try: arch = os.environ.get("SALT_REPO_ARCH") or "amd64" @@ -491,12 +494,51 @@ def setup_windows( pytest.helpers.download_file(win_pkg_url, pkg_path) if package_type.lower() == "nsis": + # We need to make sure there are no installer/uninstaller + # processes running. Uninst.exe launches a 2nd binary + # (Un.exe or Un_*.exe) Let's get the name of the process + processes = [ + win_pkg, + "uninst.exe", + "Un.exe", + "Un_A.exe", + "Un_B.exe", + "Un_C.exe", + "Un_D.exe", + "Un_D.exe", + "Un_F.exe", + "Un_G.exe", + ] + proc_name = "" + for proc in processes: + try: + if proc in (p.name() for p in psutil.process_iter()): + proc_name = proc + except psutil.NoSuchProcess: + continue + + # We need to give the process time to exit. We'll timeout after + # 5 minutes or whatever timeout is set to + if proc_name: + elapsed_time = 0 + while elapsed_time < timeout: + try: + if proc_name not in ( + p.name() for p in psutil.process_iter() + ): + break + except psutil.NoSuchProcess: + continue + elapsed_time += 0.1 + time.sleep(0.1) + + # Only run setup when we're sure no other installations are running ret = shell.run(str(pkg_path), "/start-minion=0", "/S", check=False) else: ret = shell.run( "msiexec", "/qn", "/i", str(pkg_path), 'START_MINION=""' ) - assert ret.returncode in (0, 2), ret + assert ret.returncode == 0, ret log.debug("Removing installed salt-minion service") ret = shell.run( @@ -508,7 +550,7 @@ def setup_windows( "confirm", check=False, ) - assert ret.returncode in (0, 2), ret + assert ret.returncode == 0, ret else: # We are testing the onedir download onedir_name = f"salt-{salt_release}-onedir-windows-{arch}.zip" From e1d3c747e8108944cdb593d1b08cb1a412b19a6b Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Fri, 26 Jul 2024 14:00:57 -0600 Subject: [PATCH 105/157] Skip pkg download test on Windows... for now --- tests/pytests/pkg/download/test_pkg_download.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pytests/pkg/download/test_pkg_download.py b/tests/pytests/pkg/download/test_pkg_download.py index 0c0b5a21493..a6f4c7e38e7 100644 --- a/tests/pytests/pkg/download/test_pkg_download.py +++ b/tests/pytests/pkg/download/test_pkg_download.py @@ -598,6 +598,7 @@ def salt_test_command(request, install_dir): return command +@pytest.mark.skip_on_windows(reason="This is flaky on Windows") @pytest.mark.parametrize("salt_test_command", get_salt_test_commands(), indirect=True) def test_download(shell, salt_test_command): """ From ef2a5a1a25bc919180bf8c6af1b7d7de5068840b Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sun, 28 Jul 2024 22:28:58 -0700 Subject: [PATCH 106/157] Fix windows pymssql requirement --- requirements/static/pkg/py3.10/windows.txt | 2 +- requirements/static/pkg/py3.11/windows.txt | 2 +- requirements/static/pkg/py3.12/windows.txt | 2 +- requirements/static/pkg/py3.7/windows.txt | 2 +- requirements/static/pkg/py3.8/windows.txt | 2 +- requirements/static/pkg/py3.9/windows.txt | 2 +- requirements/windows.txt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements/static/pkg/py3.10/windows.txt b/requirements/static/pkg/py3.10/windows.txt index 323a0a4ab1b..fd9408cfcf8 100644 --- a/requirements/static/pkg/py3.10/windows.txt +++ b/requirements/static/pkg/py3.10/windows.txt @@ -86,7 +86,7 @@ pycparser==2.21 # cffi pycryptodomex==3.19.1 # via -r requirements/crypto.txt -pymssql==2.2.7 +pymssql==2.3.0 # via -r requirements/windows.txt pyopenssl==24.0.0 # via -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.11/windows.txt b/requirements/static/pkg/py3.11/windows.txt index d9281f889f4..5543ea3ad16 100644 --- a/requirements/static/pkg/py3.11/windows.txt +++ b/requirements/static/pkg/py3.11/windows.txt @@ -86,7 +86,7 @@ pycparser==2.21 # cffi pycryptodomex==3.19.1 # via -r requirements/crypto.txt -pymssql==2.2.7 +pymssql==2.3.0 # via -r requirements/windows.txt pyopenssl==24.0.0 # via -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.12/windows.txt b/requirements/static/pkg/py3.12/windows.txt index 6c9aa944bc2..0a73cd361ba 100644 --- a/requirements/static/pkg/py3.12/windows.txt +++ b/requirements/static/pkg/py3.12/windows.txt @@ -86,7 +86,7 @@ pycparser==2.21 # cffi pycryptodomex==3.19.1 # via -r requirements/crypto.txt -pymssql==2.2.7 +pymssql==2.3.0 # via -r requirements/windows.txt pyopenssl==24.0.0 # via -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.7/windows.txt b/requirements/static/pkg/py3.7/windows.txt index c72e597ba09..68afbd4c574 100644 --- a/requirements/static/pkg/py3.7/windows.txt +++ b/requirements/static/pkg/py3.7/windows.txt @@ -86,7 +86,7 @@ pycparser==2.21 # cffi pycryptodomex==3.19.1 # via -r requirements/crypto.txt -pymssql==2.2.1 +pymssql==2.3.0 # via -r requirements/windows.txt pyopenssl==24.0.0 # via -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.8/windows.txt b/requirements/static/pkg/py3.8/windows.txt index 2aeef579a94..45a94eded65 100644 --- a/requirements/static/pkg/py3.8/windows.txt +++ b/requirements/static/pkg/py3.8/windows.txt @@ -86,7 +86,7 @@ pycparser==2.21 # cffi pycryptodomex==3.19.1 # via -r requirements/crypto.txt -pymssql==2.2.1 +pymssql==2.3.0 # via -r requirements/windows.txt pyopenssl==24.0.0 # via -r requirements/windows.txt diff --git a/requirements/static/pkg/py3.9/windows.txt b/requirements/static/pkg/py3.9/windows.txt index a11256b8269..f6beb8c616e 100644 --- a/requirements/static/pkg/py3.9/windows.txt +++ b/requirements/static/pkg/py3.9/windows.txt @@ -86,7 +86,7 @@ pycparser==2.21 # cffi pycryptodomex==3.19.1 # via -r requirements/crypto.txt -pymssql==2.2.1 +pymssql==2.3.0 # via -r requirements/windows.txt pyopenssl==24.0.0 # via -r requirements/windows.txt diff --git a/requirements/windows.txt b/requirements/windows.txt index 9f9f6ad2e21..b2e14435bd7 100644 --- a/requirements/windows.txt +++ b/requirements/windows.txt @@ -13,7 +13,7 @@ ioloop>=0.1a0 lxml>=4.6.3 pyasn1>=0.4.8 pycparser>=2.21 -pymssql>=2.2.1 +pymssql>=2.2.11 pyopenssl>=23.2.0 python-dateutil>=2.8.1 python-gnupg>=0.4.7 From 3b10d47286b668ad7ea15d0794d710d549ea3654 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sun, 28 Jul 2024 23:45:27 -0700 Subject: [PATCH 107/157] Fix windows requirments pre-commit --- requirements/static/ci/py3.10/windows.txt | 2 +- requirements/static/ci/py3.11/windows.txt | 2 +- requirements/static/ci/py3.12/windows.txt | 2 +- requirements/static/ci/py3.7/windows.txt | 2 +- requirements/static/ci/py3.8/windows.txt | 2 +- requirements/static/ci/py3.9/windows.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements/static/ci/py3.10/windows.txt b/requirements/static/ci/py3.10/windows.txt index d382d567843..c3d2ca7db3d 100644 --- a/requirements/static/ci/py3.10/windows.txt +++ b/requirements/static/ci/py3.10/windows.txt @@ -282,7 +282,7 @@ pyfakefs==5.3.1 # via -r requirements/pytest.txt pygit2==1.13.1 # via -r requirements/static/ci/windows.in -pymssql==2.2.7 +pymssql==2.3.0 # via # -c requirements/static/ci/../pkg/py3.10/windows.txt # -r requirements/windows.txt diff --git a/requirements/static/ci/py3.11/windows.txt b/requirements/static/ci/py3.11/windows.txt index a2d42e2f6ef..533a506872c 100644 --- a/requirements/static/ci/py3.11/windows.txt +++ b/requirements/static/ci/py3.11/windows.txt @@ -278,7 +278,7 @@ pyfakefs==5.3.1 # via -r requirements/pytest.txt pygit2==1.13.1 # via -r requirements/static/ci/windows.in -pymssql==2.2.7 +pymssql==2.3.0 # via # -c requirements/static/ci/../pkg/py3.11/windows.txt # -r requirements/windows.txt diff --git a/requirements/static/ci/py3.12/windows.txt b/requirements/static/ci/py3.12/windows.txt index fe29b72443e..83a5207977d 100644 --- a/requirements/static/ci/py3.12/windows.txt +++ b/requirements/static/ci/py3.12/windows.txt @@ -278,7 +278,7 @@ pyfakefs==5.3.1 # via -r requirements/pytest.txt pygit2==1.13.1 # via -r requirements/static/ci/windows.in -pymssql==2.2.7 +pymssql==2.3.0 # via # -c requirements/static/ci/../pkg/py3.12/windows.txt # -r requirements/windows.txt diff --git a/requirements/static/ci/py3.7/windows.txt b/requirements/static/ci/py3.7/windows.txt index fc175262e15..de820b25b40 100644 --- a/requirements/static/ci/py3.7/windows.txt +++ b/requirements/static/ci/py3.7/windows.txt @@ -297,7 +297,7 @@ pyfakefs==5.3.1 # via -r requirements/pytest.txt pygit2==1.10.1 # via -r requirements/static/ci/windows.in -pymssql==2.2.1 +pymssql==2.3.0 # via # -c requirements/static/ci/../pkg/py3.7/windows.txt # -r requirements/windows.txt diff --git a/requirements/static/ci/py3.8/windows.txt b/requirements/static/ci/py3.8/windows.txt index 7df0ed905fc..3e67555b202 100644 --- a/requirements/static/ci/py3.8/windows.txt +++ b/requirements/static/ci/py3.8/windows.txt @@ -283,7 +283,7 @@ pyfakefs==5.3.1 # via -r requirements/pytest.txt pygit2==1.13.1 # via -r requirements/static/ci/windows.in -pymssql==2.2.1 +pymssql==2.3.0 # via # -c requirements/static/ci/../pkg/py3.8/windows.txt # -r requirements/windows.txt diff --git a/requirements/static/ci/py3.9/windows.txt b/requirements/static/ci/py3.9/windows.txt index 4e6e2182046..af27c5a56d2 100644 --- a/requirements/static/ci/py3.9/windows.txt +++ b/requirements/static/ci/py3.9/windows.txt @@ -284,7 +284,7 @@ pyfakefs==5.3.1 # via -r requirements/pytest.txt pygit2==1.13.1 # via -r requirements/static/ci/windows.in -pymssql==2.2.1 +pymssql==2.3.0 # via # -c requirements/static/ci/../pkg/py3.9/windows.txt # -r requirements/windows.txt From b40833ed15b2c8b1b169560b694e02489de84782 Mon Sep 17 00:00:00 2001 From: Salt Project Packaging Date: Mon, 29 Jul 2024 07:51:58 +0000 Subject: [PATCH 108/157] Release v3006.9 --- CHANGELOG.md | 72 ++++ changelog/50196.fixed.md | 1 - changelog/51605.fixed.md | 1 - changelog/56441.fixed.md | 1 - changelog/57649.fixed.md | 1 - changelog/61100.fixed.md | 1 - changelog/61143.fixed.md | 1 - changelog/61166.fixed.md | 5 - changelog/61534.fixed.md | 2 - changelog/63102.fixed.md | 1 - changelog/64300.fixed.md | 1 - changelog/64563.fixed.md | 1 - changelog/64728.fixed.md | 1 - changelog/65067.fixed.md | 1 - changelog/65251.fixed.md | 1 - changelog/65264.fixed.md | 1 - changelog/65295.fixed.md | 1 - changelog/65304.fixed.md | 1 - changelog/65630.fixed.md | 1 - changelog/65816.fixed.md | 1 - changelog/65837.fixed.md | 1 - changelog/66095.fixed.md | 1 - changelog/66132.fixed.md | 1 - changelog/66180.added.md | 1 - changelog/66300.added.md | 1 - changelog/66342.fixed.md | 1 - changelog/66347.fixed.md | 1 - changelog/66382.fixed.md | 1 - changelog/66414.fixed.md | 1 - changelog/66441.fixed.md | 1 - changelog/66488.security.md | 1 - changelog/66514.fixed.md | 1 - changelog/66579.fixed.md | 1 - changelog/66588.fixed.md | 1 - changelog/66596.fixed.md | 2 - changelog/66604.fixed.md | 1 - changelog/66623.deprecated.md | 1 - changelog/66624.added.md | 1 - changelog/66624.deprecated.md | 1 - changelog/66632.fixed.md | 1 - changelog/66663.fixed.md | 1 - changelog/66666.fixed.md | 4 - changelog/66683.fixed.md | 1 - changelog/66702.security.md | 2 - changelog/66747.fixed.md | 1 - doc/man/salt-api.1 | 2 +- doc/man/salt-call.1 | 2 +- doc/man/salt-cloud.1 | 2 +- doc/man/salt-cp.1 | 2 +- doc/man/salt-key.1 | 2 +- doc/man/salt-master.1 | 2 +- doc/man/salt-minion.1 | 2 +- doc/man/salt-proxy.1 | 2 +- doc/man/salt-run.1 | 2 +- doc/man/salt-ssh.1 | 2 +- doc/man/salt-syndic.1 | 2 +- doc/man/salt.1 | 2 +- doc/man/salt.7 | 396 +++++++++++++----- doc/man/spm.1 | 2 +- doc/topics/releases/3006.9.md | 87 ++++ .../releases/templates/3006.9.md.template | 14 + pkg/debian/changelog | 71 ++++ pkg/rpm/salt.spec | 70 +++- 63 files changed, 610 insertions(+), 180 deletions(-) delete mode 100644 changelog/50196.fixed.md delete mode 100644 changelog/51605.fixed.md delete mode 100644 changelog/56441.fixed.md delete mode 100644 changelog/57649.fixed.md delete mode 100644 changelog/61100.fixed.md delete mode 100644 changelog/61143.fixed.md delete mode 100644 changelog/61166.fixed.md delete mode 100644 changelog/61534.fixed.md delete mode 100644 changelog/63102.fixed.md delete mode 100644 changelog/64300.fixed.md delete mode 100644 changelog/64563.fixed.md delete mode 100644 changelog/64728.fixed.md delete mode 100644 changelog/65067.fixed.md delete mode 100644 changelog/65251.fixed.md delete mode 100644 changelog/65264.fixed.md delete mode 100644 changelog/65295.fixed.md delete mode 100644 changelog/65304.fixed.md delete mode 100644 changelog/65630.fixed.md delete mode 100644 changelog/65816.fixed.md delete mode 100644 changelog/65837.fixed.md delete mode 100644 changelog/66095.fixed.md delete mode 100644 changelog/66132.fixed.md delete mode 100644 changelog/66180.added.md delete mode 100644 changelog/66300.added.md delete mode 100644 changelog/66342.fixed.md delete mode 100644 changelog/66347.fixed.md delete mode 100644 changelog/66382.fixed.md delete mode 100644 changelog/66414.fixed.md delete mode 100644 changelog/66441.fixed.md delete mode 100644 changelog/66488.security.md delete mode 100644 changelog/66514.fixed.md delete mode 100644 changelog/66579.fixed.md delete mode 100644 changelog/66588.fixed.md delete mode 100644 changelog/66596.fixed.md delete mode 100644 changelog/66604.fixed.md delete mode 100644 changelog/66623.deprecated.md delete mode 100644 changelog/66624.added.md delete mode 100644 changelog/66624.deprecated.md delete mode 100644 changelog/66632.fixed.md delete mode 100644 changelog/66663.fixed.md delete mode 100644 changelog/66666.fixed.md delete mode 100644 changelog/66683.fixed.md delete mode 100644 changelog/66702.security.md delete mode 100644 changelog/66747.fixed.md create mode 100644 doc/topics/releases/3006.9.md create mode 100644 doc/topics/releases/templates/3006.9.md.template diff --git a/CHANGELOG.md b/CHANGELOG.md index 866cb70b9e3..4528c265d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,78 @@ Versions are `MAJOR.PATCH`. # Changelog +## 3006.9 (2024-07-29) + + +### Deprecated + +- Drop CentOS 7 support [#66623](https://github.com/saltstack/salt/issues/66623) +- No longer build RPM packages with CentOS Stream 9 [#66624](https://github.com/saltstack/salt/issues/66624) + + +### Fixed + +- Made slsutil.renderer work with salt-ssh [#50196](https://github.com/saltstack/salt/issues/50196) +- Fixed defaults.merge is not available when using salt-ssh [#51605](https://github.com/saltstack/salt/issues/51605) +- Fixed config.get does not support merge option with salt-ssh [#56441](https://github.com/saltstack/salt/issues/56441) +- Update to include croniter in pkg requirements [#57649](https://github.com/saltstack/salt/issues/57649) +- Fixed state.test does not work with salt-ssh [#61100](https://github.com/saltstack/salt/issues/61100) +- Made slsutil.findup work with salt-ssh [#61143](https://github.com/saltstack/salt/issues/61143) +- Fixes multiple issues with the cmd module on Windows. Scripts are called using + the ``-File`` parameter to the ``powershell.exe`` binary. ``CLIXML`` data in + stderr is now removed (only applies to encoded commands). Commands can now be + sent to ``cmd.powershell`` as a list. Makes sure JSON data returned is valid. + Strips whitespace from the return when using ``runas``. [#61166](https://github.com/saltstack/salt/issues/61166) +- Fixed the win_lgpo_netsh salt util to handle non-English systems. This was a + rewrite to use PowerShell instead of netsh to make the changes on the system [#61534](https://github.com/saltstack/salt/issues/61534) +- file.replace and file.search work properly with /proc files [#63102](https://github.com/saltstack/salt/issues/63102) +- Fix utf8 handling in 'pass' renderer [#64300](https://github.com/saltstack/salt/issues/64300) +- Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module. [#64563](https://github.com/saltstack/salt/issues/64563) +- salt-cloud honors root_dir config setting for log_file location and fixes for root_dir locations on windows. [#64728](https://github.com/saltstack/salt/issues/64728) +- Fixed slsutil.update with salt-ssh during template rendering [#65067](https://github.com/saltstack/salt/issues/65067) +- Fix config.items when called on minion [#65251](https://github.com/saltstack/salt/issues/65251) +- Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade [#65264](https://github.com/saltstack/salt/issues/65264) +- Fix typo in nftables module to ensure unique nft family values [#65295](https://github.com/saltstack/salt/issues/65295) +- pkg.installed state aggregate does not honors requires requisite [#65304](https://github.com/saltstack/salt/issues/65304) +- Added SSH wrapper for logmod [#65630](https://github.com/saltstack/salt/issues/65630) +- Fix for GitFS failure to unlock lock file, and resource cleanup for process SIGTERM [#65816](https://github.com/saltstack/salt/issues/65816) +- Corrected x509_v2 CRL creation `last_update` and `next_update` values when system timezone is not UTC [#65837](https://github.com/saltstack/salt/issues/65837) +- Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes [#66095](https://github.com/saltstack/salt/issues/66095) +- Replaced pyvenv with builtin venv for virtualenv_mod [#66132](https://github.com/saltstack/salt/issues/66132) +- Made `file.managed` skip download of a remote source if the managed file already exists with the correct hash [#66342](https://github.com/saltstack/salt/issues/66342) +- Fix win_task ExecutionTimeLimit and result/error code interpretation [#66347](https://github.com/saltstack/salt/issues/66347), [#66441](https://github.com/saltstack/salt/issues/66441) +- Fixed nftables.build_rule breaks ipv6 rules by using the wrong syntax for source and destination addresses [#66382](https://github.com/saltstack/salt/issues/66382) +- Fixed x509_v2 certificate.managed crash for locally signed certificates if the signing policy defines signing_private_key [#66414](https://github.com/saltstack/salt/issues/66414) +- Fixed parallel state execution with Salt-SSH [#66514](https://github.com/saltstack/salt/issues/66514) +- Fix support for FIPS approved encryption and signing algorithms. [#66579](https://github.com/saltstack/salt/issues/66579) +- Fix relative file_roots paths [#66588](https://github.com/saltstack/salt/issues/66588) +- Fixed an issue with cmd.run with requirements when the shell is not the + default [#66596](https://github.com/saltstack/salt/issues/66596) +- Fix RPM package provides [#66604](https://github.com/saltstack/salt/issues/66604) +- Upgrade relAenv to 0.16.1. This release fixes several package installs for salt-pip [#66632](https://github.com/saltstack/salt/issues/66632) +- Upgrade relenv to 0.17.0 (https://github.com/saltstack/relenv/blob/v0.17.0/CHANGELOG.md) [#66663](https://github.com/saltstack/salt/issues/66663) +- Upgrade dependencies due to security issues: + - pymysql>=1.1.1 + - requests>=2.32.0 + - docker>=7.1.0 [#66666](https://github.com/saltstack/salt/issues/66666) +- Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044 [#66683](https://github.com/saltstack/salt/issues/66683) +- Remove debug output from shell scripts for packaging [#66747](https://github.com/saltstack/salt/issues/66747) + + +### Added + +- Add Ubuntu 24.04 support [#66180](https://github.com/saltstack/salt/issues/66180) +- Add Fedora 40 support, replacing Fedora 39 [#66300](https://github.com/saltstack/salt/issues/66300) +- Build RPM packages with Rocky Linux 9 (instead of CentOS Stream 9) [#66624](https://github.com/saltstack/salt/issues/66624) + + +### Security + +- Bump to ``jinja2==3.1.4`` due to https://github.com/advisories/GHSA-h75v-3vvj-5mfj [#66488](https://github.com/saltstack/salt/issues/66488) +- CVE-2024-37088 salt-call will fail with exit code 1 if bad pillar data is + encountered. [#66702](https://github.com/saltstack/salt/issues/66702) + + ## 3006.8 (2024-04-29) diff --git a/changelog/50196.fixed.md b/changelog/50196.fixed.md deleted file mode 100644 index 979411a640d..00000000000 --- a/changelog/50196.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Made slsutil.renderer work with salt-ssh diff --git a/changelog/51605.fixed.md b/changelog/51605.fixed.md deleted file mode 100644 index 990b34413d9..00000000000 --- a/changelog/51605.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed defaults.merge is not available when using salt-ssh diff --git a/changelog/56441.fixed.md b/changelog/56441.fixed.md deleted file mode 100644 index 489ad80f770..00000000000 --- a/changelog/56441.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed config.get does not support merge option with salt-ssh diff --git a/changelog/57649.fixed.md b/changelog/57649.fixed.md deleted file mode 100644 index 12d22a0531c..00000000000 --- a/changelog/57649.fixed.md +++ /dev/null @@ -1 +0,0 @@ - Update to include croniter in pkg requirements diff --git a/changelog/61100.fixed.md b/changelog/61100.fixed.md deleted file mode 100644 index d7ac2b6bc3f..00000000000 --- a/changelog/61100.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed state.test does not work with salt-ssh diff --git a/changelog/61143.fixed.md b/changelog/61143.fixed.md deleted file mode 100644 index 08a62c9d8b1..00000000000 --- a/changelog/61143.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Made slsutil.findup work with salt-ssh diff --git a/changelog/61166.fixed.md b/changelog/61166.fixed.md deleted file mode 100644 index f197c324c9e..00000000000 --- a/changelog/61166.fixed.md +++ /dev/null @@ -1,5 +0,0 @@ -Fixes multiple issues with the cmd module on Windows. Scripts are called using -the ``-File`` parameter to the ``powershell.exe`` binary. ``CLIXML`` data in -stderr is now removed (only applies to encoded commands). Commands can now be -sent to ``cmd.powershell`` as a list. Makes sure JSON data returned is valid. -Strips whitespace from the return when using ``runas``. diff --git a/changelog/61534.fixed.md b/changelog/61534.fixed.md deleted file mode 100644 index ed6c4401140..00000000000 --- a/changelog/61534.fixed.md +++ /dev/null @@ -1,2 +0,0 @@ -Fixed the win_lgpo_netsh salt util to handle non-English systems. This was a -rewrite to use PowerShell instead of netsh to make the changes on the system diff --git a/changelog/63102.fixed.md b/changelog/63102.fixed.md deleted file mode 100644 index 535e1a6c804..00000000000 --- a/changelog/63102.fixed.md +++ /dev/null @@ -1 +0,0 @@ -file.replace and file.search work properly with /proc files diff --git a/changelog/64300.fixed.md b/changelog/64300.fixed.md deleted file mode 100644 index 4418db1d04c..00000000000 --- a/changelog/64300.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix utf8 handling in 'pass' renderer diff --git a/changelog/64563.fixed.md b/changelog/64563.fixed.md deleted file mode 100644 index fadd9721fed..00000000000 --- a/changelog/64563.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module. diff --git a/changelog/64728.fixed.md b/changelog/64728.fixed.md deleted file mode 100644 index afe36f42316..00000000000 --- a/changelog/64728.fixed.md +++ /dev/null @@ -1 +0,0 @@ -salt-cloud honors root_dir config setting for log_file location and fixes for root_dir locations on windows. diff --git a/changelog/65067.fixed.md b/changelog/65067.fixed.md deleted file mode 100644 index d6de87b5bc1..00000000000 --- a/changelog/65067.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed slsutil.update with salt-ssh during template rendering diff --git a/changelog/65251.fixed.md b/changelog/65251.fixed.md deleted file mode 100644 index e8abd5af327..00000000000 --- a/changelog/65251.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix config.items when called on minion diff --git a/changelog/65264.fixed.md b/changelog/65264.fixed.md deleted file mode 100644 index 42bb45ac968..00000000000 --- a/changelog/65264.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade diff --git a/changelog/65295.fixed.md b/changelog/65295.fixed.md deleted file mode 100644 index c672de05b75..00000000000 --- a/changelog/65295.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix typo in nftables module to ensure unique nft family values diff --git a/changelog/65304.fixed.md b/changelog/65304.fixed.md deleted file mode 100644 index dd162cee714..00000000000 --- a/changelog/65304.fixed.md +++ /dev/null @@ -1 +0,0 @@ -pkg.installed state aggregate does not honors requires requisite diff --git a/changelog/65630.fixed.md b/changelog/65630.fixed.md deleted file mode 100644 index e8650abcdc1..00000000000 --- a/changelog/65630.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Added SSH wrapper for logmod diff --git a/changelog/65816.fixed.md b/changelog/65816.fixed.md deleted file mode 100644 index 23aaa1e5e8e..00000000000 --- a/changelog/65816.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix for GitFS failure to unlock lock file, and resource cleanup for process SIGTERM diff --git a/changelog/65837.fixed.md b/changelog/65837.fixed.md deleted file mode 100644 index 72f4a30fbda..00000000000 --- a/changelog/65837.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Corrected x509_v2 CRL creation `last_update` and `next_update` values when system timezone is not UTC diff --git a/changelog/66095.fixed.md b/changelog/66095.fixed.md deleted file mode 100644 index c82f646aed2..00000000000 --- a/changelog/66095.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes diff --git a/changelog/66132.fixed.md b/changelog/66132.fixed.md deleted file mode 100644 index 7a64fee8c1e..00000000000 --- a/changelog/66132.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Replaced pyvenv with builtin venv for virtualenv_mod diff --git a/changelog/66180.added.md b/changelog/66180.added.md deleted file mode 100644 index 92925b9f907..00000000000 --- a/changelog/66180.added.md +++ /dev/null @@ -1 +0,0 @@ -Add Ubuntu 24.04 support diff --git a/changelog/66300.added.md b/changelog/66300.added.md deleted file mode 100644 index 18b4964110f..00000000000 --- a/changelog/66300.added.md +++ /dev/null @@ -1 +0,0 @@ -Add Fedora 40 support, replacing Fedora 39 diff --git a/changelog/66342.fixed.md b/changelog/66342.fixed.md deleted file mode 100644 index da57b2926d0..00000000000 --- a/changelog/66342.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Made `file.managed` skip download of a remote source if the managed file already exists with the correct hash diff --git a/changelog/66347.fixed.md b/changelog/66347.fixed.md deleted file mode 100644 index e61e5ce64a9..00000000000 --- a/changelog/66347.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix win_task ExecutionTimeLimit and result/error code interpretation diff --git a/changelog/66382.fixed.md b/changelog/66382.fixed.md deleted file mode 100644 index 15875838cff..00000000000 --- a/changelog/66382.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed nftables.build_rule breaks ipv6 rules by using the wrong syntax for source and destination addresses diff --git a/changelog/66414.fixed.md b/changelog/66414.fixed.md deleted file mode 100644 index e777d18226d..00000000000 --- a/changelog/66414.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed x509_v2 certificate.managed crash for locally signed certificates if the signing policy defines signing_private_key diff --git a/changelog/66441.fixed.md b/changelog/66441.fixed.md deleted file mode 100644 index e61e5ce64a9..00000000000 --- a/changelog/66441.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix win_task ExecutionTimeLimit and result/error code interpretation diff --git a/changelog/66488.security.md b/changelog/66488.security.md deleted file mode 100644 index 7871bb678db..00000000000 --- a/changelog/66488.security.md +++ /dev/null @@ -1 +0,0 @@ -Bump to ``jinja2==3.1.4`` due to https://github.com/advisories/GHSA-h75v-3vvj-5mfj diff --git a/changelog/66514.fixed.md b/changelog/66514.fixed.md deleted file mode 100644 index 9c579378ac3..00000000000 --- a/changelog/66514.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fixed parallel state execution with Salt-SSH diff --git a/changelog/66579.fixed.md b/changelog/66579.fixed.md deleted file mode 100644 index ccef663b846..00000000000 --- a/changelog/66579.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix support for FIPS approved encryption and signing algorithms. diff --git a/changelog/66588.fixed.md b/changelog/66588.fixed.md deleted file mode 100644 index 6bc72eff59b..00000000000 --- a/changelog/66588.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix relative file_roots paths diff --git a/changelog/66596.fixed.md b/changelog/66596.fixed.md deleted file mode 100644 index a4a27151f2c..00000000000 --- a/changelog/66596.fixed.md +++ /dev/null @@ -1,2 +0,0 @@ -Fixed an issue with cmd.run with requirements when the shell is not the -default diff --git a/changelog/66604.fixed.md b/changelog/66604.fixed.md deleted file mode 100644 index 4d1a771ca54..00000000000 --- a/changelog/66604.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix RPM package provides diff --git a/changelog/66623.deprecated.md b/changelog/66623.deprecated.md deleted file mode 100644 index 8d829eadec9..00000000000 --- a/changelog/66623.deprecated.md +++ /dev/null @@ -1 +0,0 @@ -Drop CentOS 7 support diff --git a/changelog/66624.added.md b/changelog/66624.added.md deleted file mode 100644 index fbc4adf84c7..00000000000 --- a/changelog/66624.added.md +++ /dev/null @@ -1 +0,0 @@ -Build RPM packages with Rocky Linux 9 (instead of CentOS Stream 9) diff --git a/changelog/66624.deprecated.md b/changelog/66624.deprecated.md deleted file mode 100644 index 10b397bae85..00000000000 --- a/changelog/66624.deprecated.md +++ /dev/null @@ -1 +0,0 @@ -No longer build RPM packages with CentOS Stream 9 diff --git a/changelog/66632.fixed.md b/changelog/66632.fixed.md deleted file mode 100644 index c50213867ca..00000000000 --- a/changelog/66632.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Upgrade relAenv to 0.16.1. This release fixes several package installs for salt-pip diff --git a/changelog/66663.fixed.md b/changelog/66663.fixed.md deleted file mode 100644 index 14a40b4730e..00000000000 --- a/changelog/66663.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Upgrade relenv to 0.17.0 (https://github.com/saltstack/relenv/blob/v0.17.0/CHANGELOG.md) diff --git a/changelog/66666.fixed.md b/changelog/66666.fixed.md deleted file mode 100644 index 076088f4d0c..00000000000 --- a/changelog/66666.fixed.md +++ /dev/null @@ -1,4 +0,0 @@ -Upgrade dependencies due to security issues: -- pymysql>=1.1.1 -- requests>=2.32.0 -- docker>=7.1.0 diff --git a/changelog/66683.fixed.md b/changelog/66683.fixed.md deleted file mode 100644 index 2917188fa63..00000000000 --- a/changelog/66683.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044 diff --git a/changelog/66702.security.md b/changelog/66702.security.md deleted file mode 100644 index 4fdd6b4ea3f..00000000000 --- a/changelog/66702.security.md +++ /dev/null @@ -1,2 +0,0 @@ -CVE-2024-37088 salt-call will fail with exit code 1 if bad pillar data is -encountered. diff --git a/changelog/66747.fixed.md b/changelog/66747.fixed.md deleted file mode 100644 index cd47b65a359..00000000000 --- a/changelog/66747.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Remove debug output from shell scripts for packaging diff --git a/doc/man/salt-api.1 b/doc/man/salt-api.1 index 96f6e137793..8291a66022c 100644 --- a/doc/man/salt-api.1 +++ b/doc/man/salt-api.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-API" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-API" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-api \- salt-api Command .sp diff --git a/doc/man/salt-call.1 b/doc/man/salt-call.1 index 2ed60593bb7..35d98500941 100644 --- a/doc/man/salt-call.1 +++ b/doc/man/salt-call.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-CALL" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-CALL" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-call \- salt-call Documentation .SH SYNOPSIS diff --git a/doc/man/salt-cloud.1 b/doc/man/salt-cloud.1 index cc2139878bc..22d9732a3b9 100644 --- a/doc/man/salt-cloud.1 +++ b/doc/man/salt-cloud.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-CLOUD" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-CLOUD" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-cloud \- Salt Cloud Command .sp diff --git a/doc/man/salt-cp.1 b/doc/man/salt-cp.1 index 952c6008c9d..a757a358a90 100644 --- a/doc/man/salt-cp.1 +++ b/doc/man/salt-cp.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-CP" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-CP" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-cp \- salt-cp Documentation .sp diff --git a/doc/man/salt-key.1 b/doc/man/salt-key.1 index f6ac175d835..2f689b155b8 100644 --- a/doc/man/salt-key.1 +++ b/doc/man/salt-key.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-KEY" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-KEY" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-key \- salt-key Documentation .SH SYNOPSIS diff --git a/doc/man/salt-master.1 b/doc/man/salt-master.1 index e7004f2fcaf..437728385da 100644 --- a/doc/man/salt-master.1 +++ b/doc/man/salt-master.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-MASTER" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-MASTER" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-master \- salt-master Documentation .sp diff --git a/doc/man/salt-minion.1 b/doc/man/salt-minion.1 index 1231e4d5551..d0da789a6bf 100644 --- a/doc/man/salt-minion.1 +++ b/doc/man/salt-minion.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-MINION" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-MINION" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-minion \- salt-minion Documentation .sp diff --git a/doc/man/salt-proxy.1 b/doc/man/salt-proxy.1 index 18346acad6f..0a50d38ac92 100644 --- a/doc/man/salt-proxy.1 +++ b/doc/man/salt-proxy.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-PROXY" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-PROXY" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-proxy \- salt-proxy Documentation .sp diff --git a/doc/man/salt-run.1 b/doc/man/salt-run.1 index 5b456b4f1bc..41d5119c283 100644 --- a/doc/man/salt-run.1 +++ b/doc/man/salt-run.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-RUN" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-RUN" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-run \- salt-run Documentation .sp diff --git a/doc/man/salt-ssh.1 b/doc/man/salt-ssh.1 index 186d13f2fea..2d4e889a892 100644 --- a/doc/man/salt-ssh.1 +++ b/doc/man/salt-ssh.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-SSH" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-SSH" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-ssh \- salt-ssh Documentation .SH SYNOPSIS diff --git a/doc/man/salt-syndic.1 b/doc/man/salt-syndic.1 index 8207be769d1..d99ec21b236 100644 --- a/doc/man/salt-syndic.1 +++ b/doc/man/salt-syndic.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT-SYNDIC" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT-SYNDIC" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt-syndic \- salt-syndic Documentation .sp diff --git a/doc/man/salt.1 b/doc/man/salt.1 index 21511c9e035..a50c5f851aa 100644 --- a/doc/man/salt.1 +++ b/doc/man/salt.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt \- salt .SH SYNOPSIS diff --git a/doc/man/salt.7 b/doc/man/salt.7 index 25cf54d9fbb..9860436c121 100644 --- a/doc/man/salt.7 +++ b/doc/man/salt.7 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SALT" "7" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SALT" "7" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME salt \- Salt Documentation .SH SALT PROJECT @@ -1797,6 +1797,17 @@ user: root .fi .UNINDENT .UNINDENT +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +Starting with version \fI3006.0\fP, Salt\(aqs offical packages ship with a default +configuration which runs the Master as a non\-priviledged user. The Master\(aqs +configuration file has the \fIuser\fP option set to \fIuser: salt\fP\&. Unless you +are absolutly sure want to run salt as some other user, care should be +taken to preserve this setting in your Master configuration file.. +.UNINDENT +.UNINDENT .SS \fBenable_ssh_minions\fP .sp Default: \fBFalse\fP @@ -3960,6 +3971,17 @@ publish_session: Default: 86400 .fi .UNINDENT .UNINDENT +.SS \fBpublish_signing_algorithm\fP +.sp +New in version 3006.9. + +.sp +Default: PKCS1v15\-SHA1 +.sp +The RSA signing algorithm used by this minion when connecting to the +master\(aqs request channel. Valid values are \fBPKCS1v15\-SHA1\fP and +\fBPKCS1v15\-SHA224\fP\&. Minions must be at version \fB3006.9\fP or greater if this +is changed from the default setting. .SS \fBssl\fP .sp New in version 2016.11.0. @@ -12634,6 +12656,25 @@ ssl: .fi .UNINDENT .UNINDENT +.SS \fBencryption_algorithm\fP +.sp +New in version 3006.9. + +.sp +Default: OAEP\-SHA1 +.sp +The RSA encryption algorithm used by this minion when connecting to the +master\(aqs request channel. Valid values are \fBOAEP\-SHA1\fP and \fBOAEP\-SHA224\fP +.SS \fBsigning_algorithm\fP +.sp +New in version 3006.9. + +.sp +Default: PKCS1v15\-SHA1 +.sp +The RSA signing algorithm used by this minion when connecting to the +master\(aqs request channel. Valid values are \fBPKCS1v15\-SHA1\fP and +\fBPKCS1v15\-SHA224\fP .SS Reactor Settings .SS \fBreactor\fP .sp @@ -23879,10 +23920,10 @@ most secure setup, only connect syndics directly to master of masters. \fI\%saltproject\-security.pdl@broadcom.com\fP .TP .B gpg key ID -4EA0793D +37654A06 .TP .B gpg key fingerprint -\fB8ABE 4EFC F0F4 B24B FF2A AF90 D570 F2D3 4EA0 793D\fP +\fB99EF 26F2 6469 2D24 973A 7007 E8BF 76A7 3765 4A06\fP .UNINDENT .sp \fBgpg public key:\fP @@ -23893,104 +23934,55 @@ most secure setup, only connect syndics directly to master of masters. .ft C \-\-\-\-\-BEGIN PGP PUBLIC KEY BLOCK\-\-\-\-\- -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 -fwPKmQ2cKnCBs5ASj1DkgUcz2c8DTUPVqg== -=i1Tf +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 +=pPmt \-\-\-\-\-END PGP PUBLIC KEY BLOCK\-\-\-\-\- .ft P .fi @@ -152431,7 +152423,7 @@ salt \(aq*\(aq cmd.retcode \(dqgrep f\(dq stdin=\(aqone\entwo\enthree\enfour\enf .UNINDENT .INDENT 0.0 .TP -.B salt.modules.cmdmod.run(cmd, cwd=None, stdin=None, runas=None, group=None, shell=\(aq/bin/bash\(aq, python_shell=None, env=None, clean_env=False, template=None, rstrip=True, umask=None, output_encoding=None, output_loglevel=\(aqdebug\(aq, log_callback=None, hide_output=False, timeout=None, reset_system_locale=True, ignore_retcode=False, saltenv=None, use_vt=False, bg=False, password=None, encoded_cmd=False, raise_err=False, prepend_path=None, success_retcodes=None, success_stdout=None, success_stderr=None, **kwargs) +.B salt.modules.cmdmod.run(cmd, cwd=None, stdin=None, runas=None, group=None, shell=\(aq/bin/bash\(aq, python_shell=None, env=None, clean_env=False, template=None, rstrip=True, umask=None, output_encoding=None, output_loglevel=\(aqdebug\(aq, log_callback=None, hide_output=False, timeout=None, reset_system_locale=True, ignore_retcode=False, saltenv=None, use_vt=False, redirect_stderr=True, bg=False, password=None, encoded_cmd=False, raise_err=False, prepend_path=None, success_retcodes=None, success_stdout=None, success_stderr=None, **kwargs) Execute the passed command and return the output as a string .INDENT 7.0 .TP @@ -152622,6 +152614,16 @@ New in version 2018.3.0. .IP \(bu 2 \fBuse_vt\fP (\fI\%bool\fP) \-\- Use VT utils (saltstack) to stream the command output more interactively to the console and the logs. This is experimental. +.IP \(bu 2 +\fBredirect_stderr\fP (\fI\%bool\fP) \-\- +.sp +If set to \fBTrue\fP, then stderr will be +redirected to stdout. This is helpful for cases where obtaining both +the retcode and output is desired. Default is \fBTrue\fP +.sp +New in version 3006.9. + + .IP \(bu 2 \fBencoded_cmd\fP (\fI\%bool\fP) \-\- .sp @@ -154251,13 +154253,17 @@ the source string is salt://spam/eggs .sp String of command line args to pass to the script. Only used if no args are specified as part of the \fIname\fP argument. To pass a -string containing spaces in YAML, you will need to doubly\-quote it: +string containing spaces in YAML, you will need to doubly\-quote it. +Additionally, if you need to pass falsey values (e.g., \(dq0\(dq, \(dq\(dq, \(dqFalse\(dq), +you should doubly\-quote them to ensure they are correctly interpreted: .INDENT 2.0 .INDENT 3.5 .sp .nf .ft C salt myminion cmd.script salt://foo.sh \(dqarg1 \(aqarg two\(aq arg3\(dq +salt myminion cmd.script salt://foo.sh \(dq\(aq\(aq0\(aq\(aq\(dq +salt myminion cmd.script salt://foo.sh \(dq\(aq\(aqFalse\(aq\(aq\(dq .ft P .fi .UNINDENT @@ -154479,6 +154485,11 @@ New in version 2019.2.0. .UNINDENT +.TP +.B Returns +The return value of the script execution, including stdout, stderr, +and the exit code. If the script returns a falsey string value, it should be +doubly\-quoted to ensure it is correctly interpreted by Salt. .UNINDENT .sp CLI Example: @@ -194172,7 +194183,7 @@ Passes through all the parameters described in the \fI\%utils.http.query function\fP: .INDENT 7.0 .TP -.B salt.utils.http.query(url, method=\(aqGET\(aq, params=None, data=None, data_file=None, header_dict=None, header_list=None, header_file=None, username=None, password=None, auth=None, decode=False, decode_type=\(aqauto\(aq, status=False, headers=False, text=False, cookies=None, cookie_jar=None, cookie_format=\(aqlwp\(aq, persist_session=False, session_cookie_jar=None, data_render=False, data_renderer=None, header_render=False, header_renderer=None, template_dict=None, test=False, test_url=None, node=\(aqminion\(aq, port=80, opts=None, backend=None, ca_bundle=None, verify_ssl=None, cert=None, text_out=None, headers_out=None, decode_out=None, stream=False, streaming_callback=None, header_callback=None, handle=False, agent=\(aqSalt/3006.8\(aq, hide_fields=None, raise_error=True, formdata=False, formdata_fieldname=None, formdata_filename=None, decode_body=True, **kwargs) +.B salt.utils.http.query(url, method=\(aqGET\(aq, params=None, data=None, data_file=None, header_dict=None, header_list=None, header_file=None, username=None, password=None, auth=None, decode=False, decode_type=\(aqauto\(aq, status=False, headers=False, text=False, cookies=None, cookie_jar=None, cookie_format=\(aqlwp\(aq, persist_session=False, session_cookie_jar=None, data_render=False, data_renderer=None, header_render=False, header_renderer=None, template_dict=None, test=False, test_url=None, node=\(aqminion\(aq, port=80, opts=None, backend=None, ca_bundle=None, verify_ssl=None, cert=None, text_out=None, headers_out=None, decode_out=None, stream=False, streaming_callback=None, header_callback=None, handle=False, agent=\(aqSalt/3006.9\(aq, hide_fields=None, raise_error=True, formdata=False, formdata_fieldname=None, formdata_filename=None, decode_body=True, **kwargs) Query a resource, and decode the return data .UNINDENT .INDENT 7.0 @@ -312367,7 +312378,7 @@ Defaults to \fBvirtualenv\fP\&. .TP .B system_site_packages False -Passthrough argument given to virtualenv or pyvenv +Passthrough argument given to virtualenv or venv .TP .B distribute False @@ -312380,7 +312391,7 @@ Install pip after creating a virtual environment. Implies .TP .B clear False -Passthrough argument given to virtualenv or pyvenv +Passthrough argument given to virtualenv or venv .TP .B python None (default) @@ -312400,11 +312411,11 @@ Passthrough argument given to virtualenv if not None .TP .B symlinks None -Passthrough argument given to pyvenv if True +Passthrough argument given to venv if True .TP .B upgrade None -Passthrough argument given to pyvenv if True +Passthrough argument given to venv if True .TP .B user None @@ -413484,8 +413495,12 @@ New in version 2016.3.5. Set to \fBFalse\fP to discard the cached copy of the source file once the state completes. This can be useful for larger files to keep them from taking up space in minion cache. However, keep in mind that discarding -the source file will result in the state needing to re\-download the -source file if the state is run again. +the source file might result in the state needing to re\-download the +source file if the state is run again. If the source is not a local or +\fBsalt://\fP one, the source hash is known, \fBskip_verify\fP is not true +and the managed file exists with the correct hash and is not templated, +this is not the case (i.e. remote downloads are avoided if the local hash +matches the expected one). .sp New in version 2017.7.3. @@ -425386,6 +425401,26 @@ root: .fi .UNINDENT .UNINDENT +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +The effective permissions of Linux file access control lists (ACLs) are +governed by the \(dqeffective rights mask\(dq (the \fImask\fP line in the output of +the \fIgetfacl\fP command) combined with the \fIperms\fP set by this module: any +permission bits (for example, r=read) present in an ACL but not in the mask +are ignored. The mask is automatically recomputed when setting an ACL, so +normally this isn\(aqt important. However, if the file permissions are +changed (with \fIchmod\fP or \fIfile.managed\fP, for example), the mask will +generally be set based on just the group bits of the file permissions. +.sp +As a result, when using \fIfile.managed\fP or similar to control file +permissions as well as this module, you should set your group permissions +to be at least as broad as any permissions in your ACL. Otherwise, the two +state declarations will each register changes each run, and if the \fIfile\fP +declaration runs later, your ACL will be ineffective. +.UNINDENT +.UNINDENT .INDENT 0.0 .TP .B salt.states.linux_acl.absent(name, acl_type, acl_name=\(aq\(aq, perms=\(aq\(aq, recurse=False) @@ -451534,7 +451569,9 @@ the file will be transferred from the master file server. Prefer wheel archives (requires pip >= 1.4). .TP .B python: None -Python executable used to build the virtualenv +Python executable used to build the virtualenv. When Salt is installed +from a onedir package. You will likely want to specify which python +interperter should be used. .TP .B user: None The user under which to run virtualenv and pip. @@ -451596,6 +451633,12 @@ kwargs, such as the \fBpip\fP option, require \fB\- distribute: True\fP\&. .fi .UNINDENT .UNINDENT +.sp +Current versions of Salt use onedir packages and will use onedir python +interpreter by default. If you\(aqve installed Salt via out package +repository. You will likely want to provide the path to the interpreter +with which you would like to be used to create the virtual environment. The +interpreter can be specified by providing the \fIpython\fP option. .UNINDENT .UNINDENT .UNINDENT @@ -451620,7 +451663,9 @@ the file will be transferred from the master file server. Prefer wheel archives (requires pip >= 1.4). .TP .B python: None -Python executable used to build the virtualenv +Python executable used to build the virtualenv. When Salt is installed +from a onedir package. You will likely want to specify which python +interperter should be used. .TP .B user: None The user under which to run virtualenv and pip. @@ -451682,6 +451727,12 @@ kwargs, such as the \fBpip\fP option, require \fB\- distribute: True\fP\&. .fi .UNINDENT .UNINDENT +.sp +Current versions of Salt use onedir packages and will use onedir python +interpreter by default. If you\(aqve installed Salt via out package +repository. You will likely want to provide the path to the interpreter +with which you would like to be used to create the virtual environment. The +interpreter can be specified by providing the \fIpython\fP option. .UNINDENT .SS salt.states.webutil .sp @@ -476896,6 +476947,11 @@ Thrown when token authentication fails .UNINDENT .INDENT 0.0 .TP +.B exception salt.exceptions.UnsupportedAlgorithm(message=\(aq\(aq) +Thrown when a requested encryption or signing algorithm is un\-supported. +.UNINDENT +.INDENT 0.0 +.TP .B exception salt.exceptions.VMwareApiError(message=\(aq\(aq, info=None) Used when representing a generic VMware API error .UNINDENT @@ -478701,6 +478757,122 @@ Bump to \fBidna==3.7\fP due to \fI\%https://github.com/advisories/GHSA\-jjg7\-2v .IP \(bu 2 Bump to \fBaiohttp==3.9.4\fP due to \fI\%https://github.com/advisories/GHSA\-7gpw\-8wmc\-pm8g\fP \fI\%#66411\fP .UNINDENT +(release\-3006.9)= +.SS Salt 3006.9 release notes +.SS Changelog +.SS Deprecated +.INDENT 0.0 +.IP \(bu 2 +Drop CentOS 7 support \fI\%#66623\fP +.IP \(bu 2 +No longer build RPM packages with CentOS Stream 9 \fI\%#66624\fP +.UNINDENT +.SS Fixed +.INDENT 0.0 +.IP \(bu 2 +Made slsutil.renderer work with salt\-ssh \fI\%#50196\fP +.IP \(bu 2 +Fixed defaults.merge is not available when using salt\-ssh \fI\%#51605\fP +.IP \(bu 2 +Fixed config.get does not support merge option with salt\-ssh \fI\%#56441\fP +.IP \(bu 2 +Update to include croniter in pkg requirements \fI\%#57649\fP +.IP \(bu 2 +Fixed state.test does not work with salt\-ssh \fI\%#61100\fP +.IP \(bu 2 +Made slsutil.findup work with salt\-ssh \fI\%#61143\fP +.IP \(bu 2 +Fixes multiple issues with the cmd module on Windows. Scripts are called using +the \fB\-File\fP parameter to the \fBpowershell.exe\fP binary. \fBCLIXML\fP data in +stderr is now removed (only applies to encoded commands). Commands can now be +sent to \fBcmd.powershell\fP as a list. Makes sure JSON data returned is valid. +Strips whitespace from the return when using \fBrunas\fP\&. \fI\%#61166\fP +.IP \(bu 2 +Fixed the win_lgpo_netsh salt util to handle non\-English systems. This was a +rewrite to use PowerShell instead of netsh to make the changes on the system \fI\%#61534\fP +.IP \(bu 2 +file.replace and file.search work properly with /proc files \fI\%#63102\fP +.IP \(bu 2 +Fix utf8 handling in \(aqpass\(aq renderer \fI\%#64300\fP +.IP \(bu 2 +Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module. \fI\%#64563\fP +.IP \(bu 2 +salt\-cloud honors root_dir config setting for log_file location and fixes for root_dir locations on windows. \fI\%#64728\fP +.IP \(bu 2 +Fixed slsutil.update with salt\-ssh during template rendering \fI\%#65067\fP +.IP \(bu 2 +Fix config.items when called on minion \fI\%#65251\fP +.IP \(bu 2 +Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade \fI\%#65264\fP +.IP \(bu 2 +Fix typo in nftables module to ensure unique nft family values \fI\%#65295\fP +.IP \(bu 2 +pkg.installed state aggregate does not honors requires requisite \fI\%#65304\fP +.IP \(bu 2 +Added SSH wrapper for logmod \fI\%#65630\fP +.IP \(bu 2 +Fix for GitFS failure to unlock lock file, and resource cleanup for process SIGTERM \fI\%#65816\fP +.IP \(bu 2 +Corrected x509_v2 CRL creation \fBlast_update\fP and \fBnext_update\fP values when system timezone is not UTC \fI\%#65837\fP +.IP \(bu 2 +Make sure the root minion process handles SIGUSR1 and emits a traceback like it\(aqs child processes \fI\%#66095\fP +.IP \(bu 2 +Replaced pyvenv with builtin venv for virtualenv_mod \fI\%#66132\fP +.IP \(bu 2 +Made \fBfile.managed\fP skip download of a remote source if the managed file already exists with the correct hash \fI\%#66342\fP +.IP \(bu 2 +Fix win_task ExecutionTimeLimit and result/error code interpretation \fI\%#66347\fP, \fI\%#66441\fP +.IP \(bu 2 +Fixed nftables.build_rule breaks ipv6 rules by using the wrong syntax for source and destination addresses \fI\%#66382\fP +.IP \(bu 2 +Fixed x509_v2 certificate.managed crash for locally signed certificates if the signing policy defines signing_private_key \fI\%#66414\fP +.IP \(bu 2 +Fixed parallel state execution with Salt\-SSH \fI\%#66514\fP +.IP \(bu 2 +Fix support for FIPS approved encryption and signing algorithms. \fI\%#66579\fP +.IP \(bu 2 +Fix relative file_roots paths \fI\%#66588\fP +.IP \(bu 2 +Fixed an issue with cmd.run with requirements when the shell is not the +default \fI\%#66596\fP +.IP \(bu 2 +Fix RPM package provides \fI\%#66604\fP +.IP \(bu 2 +Upgrade relAenv to 0.16.1. This release fixes several package installs for salt\-pip \fI\%#66632\fP +.IP \(bu 2 +Upgrade relenv to 0.17.0 (\fI\%https://github.com/saltstack/relenv/blob/v0.17.0/CHANGELOG.md\fP) \fI\%#66663\fP +.IP \(bu 2 +Upgrade dependencies due to security issues: +.INDENT 2.0 +.IP \(bu 2 +pymysql>=1.1.1 +.IP \(bu 2 +requests>=2.32.0 +.IP \(bu 2 +docker>=7.1.0 \fI\%#66666\fP +.UNINDENT +.IP \(bu 2 +Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044 \fI\%#66683\fP +.IP \(bu 2 +Remove debug output from shell scripts for packaging \fI\%#66747\fP +.UNINDENT +.SS Added +.INDENT 0.0 +.IP \(bu 2 +Add Ubuntu 24.04 support \fI\%#66180\fP +.IP \(bu 2 +Add Fedora 40 support, replacing Fedora 39 \fI\%#66300\fP +.IP \(bu 2 +Build RPM packages with Rocky Linux 9 (instead of CentOS Stream 9) \fI\%#66624\fP +.UNINDENT +.SS Security +.INDENT 0.0 +.IP \(bu 2 +Bump to \fBjinja2==3.1.4\fP due to \fI\%https://github.com/advisories/GHSA\-h75v\-3vvj\-5mfj\fP \fI\%#66488\fP +.IP \(bu 2 +CVE\-2024\-37088 salt\-call will fail with exit code 1 if bad pillar data is +encountered. \fI\%#66702\fP +.UNINDENT .sp See \fI\%Install a release candidate\fP for more information about installing an RC when one is available. diff --git a/doc/man/spm.1 b/doc/man/spm.1 index 38440ca7407..93e18950e98 100644 --- a/doc/man/spm.1 +++ b/doc/man/spm.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "SPM" "1" "Generated on April 29, 2024 at 03:20:12 AM UTC." "3006.8" "Salt" +.TH "SPM" "1" "Generated on July 29, 2024 at 07:43:51 AM UTC." "3006.9" "Salt" .SH NAME spm \- Salt Package Manager Command .sp diff --git a/doc/topics/releases/3006.9.md b/doc/topics/releases/3006.9.md new file mode 100644 index 00000000000..5f5d64051d5 --- /dev/null +++ b/doc/topics/releases/3006.9.md @@ -0,0 +1,87 @@ +(release-3006.9)= +# Salt 3006.9 release notes + + + + + + + +## Changelog + +### Deprecated + +- Drop CentOS 7 support [#66623](https://github.com/saltstack/salt/issues/66623) +- No longer build RPM packages with CentOS Stream 9 [#66624](https://github.com/saltstack/salt/issues/66624) + + +### Fixed + +- Made slsutil.renderer work with salt-ssh [#50196](https://github.com/saltstack/salt/issues/50196) +- Fixed defaults.merge is not available when using salt-ssh [#51605](https://github.com/saltstack/salt/issues/51605) +- Fixed config.get does not support merge option with salt-ssh [#56441](https://github.com/saltstack/salt/issues/56441) +- Update to include croniter in pkg requirements [#57649](https://github.com/saltstack/salt/issues/57649) +- Fixed state.test does not work with salt-ssh [#61100](https://github.com/saltstack/salt/issues/61100) +- Made slsutil.findup work with salt-ssh [#61143](https://github.com/saltstack/salt/issues/61143) +- Fixes multiple issues with the cmd module on Windows. Scripts are called using + the ``-File`` parameter to the ``powershell.exe`` binary. ``CLIXML`` data in + stderr is now removed (only applies to encoded commands). Commands can now be + sent to ``cmd.powershell`` as a list. Makes sure JSON data returned is valid. + Strips whitespace from the return when using ``runas``. [#61166](https://github.com/saltstack/salt/issues/61166) +- Fixed the win_lgpo_netsh salt util to handle non-English systems. This was a + rewrite to use PowerShell instead of netsh to make the changes on the system [#61534](https://github.com/saltstack/salt/issues/61534) +- file.replace and file.search work properly with /proc files [#63102](https://github.com/saltstack/salt/issues/63102) +- Fix utf8 handling in 'pass' renderer [#64300](https://github.com/saltstack/salt/issues/64300) +- Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module. [#64563](https://github.com/saltstack/salt/issues/64563) +- salt-cloud honors root_dir config setting for log_file location and fixes for root_dir locations on windows. [#64728](https://github.com/saltstack/salt/issues/64728) +- Fixed slsutil.update with salt-ssh during template rendering [#65067](https://github.com/saltstack/salt/issues/65067) +- Fix config.items when called on minion [#65251](https://github.com/saltstack/salt/issues/65251) +- Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade [#65264](https://github.com/saltstack/salt/issues/65264) +- Fix typo in nftables module to ensure unique nft family values [#65295](https://github.com/saltstack/salt/issues/65295) +- pkg.installed state aggregate does not honors requires requisite [#65304](https://github.com/saltstack/salt/issues/65304) +- Added SSH wrapper for logmod [#65630](https://github.com/saltstack/salt/issues/65630) +- Fix for GitFS failure to unlock lock file, and resource cleanup for process SIGTERM [#65816](https://github.com/saltstack/salt/issues/65816) +- Corrected x509_v2 CRL creation `last_update` and `next_update` values when system timezone is not UTC [#65837](https://github.com/saltstack/salt/issues/65837) +- Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes [#66095](https://github.com/saltstack/salt/issues/66095) +- Replaced pyvenv with builtin venv for virtualenv_mod [#66132](https://github.com/saltstack/salt/issues/66132) +- Made `file.managed` skip download of a remote source if the managed file already exists with the correct hash [#66342](https://github.com/saltstack/salt/issues/66342) +- Fix win_task ExecutionTimeLimit and result/error code interpretation [#66347](https://github.com/saltstack/salt/issues/66347), [#66441](https://github.com/saltstack/salt/issues/66441) +- Fixed nftables.build_rule breaks ipv6 rules by using the wrong syntax for source and destination addresses [#66382](https://github.com/saltstack/salt/issues/66382) +- Fixed x509_v2 certificate.managed crash for locally signed certificates if the signing policy defines signing_private_key [#66414](https://github.com/saltstack/salt/issues/66414) +- Fixed parallel state execution with Salt-SSH [#66514](https://github.com/saltstack/salt/issues/66514) +- Fix support for FIPS approved encryption and signing algorithms. [#66579](https://github.com/saltstack/salt/issues/66579) +- Fix relative file_roots paths [#66588](https://github.com/saltstack/salt/issues/66588) +- Fixed an issue with cmd.run with requirements when the shell is not the + default [#66596](https://github.com/saltstack/salt/issues/66596) +- Fix RPM package provides [#66604](https://github.com/saltstack/salt/issues/66604) +- Upgrade relAenv to 0.16.1. This release fixes several package installs for salt-pip [#66632](https://github.com/saltstack/salt/issues/66632) +- Upgrade relenv to 0.17.0 (https://github.com/saltstack/relenv/blob/v0.17.0/CHANGELOG.md) [#66663](https://github.com/saltstack/salt/issues/66663) +- Upgrade dependencies due to security issues: + - pymysql>=1.1.1 + - requests>=2.32.0 + - docker>=7.1.0 [#66666](https://github.com/saltstack/salt/issues/66666) +- Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044 [#66683](https://github.com/saltstack/salt/issues/66683) +- Remove debug output from shell scripts for packaging [#66747](https://github.com/saltstack/salt/issues/66747) + + +### Added + +- Add Ubuntu 24.04 support [#66180](https://github.com/saltstack/salt/issues/66180) +- Add Fedora 40 support, replacing Fedora 39 [#66300](https://github.com/saltstack/salt/issues/66300) +- Build RPM packages with Rocky Linux 9 (instead of CentOS Stream 9) [#66624](https://github.com/saltstack/salt/issues/66624) + + +### Security + +- Bump to ``jinja2==3.1.4`` due to https://github.com/advisories/GHSA-h75v-3vvj-5mfj [#66488](https://github.com/saltstack/salt/issues/66488) +- CVE-2024-37088 salt-call will fail with exit code 1 if bad pillar data is + encountered. [#66702](https://github.com/saltstack/salt/issues/66702) diff --git a/doc/topics/releases/templates/3006.9.md.template b/doc/topics/releases/templates/3006.9.md.template new file mode 100644 index 00000000000..6bcb03dd59c --- /dev/null +++ b/doc/topics/releases/templates/3006.9.md.template @@ -0,0 +1,14 @@ +(release-3006.9)= +# Salt 3006.9 release notes{{ unreleased }} +{{ warning }} + + + + +## Changelog +{{ changelog }} diff --git a/pkg/debian/changelog b/pkg/debian/changelog index 0dddaac68ec..6526d3dfb3b 100644 --- a/pkg/debian/changelog +++ b/pkg/debian/changelog @@ -1,3 +1,74 @@ +salt (3006.9) stable; urgency=medium + + + # Deprecated + + * Drop CentOS 7 support [#66623](https://github.com/saltstack/salt/issues/66623) + * No longer build RPM packages with CentOS Stream 9 [#66624](https://github.com/saltstack/salt/issues/66624) + + # Fixed + + * Made slsutil.renderer work with salt-ssh [#50196](https://github.com/saltstack/salt/issues/50196) + * Fixed defaults.merge is not available when using salt-ssh [#51605](https://github.com/saltstack/salt/issues/51605) + * Fixed config.get does not support merge option with salt-ssh [#56441](https://github.com/saltstack/salt/issues/56441) + * Update to include croniter in pkg requirements [#57649](https://github.com/saltstack/salt/issues/57649) + * Fixed state.test does not work with salt-ssh [#61100](https://github.com/saltstack/salt/issues/61100) + * Made slsutil.findup work with salt-ssh [#61143](https://github.com/saltstack/salt/issues/61143) + * Fixes multiple issues with the cmd module on Windows. Scripts are called using + the ``*File`` parameter to the ``powershell.exe`` binary. ``CLIXML`` data in + stderr is now removed (only applies to encoded commands). Commands can now be + sent to ``cmd.powershell`` as a list. Makes sure JSON data returned is valid. + Strips whitespace from the return when using ``runas``. [#61166](https://github.com/saltstack/salt/issues/61166) + * Fixed the win_lgpo_netsh salt util to handle non-English systems. This was a + rewrite to use PowerShell instead of netsh to make the changes on the system [#61534](https://github.com/saltstack/salt/issues/61534) + * file.replace and file.search work properly with /proc files [#63102](https://github.com/saltstack/salt/issues/63102) + * Fix utf8 handling in 'pass' renderer [#64300](https://github.com/saltstack/salt/issues/64300) + * Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module. [#64563](https://github.com/saltstack/salt/issues/64563) + * salt-cloud honors root_dir config setting for log_file location and fixes for root_dir locations on windows. [#64728](https://github.com/saltstack/salt/issues/64728) + * Fixed slsutil.update with salt-ssh during template rendering [#65067](https://github.com/saltstack/salt/issues/65067) + * Fix config.items when called on minion [#65251](https://github.com/saltstack/salt/issues/65251) + * Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade [#65264](https://github.com/saltstack/salt/issues/65264) + * Fix typo in nftables module to ensure unique nft family values [#65295](https://github.com/saltstack/salt/issues/65295) + * pkg.installed state aggregate does not honors requires requisite [#65304](https://github.com/saltstack/salt/issues/65304) + * Added SSH wrapper for logmod [#65630](https://github.com/saltstack/salt/issues/65630) + * Fix for GitFS failure to unlock lock file, and resource cleanup for process SIGTERM [#65816](https://github.com/saltstack/salt/issues/65816) + * Corrected x509_v2 CRL creation `last_update` and `next_update` values when system timezone is not UTC [#65837](https://github.com/saltstack/salt/issues/65837) + * Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes [#66095](https://github.com/saltstack/salt/issues/66095) + * Replaced pyvenv with builtin venv for virtualenv_mod [#66132](https://github.com/saltstack/salt/issues/66132) + * Made `file.managed` skip download of a remote source if the managed file already exists with the correct hash [#66342](https://github.com/saltstack/salt/issues/66342) + * Fix win_task ExecutionTimeLimit and result/error code interpretation [#66347](https://github.com/saltstack/salt/issues/66347), [#66441](https://github.com/saltstack/salt/issues/66441) + * Fixed nftables.build_rule breaks ipv6 rules by using the wrong syntax for source and destination addresses [#66382](https://github.com/saltstack/salt/issues/66382) + * Fixed x509_v2 certificate.managed crash for locally signed certificates if the signing policy defines signing_private_key [#66414](https://github.com/saltstack/salt/issues/66414) + * Fixed parallel state execution with Salt-SSH [#66514](https://github.com/saltstack/salt/issues/66514) + * Fix support for FIPS approved encryption and signing algorithms. [#66579](https://github.com/saltstack/salt/issues/66579) + * Fix relative file_roots paths [#66588](https://github.com/saltstack/salt/issues/66588) + * Fixed an issue with cmd.run with requirements when the shell is not the + default [#66596](https://github.com/saltstack/salt/issues/66596) + * Fix RPM package provides [#66604](https://github.com/saltstack/salt/issues/66604) + * Upgrade relAenv to 0.16.1. This release fixes several package installs for salt-pip [#66632](https://github.com/saltstack/salt/issues/66632) + * Upgrade relenv to 0.17.0 (https://github.com/saltstack/relenv/blob/v0.17.0/CHANGELOG.md) [#66663](https://github.com/saltstack/salt/issues/66663) + * Upgrade dependencies due to security issues: + * pymysql>=1.1.1 + * requests>=2.32.0 + * docker>=7.1.0 [#66666](https://github.com/saltstack/salt/issues/66666) + * Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044 [#66683](https://github.com/saltstack/salt/issues/66683) + * Remove debug output from shell scripts for packaging [#66747](https://github.com/saltstack/salt/issues/66747) + + # Added + + * Add Ubuntu 24.04 support [#66180](https://github.com/saltstack/salt/issues/66180) + * Add Fedora 40 support, replacing Fedora 39 [#66300](https://github.com/saltstack/salt/issues/66300) + * Build RPM packages with Rocky Linux 9 (instead of CentOS Stream 9) [#66624](https://github.com/saltstack/salt/issues/66624) + + # Security + + * Bump to ``jinja2==3.1.4`` due to https://github.com/advisories/GHSA-h75v-3vvj-5mfj [#66488](https://github.com/saltstack/salt/issues/66488) + * CVE-2024-37088 salt-call will fail with exit code 1 if bad pillar data is + encountered. [#66702](https://github.com/saltstack/salt/issues/66702) + + + -- Salt Project Packaging Mon, 29 Jul 2024 07:42:36 +0000 + salt (3006.8) stable; urgency=medium diff --git a/pkg/rpm/salt.spec b/pkg/rpm/salt.spec index 9a08cd93051..180df99f34b 100644 --- a/pkg/rpm/salt.spec +++ b/pkg/rpm/salt.spec @@ -40,7 +40,7 @@ %define fish_dir %{_datadir}/fish/vendor_functions.d Name: salt -Version: 3006.8 +Version: 3006.9 Release: 0 Summary: A parallel remote execution system Group: System Environment/Daemons @@ -695,6 +695,74 @@ if [ $1 -ge 1 ] ; then fi %changelog +* Mon Jul 29 2024 Salt Project Packaging - 3006.9 + +# Deprecated + +- Drop CentOS 7 support [#66623](https://github.com/saltstack/salt/issues/66623) +- No longer build RPM packages with CentOS Stream 9 [#66624](https://github.com/saltstack/salt/issues/66624) + +# Fixed + +- Made slsutil.renderer work with salt-ssh [#50196](https://github.com/saltstack/salt/issues/50196) +- Fixed defaults.merge is not available when using salt-ssh [#51605](https://github.com/saltstack/salt/issues/51605) +- Fixed config.get does not support merge option with salt-ssh [#56441](https://github.com/saltstack/salt/issues/56441) +- Update to include croniter in pkg requirements [#57649](https://github.com/saltstack/salt/issues/57649) +- Fixed state.test does not work with salt-ssh [#61100](https://github.com/saltstack/salt/issues/61100) +- Made slsutil.findup work with salt-ssh [#61143](https://github.com/saltstack/salt/issues/61143) +- Fixes multiple issues with the cmd module on Windows. Scripts are called using + the ``-File`` parameter to the ``powershell.exe`` binary. ``CLIXML`` data in + stderr is now removed (only applies to encoded commands). Commands can now be + sent to ``cmd.powershell`` as a list. Makes sure JSON data returned is valid. + Strips whitespace from the return when using ``runas``. [#61166](https://github.com/saltstack/salt/issues/61166) +- Fixed the win_lgpo_netsh salt util to handle non-English systems. This was a + rewrite to use PowerShell instead of netsh to make the changes on the system [#61534](https://github.com/saltstack/salt/issues/61534) +- file.replace and file.search work properly with /proc files [#63102](https://github.com/saltstack/salt/issues/63102) +- Fix utf8 handling in 'pass' renderer [#64300](https://github.com/saltstack/salt/issues/64300) +- Fixed incorrect version argument will be ignored for multiple package targets warning when using pkgs argument to yumpkg module. [#64563](https://github.com/saltstack/salt/issues/64563) +- salt-cloud honors root_dir config setting for log_file location and fixes for root_dir locations on windows. [#64728](https://github.com/saltstack/salt/issues/64728) +- Fixed slsutil.update with salt-ssh during template rendering [#65067](https://github.com/saltstack/salt/issues/65067) +- Fix config.items when called on minion [#65251](https://github.com/saltstack/salt/issues/65251) +- Ensure on rpm and deb systems, that user and group for existing Salt, is maintained on upgrade [#65264](https://github.com/saltstack/salt/issues/65264) +- Fix typo in nftables module to ensure unique nft family values [#65295](https://github.com/saltstack/salt/issues/65295) +- pkg.installed state aggregate does not honors requires requisite [#65304](https://github.com/saltstack/salt/issues/65304) +- Added SSH wrapper for logmod [#65630](https://github.com/saltstack/salt/issues/65630) +- Fix for GitFS failure to unlock lock file, and resource cleanup for process SIGTERM [#65816](https://github.com/saltstack/salt/issues/65816) +- Corrected x509_v2 CRL creation `last_update` and `next_update` values when system timezone is not UTC [#65837](https://github.com/saltstack/salt/issues/65837) +- Make sure the root minion process handles SIGUSR1 and emits a traceback like it's child processes [#66095](https://github.com/saltstack/salt/issues/66095) +- Replaced pyvenv with builtin venv for virtualenv_mod [#66132](https://github.com/saltstack/salt/issues/66132) +- Made `file.managed` skip download of a remote source if the managed file already exists with the correct hash [#66342](https://github.com/saltstack/salt/issues/66342) +- Fix win_task ExecutionTimeLimit and result/error code interpretation [#66347](https://github.com/saltstack/salt/issues/66347), [#66441](https://github.com/saltstack/salt/issues/66441) +- Fixed nftables.build_rule breaks ipv6 rules by using the wrong syntax for source and destination addresses [#66382](https://github.com/saltstack/salt/issues/66382) +- Fixed x509_v2 certificate.managed crash for locally signed certificates if the signing policy defines signing_private_key [#66414](https://github.com/saltstack/salt/issues/66414) +- Fixed parallel state execution with Salt-SSH [#66514](https://github.com/saltstack/salt/issues/66514) +- Fix support for FIPS approved encryption and signing algorithms. [#66579](https://github.com/saltstack/salt/issues/66579) +- Fix relative file_roots paths [#66588](https://github.com/saltstack/salt/issues/66588) +- Fixed an issue with cmd.run with requirements when the shell is not the + default [#66596](https://github.com/saltstack/salt/issues/66596) +- Fix RPM package provides [#66604](https://github.com/saltstack/salt/issues/66604) +- Upgrade relAenv to 0.16.1. This release fixes several package installs for salt-pip [#66632](https://github.com/saltstack/salt/issues/66632) +- Upgrade relenv to 0.17.0 (https://github.com/saltstack/relenv/blob/v0.17.0/CHANGELOG.md) [#66663](https://github.com/saltstack/salt/issues/66663) +- Upgrade dependencies due to security issues: + - pymysql>=1.1.1 + - requests>=2.32.0 + - docker>=7.1.0 [#66666](https://github.com/saltstack/salt/issues/66666) +- Corrected missed line in branch 3006.x when backporting from PR 61620 and 65044 [#66683](https://github.com/saltstack/salt/issues/66683) +- Remove debug output from shell scripts for packaging [#66747](https://github.com/saltstack/salt/issues/66747) + +# Added + +- Add Ubuntu 24.04 support [#66180](https://github.com/saltstack/salt/issues/66180) +- Add Fedora 40 support, replacing Fedora 39 [#66300](https://github.com/saltstack/salt/issues/66300) +- Build RPM packages with Rocky Linux 9 (instead of CentOS Stream 9) [#66624](https://github.com/saltstack/salt/issues/66624) + +# Security + +- Bump to ``jinja2==3.1.4`` due to https://github.com/advisories/GHSA-h75v-3vvj-5mfj [#66488](https://github.com/saltstack/salt/issues/66488) +- CVE-2024-37088 salt-call will fail with exit code 1 if bad pillar data is + encountered. [#66702](https://github.com/saltstack/salt/issues/66702) + + * Mon Apr 29 2024 Salt Project Packaging - 3006.8 # Removed From 002ab9103ceb292b618221d03730fbdaae5ec213 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 7 Aug 2024 16:07:42 -0700 Subject: [PATCH 109/157] Method name is _decode_payload not _decode_messages --- salt/channel/client.py | 2 +- tests/pytests/unit/channel/test_client.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/pytests/unit/channel/test_client.py diff --git a/salt/channel/client.py b/salt/channel/client.py index c60a41c063a..12b3a08520d 100644 --- a/salt/channel/client.py +++ b/salt/channel/client.py @@ -360,7 +360,7 @@ class AsyncPubChannel: async_methods = [ "connect", - "_decode_messages", + "_decode_payload", ] close_methods = [ "close", diff --git a/tests/pytests/unit/channel/test_client.py b/tests/pytests/unit/channel/test_client.py new file mode 100644 index 00000000000..783657c4a45 --- /dev/null +++ b/tests/pytests/unit/channel/test_client.py @@ -0,0 +1,19 @@ +import salt.channel.client + + +def test_async_methods(): + "Validate all defined async_methods and close_methods are present" + async_classes = [ + salt.channel.client.AsyncReqChannel, + salt.channel.client.AsyncPubChannel, + ] + method_attrs = [ + "async_methods", + "close_methods", + ] + for cls in async_classes: + for attr in method_attrs: + assert hasattr(cls, attr) + assert isinstance(getattr(cls, attr), list) + for name in getattr(cls, attr): + assert hasattr(cls, name) From 05528e22e58e8acddd307485cab02d94284260d5 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 7 Aug 2024 16:09:42 -0700 Subject: [PATCH 110/157] Add changelog for #66789 --- changelog/66789.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/66789.fixed.md diff --git a/changelog/66789.fixed.md b/changelog/66789.fixed.md new file mode 100644 index 00000000000..f6d18c6247d --- /dev/null +++ b/changelog/66789.fixed.md @@ -0,0 +1 @@ +Fix bad async_method name on AsyncPubClient class From 53ddf5a32ed8a9735b9dad64c2b25f1ed654d202 Mon Sep 17 00:00:00 2001 From: Tyler Levy Conde Date: Wed, 31 Jul 2024 14:25:54 -0600 Subject: [PATCH 111/157] The profile outputter does not crash with incorrectly formatted data --- changelog/65104.fixed.md | 1 + salt/output/profile.py | 13 +++- tests/pytests/unit/output/test_profile.py | 94 +++++++++++++++++++++++ 3 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 changelog/65104.fixed.md create mode 100644 tests/pytests/unit/output/test_profile.py diff --git a/changelog/65104.fixed.md b/changelog/65104.fixed.md new file mode 100644 index 00000000000..020b990b630 --- /dev/null +++ b/changelog/65104.fixed.md @@ -0,0 +1 @@ +The 'profile' outputter does not crash with incorrectly formatted data diff --git a/salt/output/profile.py b/salt/output/profile.py index 8f54c7017f4..87a93c17bba 100644 --- a/salt/output/profile.py +++ b/salt/output/profile.py @@ -44,12 +44,19 @@ def _find_durations(data, name_max=60): ml = len("duration (ms)") for host in data: for sid in data[host]: - dat = data[host][sid] - ts = sid.split("_|-") + try: + dat = data[host][sid] + except TypeError: + dat = {} + + if not isinstance(dat, dict): + dat = {"name": str(sid)} + + ts = str(sid).split("_|-") mod = ts[0] fun = ts[-1] name = dat.get("name", dat.get("__id__")) - dur = float(data[host][sid].get("duration", -1)) + dur = float(dat.get("duration", -1)) if name is None: name = "<>" diff --git a/tests/pytests/unit/output/test_profile.py b/tests/pytests/unit/output/test_profile.py new file mode 100644 index 00000000000..8a6234c1821 --- /dev/null +++ b/tests/pytests/unit/output/test_profile.py @@ -0,0 +1,94 @@ +import pytest + +import salt.output.profile as profile + + +@pytest.fixture +def configure_loader_modules(): + return {profile: {"__opts__": {"extension_modules": "", "color": False}}} + + +def test_no_states_found(): + """ + Simulate the result of the "profile" outputter with state.apply. + i.e. salt-call --local state.apply --output=profile + """ + data = { + "local": { + "no_|-states_|-states_|-None": { + "result": False, + "comment": "No Top file or master_tops data matches found. Please see master log for details.", + "name": "No States", + "changes": {}, + "__run_num__": 0, + } + } + } + + expected_output = ( + " ---------------------------------------\n" + " | name | mod.fun | duration (ms) |\n" + " ---------------------------------------\n" + " | No States | no.None | -1.0000 |\n" + " ---------------------------------------" + ) + + ret = profile.output(data) + assert expected_output in ret + + +def test_no_matching_sls(): + """ + Simulate the result of the "profile" outputter with state.sls. + i.e. salt-call --local state.sls foo --output=profile + """ + data = {"local": ["No matching sls found for 'foo' in env 'base'"]} + + expected_output = ( + " ---------------------------------------------------------------------------\n" + " | name | mod.fun | duration (ms) |\n" + " ---------------------------------------------------------------------------\n" + " | <> | No matching sls found for 'foo' in env 'base'.No | -1.0000 |\n" + " ---------------------------------------------------------------------------" + ) + + ret = profile.output(data) + assert expected_output in ret + + +def test_output_with_grains_data(): + """ + Simulate the result of the "profile" outputter with grains data. + i.e. salt-call --local grains.items --output=profile + """ + grains_data = { + "local": { + "dns": {"nameservers": ["0.0.0.0", "1.1.1.1"], "search": ["dns.com"]}, + "fqdns": [], + "disks": ["sda"], + "ssds": ["nvme0n1"], + "shell": "/bin/bash", + "efi-secure-boot": False, + } + } + + ret = profile.output(grains_data) + expected_ret = ( + " ---------------------------------------------------------------------\n" + " | name | mod.fun | duration (ms) |\n" + " ---------------------------------------------------------------------\n" + " | <> | dns.dns | -1.0000 |\n" + " ---------------------------------------------------------------------\n" + " | disks | disks.disks | -1.0000 |\n" + " ---------------------------------------------------------------------\n" + " | efi-secure-boot | efi-secure-boot.efi-secure-boot | -1.0000 |\n" + " ---------------------------------------------------------------------\n" + " | fqdns | fqdns.fqdns | -1.0000 |\n" + " ---------------------------------------------------------------------\n" + " | shell | shell.shell | -1.0000 |\n" + " ---------------------------------------------------------------------\n" + " | ssds | ssds.ssds | -1.0000 |\n" + " ---------------------------------------------------------------------" + ) + + assert ret == expected_ret From c222b6e9783778fb11493f2278392b7f4815137e Mon Sep 17 00:00:00 2001 From: ScriptAutomate Date: Tue, 30 Jul 2024 14:49:42 -0500 Subject: [PATCH 112/157] Remove epub generation for docs --- .github/workflows/build-docs.yml | 1 - .github/workflows/staging.yml | 6 --- .github/workflows/templates/staging.yml.jinja | 6 --- doc/Makefile | 8 +--- doc/_themes/saltstack2/layout.html | 2 - .../saltstack2/static/images/epub_icon.svg | 25 ----------- doc/conf.py | 13 ------ tools/docs.py | 45 ------------------- 8 files changed, 1 insertion(+), 105 deletions(-) delete mode 100644 doc/_themes/saltstack2/static/images/epub_icon.svg diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index adeeb2fff67..a4544923cc2 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -32,7 +32,6 @@ jobs: - linkcheck - spellcheck - html - - epub # - pdf steps: diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 1313812f8ed..616582c55ec 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -2847,12 +2847,6 @@ jobs: name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs-html.tar.xz path: artifacts/release - - name: Download Release Documentation (ePub) - uses: actions/download-artifact@v4 - with: - name: Salt-${{ needs.prepare-workflow.outputs.salt-version }}.epub - path: artifacts/release - - name: Show Release Artifacts run: | tree -a artifacts/release diff --git a/.github/workflows/templates/staging.yml.jinja b/.github/workflows/templates/staging.yml.jinja index ae096e51e35..a15302bc00a 100644 --- a/.github/workflows/templates/staging.yml.jinja +++ b/.github/workflows/templates/staging.yml.jinja @@ -124,12 +124,6 @@ concurrency: name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-docs-html.tar.xz path: artifacts/release - - name: Download Release Documentation (ePub) - uses: actions/download-artifact@v4 - with: - name: Salt-${{ needs.prepare-workflow.outputs.salt-version }}.epub - path: artifacts/release - - name: Show Release Artifacts run: | tree -a artifacts/release diff --git a/doc/Makefile b/doc/Makefile index 9b1b1939a9b..60d95e24e81 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,7 +16,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean check_sphinx-build html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest +.PHONY: help clean check_sphinx-build html dirhtml singlehtml pickle json htmlhelp qthelp devhelp latex latexpdf text man changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @@ -28,7 +28,6 @@ help: @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " pdf to make Salt-all.pdf and splitted pdf using xelatex" @echo " cheatsheet to create salt-cheatsheet.pdf" @@ -101,11 +100,6 @@ devhelp: check_sphinx-build @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Salt" @echo "# devhelp" -epub: check_sphinx-build - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - latex: check_sphinx-build $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo diff --git a/doc/_themes/saltstack2/layout.html b/doc/_themes/saltstack2/layout.html index 32fff3e6095..f98ae192d7c 100644 --- a/doc/_themes/saltstack2/layout.html +++ b/doc/_themes/saltstack2/layout.html @@ -193,10 +193,8 @@ {% if not (build_type == repo_primary_branch or build_type == "next") and on_saltstack %}
  • -
  • {% elif build_type == repo_primary_branch and on_saltstack %}
  • -
  • {% endif %} diff --git a/doc/_themes/saltstack2/static/images/epub_icon.svg b/doc/_themes/saltstack2/static/images/epub_icon.svg deleted file mode 100644 index e50861b8d3c..00000000000 --- a/doc/_themes/saltstack2/static/images/epub_icon.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - diff --git a/doc/conf.py b/doc/conf.py index 2b60d5b0a4e..33503d70e25 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -383,19 +383,6 @@ man_pages = [ ] -### epub options -epub_title = "Salt Documentation" -epub_author = "VMware, Inc." -epub_publisher = epub_author -epub_copyright = copyright - -epub_scheme = "URL" -epub_identifier = "http://saltproject.io/" - -epub_tocdup = False -# epub_tocdepth = 3 - - def skip_mod_init_member(app, what, name, obj, skip, options): # pylint: disable=too-many-arguments,unused-argument if name.startswith("_"): diff --git a/tools/docs.py b/tools/docs.py index 6e5ad281c12..c0d19afdd6f 100644 --- a/tools/docs.py +++ b/tools/docs.py @@ -133,51 +133,6 @@ def html( ) -@docs.command( - name="epub", - arguments={ - "no_clean": { - "help": "Don't cleanup prior to building", - }, - "no_color": { - "help": "Disable colored output.", - }, - }, -) -def epub(ctx: Context, no_clean: bool = False, no_color: bool = False): - if no_clean is False: - ctx.run("make", "clean", cwd="doc/", check=True) - opts = [ - "-j", - "auto", - "--keep-going", - ] - if no_color is False: - opts.append("--color") - ctx.run( - "make", - "epub", - f"SPHINXOPTS={' '.join(opts)}", - cwd="doc/", - check=True, - ) - - artifact = tools.utils.REPO_ROOT / "doc" / "_build" / "epub" / "Salt.epub" - if "LATEST_RELEASE" in os.environ: - shutil.move( - artifact, artifact.parent / f"Salt-{os.environ['LATEST_RELEASE']}.epub" - ) - artifact = artifact.parent / f"Salt-{os.environ['LATEST_RELEASE']}.epub" - github_output = os.environ.get("GITHUB_OUTPUT") - if github_output is not None: - with open(github_output, "a", encoding="utf-8") as wfh: - wfh.write( - "has-artifacts=true\n" - f"artifact-name={artifact.resolve().name}\n" - f"artifact-path={artifact.resolve()}\n" - ) - - @docs.command( name="pdf", arguments={ From 6774e08aa46dc2d368876e37a063a4b785ede67b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 30 Jul 2024 10:36:57 -0600 Subject: [PATCH 113/157] Remove psutil_compat.py file, which should have been removed when RHEL 6 EOL --- salt/utils/psutil_compat.py | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 salt/utils/psutil_compat.py diff --git a/salt/utils/psutil_compat.py b/salt/utils/psutil_compat.py deleted file mode 100644 index a2ac44e2ae9..00000000000 --- a/salt/utils/psutil_compat.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Version agnostic psutil hack to fully support both old (<2.0) and new (>=2.0) -psutil versions. - -The old <1.0 psutil API is dropped in psutil 3.0 - -Should be removed once support for psutil <2.0 is dropped. (eg RHEL 6) - -Built off of http://grodola.blogspot.com/2014/01/psutil-20-porting.html -""" - -from psutil import * # pylint: disable=wildcard-import,unused-wildcard-import,3rd-party-module-not-gated - -import salt.utils.versions - -salt.utils.versions.warn_until( - 3008, - "Please stop importing 'salt.utils.psutil_compat' and instead import " - "'psutil' directly as there's no longer a need for a compatability " - "layer. The 'salt.utils.psutil_compat' will go away on Salt {version}.", -) From 101042d4e065f7d1ea5f0a031d822bcac9822154 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 30 Jul 2024 10:47:39 -0600 Subject: [PATCH 114/157] Remove psutil_compat.py file, which should have been removed when RHEL 6 EOL --- changelog/66467.removed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/66467.removed.md diff --git a/changelog/66467.removed.md b/changelog/66467.removed.md new file mode 100644 index 00000000000..aca1198858e --- /dev/null +++ b/changelog/66467.removed.md @@ -0,0 +1 @@ +Remove psutil_compat.py file, which should have been removed when RHEL 6 EOL From 8c33bd50ece2074dbd5a5fdb17e7165ec842607b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 30 Jul 2024 14:53:38 -0600 Subject: [PATCH 115/157] Corrected typo in 'Sudium' to 'Sodium' and pre-commit updated rest of file --- tests/pytests/unit/utils/test_versions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/pytests/unit/utils/test_versions.py b/tests/pytests/unit/utils/test_versions.py index a1197778296..794bfb10d1e 100644 --- a/tests/pytests/unit/utils/test_versions.py +++ b/tests/pytests/unit/utils/test_versions.py @@ -126,7 +126,7 @@ def test_warn_until_bad_version_name_raises_runtime_error(): # Ensure proper behavior with warnings.catch_warnings(record=True) as recorded_warnings: salt.utils.versions.warn_until( - "Sodium", "Deprecation Message!", _version_info_=(3000, 0) + 3001, "Deprecation Message!", _version_info_=(3000, 0) ) assert "Deprecation Message!" == str(recorded_warnings[0].message) @@ -134,7 +134,7 @@ def test_warn_until_bad_version_name_raises_runtime_error(): RuntimeError, match="Incorrect spelling for the release name in .*" ): salt.utils.versions.warn_until( - "Sudium", "Deprecation Message!", _version_info_=(3000, 0) + 3001, "Deprecation Message!", _version_info_=(3000, 0) ) @@ -154,7 +154,7 @@ def test_warn_until_warning_raised(subtests): def raise_named_version_warning(_version_info_=(0, 16, 0)): salt.utils.versions.warn_until( - "hydrogen", "Deprecation Message!", _version_info_=_version_info_ + 2014, "Deprecation Message!", _version_info_=_version_info_ ) with subtests.test( @@ -233,7 +233,7 @@ def test_warn_until_warning_raised(subtests): ), ): salt.utils.versions.warn_until( - "Hydrogen", + 2014, "Foo", _dont_call_warnings=True, _version_info_=(sys.maxsize, 16, 0), @@ -243,7 +243,7 @@ def test_warn_until_warning_raised(subtests): with warnings.catch_warnings(record=True) as recorded_warnings: vrs = salt.version.SaltStackVersion.from_name("Helium") salt.utils.versions.warn_until( - "Helium", + 2014, "Deprecation Message until {version}!", _version_info_=(vrs.major - 1, 0), ) From 3cea3efaf160206a50cf2be6b54604d9aedf5317 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 1 Aug 2024 11:05:40 -0600 Subject: [PATCH 116/157] Doubled timeout to 120 for downgrade test --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index a3206485f1d..6d0a8c75854 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -76,7 +76,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): # Downgrade Salt to the previous version and test install_salt.install(downgrade=True) - time.sleep(60) # give it some time + time.sleep(120) # give it some time # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade From 6f0e014664c1cce0bfddcd546c53d006a4c45978 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 1 Aug 2024 14:50:40 -0600 Subject: [PATCH 117/157] Debug outputs for downgrade --- .../pkg/downgrade/test_salt_downgrade.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 6d0a8c75854..33250343703 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -19,6 +19,10 @@ def _get_running_named_salt_pid(process_name): pids = [] for proc in psutil.process_iter(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) + print( + f"DGM _get_running_named_salt_pid, process_name '{process_name}', cmdl_strg '{cmdl_strg}'", + flush=True, + ) if process_name in cmdl_strg: pids.append(proc.pid) @@ -29,6 +33,11 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): """ Test an downgrade of Salt Minion. """ + print( + f"DGM test_salt_downgrade_minion entry, install_salt '{install_salt}'", + flush=True, + ) + is_restart_fixed = packaging.version.parse( install_salt.prev_version ) < packaging.version.parse("3006.9") @@ -70,16 +79,24 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): else: process_name = "salt-minion" + print( + f"DGM test_salt_downgrade_minion, getting old pids for process_name '{process_name}'", + flush=True, + ) old_minion_pids = _get_running_named_salt_pid(process_name) assert old_minion_pids # Downgrade Salt to the previous version and test install_salt.install(downgrade=True) - time.sleep(120) # give it some time + time.sleep(60) # give it some time # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade + print( + f"DGM test_salt_downgrade_minion, getting new pids for process_name '{process_name}'", + flush=True, + ) new_minion_pids = _get_running_named_salt_pid(process_name) assert new_minion_pids assert new_minion_pids != old_minion_pids From 715e1501f2d8e6ebba5c86f4a95ceb24de0844d1 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 2 Aug 2024 11:45:29 -0600 Subject: [PATCH 118/157] Added debugging information to pkg support --- tests/support/pkg.py | 48 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 20c851dcedd..e5005e86931 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -221,6 +221,10 @@ class SaltPkgInstall: parsed = packaging.version.parse(version) version = f"{parsed.major}.{parsed.minor}" if self.distro_id in ("ubuntu", "debian"): + print( + f"DGM install_salt, _default_version, about to stop services, but do not for distro '{self.distro_id}' , ", + flush=True, + ) self.stop_services() return version @@ -429,6 +433,10 @@ class SaltPkgInstall: If not raise AssertionError """ if ret.returncode != 0: + print( + f"DGM install_salt _check_retcode bad returncode, ret '{ret}'", + flush=True, + ) log.error(ret) assert ret.returncode == 0 return True @@ -581,7 +589,11 @@ class SaltPkgInstall: def install(self, upgrade=False, downgrade=False): self._install_pkgs(upgrade=upgrade, downgrade=downgrade) if self.distro_id in ("ubuntu", "debian"): - self.stop_services() + print( + f"DGM install_salt install ubuntu or debian, stop services distro id '{self.distro_id}' but don't ", + flush=True, + ) + ## DGM self.stop_services() def stop_services(self): """ @@ -590,15 +602,24 @@ class SaltPkgInstall: settings we have set. This will also verify the expected services are up and running. """ + print("DGM install_salt stop_services, entry", flush=True) retval = True for service in ["salt-syndic", "salt-master", "salt-minion"]: check_run = self.proc.run("systemctl", "status", service) if check_run.returncode != 0: # The system was not started automatically and we # are expecting it to be on install + print( + f"DGM install_salt stop_services systemctl status, The service '{service}' was not started on install.", + flush=True, + ) log.debug("The service %s was not started on install.", service) retval = False else: + print( + f"DGM install_salt stop_services systemctl stop, service '{service}'", + flush=True, + ) stop_service = self.proc.run("systemctl", "stop", service) self._check_retcode(stop_service) return retval @@ -707,6 +728,13 @@ class SaltPkgInstall: if relenv: gpg_key = "SALT-PROJECT-GPG-PUBKEY-2023.gpg" + dgm_file1 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}" + dgm_file2 = f"/etc/apt/keyrings/{gpg_dest}" + print( + f"DGM install_salt install_previous download files , src '{dgm_file1}' and dest '{dgm_file2}'", + flush=True, + ) + download_file( f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}", f"/etc/apt/keyrings/{gpg_dest}", @@ -714,6 +742,12 @@ class SaltPkgInstall: with salt.utils.files.fopen( pathlib.Path("/etc", "apt", "sources.list.d", "salt.list"), "w" ) as fp: + dgm_file3 = f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " + dgm_file4 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" + print( + f"DGM install_salt install_previous , write /etc/apt/sources.list.d/salt.list, '{dgm_file3}' and '{dgm_file4}'", + flush=True, + ) fp.write( f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" @@ -727,6 +761,9 @@ class SaltPkgInstall: "-y", ] + print( + f"DGM install_salt install_previous , install cmd '{cmd}'", flush=True + ) if downgrade: pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt.pref") pref_file.parent.mkdir(exist_ok=True) @@ -753,6 +790,10 @@ class SaltPkgInstall: cmd.extend(extra_args) + print( + f"DGM install_salt install_previous about to proc run cmd '{cmd}', env '{env}'", + flush=True, + ) ret = self.proc.run(*cmd, env=env) # Pre-relenv packages down get downgraded to cleanly programmatically # They work manually, and the install tests after downgrades will catch problems with the install @@ -765,7 +806,10 @@ class SaltPkgInstall: self._check_retcode(ret) if downgrade: pref_file.unlink() - self.stop_services() + print( + "DGM install_previous , about to stop services, but do not", flush=True + ) + ## DGM self.stop_services() elif platform.is_windows(): self.bin_dir = self.install_dir / "bin" self.run_root = self.bin_dir / "salt.exe" From dab09a47b80fcca8e3264af288a28d662a36e0b2 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 2 Aug 2024 15:35:28 -0600 Subject: [PATCH 119/157] Adjusted debugging --- tests/support/pkg.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index e5005e86931..037b8d69984 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -220,9 +220,10 @@ class SaltPkgInstall: version = self.prev_version parsed = packaging.version.parse(version) version = f"{parsed.major}.{parsed.minor}" + ## DGM why is this called out specically ??? if self.distro_id in ("ubuntu", "debian"): print( - f"DGM install_salt, _default_version, about to stop services, but do not for distro '{self.distro_id}' , ", + f"DGM install_salt, _default_version, about to stop services, for distro '{self.distro_id}'", flush=True, ) self.stop_services() @@ -590,7 +591,7 @@ class SaltPkgInstall: self._install_pkgs(upgrade=upgrade, downgrade=downgrade) if self.distro_id in ("ubuntu", "debian"): print( - f"DGM install_salt install ubuntu or debian, stop services distro id '{self.distro_id}' but don't ", + f"DGM install_salt install, ubuntu or debian, stop services distro id '{self.distro_id}' but don't ", flush=True, ) ## DGM self.stop_services() @@ -601,6 +602,8 @@ class SaltPkgInstall: We want to ensure our tests start with the config settings we have set. This will also verify the expected services are up and running. + + ## DGM Why this comment, surely when Debian/Ubuntu restart automatically, they pick up the configuration already defined - unless there is some env override on configuration file to pick up. """ print("DGM install_salt stop_services, entry", flush=True) retval = True @@ -610,17 +613,17 @@ class SaltPkgInstall: # The system was not started automatically and we # are expecting it to be on install print( - f"DGM install_salt stop_services systemctl status, The service '{service}' was not started on install.", + f"DGM install_salt stop_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", flush=True, ) log.debug("The service %s was not started on install.", service) retval = False else: + stop_service = self.proc.run("systemctl", "stop", service) print( - f"DGM install_salt stop_services systemctl stop, service '{service}'", + f"DGM install_salt stop_services systemctl stop, service '{service}', ret '{stop_service}'", flush=True, ) - stop_service = self.proc.run("systemctl", "stop", service) self._check_retcode(stop_service) return retval @@ -762,7 +765,7 @@ class SaltPkgInstall: ] print( - f"DGM install_salt install_previous , install cmd '{cmd}'", flush=True + f"DGM install_salt install_previous, install cmd '{cmd}'", flush=True ) if downgrade: pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt.pref") @@ -791,7 +794,7 @@ class SaltPkgInstall: cmd.extend(extra_args) print( - f"DGM install_salt install_previous about to proc run cmd '{cmd}', env '{env}'", + f"DGM install_salt install_previous, about to proc run cmd '{cmd}', env '{env}'", flush=True, ) ret = self.proc.run(*cmd, env=env) @@ -807,7 +810,8 @@ class SaltPkgInstall: if downgrade: pref_file.unlink() print( - "DGM install_previous , about to stop services, but do not", flush=True + "DGM install, install_previous , about to stop services, but do not", + flush=True, ) ## DGM self.stop_services() elif platform.is_windows(): From c7fa80ccccb481f2bd4132f849e282d6b75fbffa Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 10:03:32 -0600 Subject: [PATCH 120/157] Added more debugging --- .../pkg/downgrade/test_salt_downgrade.py | 29 +++++++++++++- tests/support/pkg.py | 40 +++++++++++++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 33250343703..1aeae6bf2ae 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -56,7 +56,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): original_py_version = install_salt.package_python_version() # Verify current install version is setup correctly and works - ret = salt_call_cli.run("test.version") + ret = salt_call_cli.run("--local", "test.version") assert ret.returncode == 0 assert packaging.version.parse(ret.data) == packaging.version.parse( install_salt.artifact_version @@ -89,6 +89,33 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): # Downgrade Salt to the previous version and test install_salt.install(downgrade=True) + ## DGM test code + time.sleep(10) # give it some time + # a downgrade install will stop services on Debian/Ubuntu (why they didn't worry about Redhat family) + # This is probably due to RedHat systems are not active after an install, but Debian/Ubuntu are active after an install + # this leads to issues depending on what the sequence of tests are run , leaving the systems systemd active or not + + # Q. why are RedHat systems passing these tests, perhaps there is a case being missed where the RedHat systems are active + # since they were not explicitly stopped, but the Debian/Ubuntu are, but in testing Ubuntu 24.04 amd64 passed but arm64 did not ? + # Also MacOS 13 also failed ???? + + test_list = ["salt-syndic", "salt-minion", "salt-master"] + for test_item in test_list: + test_cmd = f"systemctl status {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_downgrade_minion systemctl status for service '{test_item}' ret '{ret}'", + flush=True, + ) + + # trying restart for Debian/Ubuntu to see the outcome + if install.distro_id in ("ubuntu", "debian"): + print( + f"DGM test_salt_downgrade_minion, ubuntu or debian, restart services for distro id '{install.distro_id}'", + flush=True, + ) + install.restart_services() + time.sleep(60) # give it some time # Verify there is a new running minion by getting its PID and comparing it diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 037b8d69984..81228be0644 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -591,10 +591,10 @@ class SaltPkgInstall: self._install_pkgs(upgrade=upgrade, downgrade=downgrade) if self.distro_id in ("ubuntu", "debian"): print( - f"DGM install_salt install, ubuntu or debian, stop services distro id '{self.distro_id}' but don't ", + f"DGM install_salt install, ubuntu or debian, stop services distro id '{self.distro_id}'", flush=True, ) - ## DGM self.stop_services() + self.stop_services() def stop_services(self): """ @@ -627,6 +627,38 @@ class SaltPkgInstall: self._check_retcode(stop_service) return retval + def restart_services(self): + """ + Debian distros automatically start the services + We want to ensure our tests start with the config settings we have set. + This will also verify the expected services are up and running. + + ## DGM Why this comment stop_services, surely when Debian/Ubuntu restart automatically, they pick up the configuration already defined - unless there is some env override on configuration file to pick up. + ## DGM Created this to restart services after an install which will stop. Need to find out the underlying reason Caleb added code to stop_services, what problem was he trying to fix, + ## DGM for example: stopping service on Debian/Ubuntu when getting the _default_version ???????? + """ + print("DGM install_salt restart_services, entry", flush=True) + retval = True + for service in ["salt-syndic", "salt-master", "salt-minion"]: + check_run = self.proc.run("systemctl", "status", service) + if check_run.returncode != 0: + # The system was not started automatically and we + # are expecting it to be on install + print( + f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", + flush=True, + ) + log.debug("The service %s was not started on install.", service) + retval = False + else: + restart_service = self.proc.run("systemctl", "restart", service) + print( + f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", + flush=True, + ) + self._check_retcode(restart_service) + return retval + def install_previous(self, downgrade=False): """ Install previous version. This is used for @@ -810,10 +842,10 @@ class SaltPkgInstall: if downgrade: pref_file.unlink() print( - "DGM install, install_previous , about to stop services, but do not", + "DGM install, install_previous , about to stop services", flush=True, ) - ## DGM self.stop_services() + self.stop_services() elif platform.is_windows(): self.bin_dir = self.install_dir / "bin" self.run_root = self.bin_dir / "salt.exe" From 72a65ff8ea8ed73acddc0951d50f1dee44d7aeab Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 12:12:16 -0600 Subject: [PATCH 121/157] Refined restart_services --- tests/support/pkg.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 81228be0644..bc9371ca2bf 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -638,26 +638,20 @@ class SaltPkgInstall: ## DGM for example: stopping service on Debian/Ubuntu when getting the _default_version ???????? """ print("DGM install_salt restart_services, entry", flush=True) - retval = True for service in ["salt-syndic", "salt-master", "salt-minion"]: check_run = self.proc.run("systemctl", "status", service) - if check_run.returncode != 0: - # The system was not started automatically and we - # are expecting it to be on install - print( - f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", - flush=True, - ) - log.debug("The service %s was not started on install.", service) - retval = False - else: - restart_service = self.proc.run("systemctl", "restart", service) - print( - f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", - flush=True, - ) - self._check_retcode(restart_service) - return retval + print( + f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", + flush=True, + ) + log.debug("The restart_services status for %s is %s.", service, check_run) + + restart_service = self.proc.run("systemctl", "restart", service) + print( + f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", + flush=True, + ) + self._check_retcode(restart_service) def install_previous(self, downgrade=False): """ From 759b1673a0021e0a7429e0a91858ce510cc62a1b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 13:47:03 -0600 Subject: [PATCH 122/157] Comment out debugging print statements in support pkg.py --- tests/support/pkg.py | 106 +++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index bc9371ca2bf..d8a0da0c927 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -222,10 +222,10 @@ class SaltPkgInstall: version = f"{parsed.major}.{parsed.minor}" ## DGM why is this called out specically ??? if self.distro_id in ("ubuntu", "debian"): - print( - f"DGM install_salt, _default_version, about to stop services, for distro '{self.distro_id}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt, _default_version, about to stop services, for distro '{self.distro_id}'", + ## DGM flush=True, + ## DGM ) self.stop_services() return version @@ -434,10 +434,10 @@ class SaltPkgInstall: If not raise AssertionError """ if ret.returncode != 0: - print( - f"DGM install_salt _check_retcode bad returncode, ret '{ret}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt _check_retcode bad returncode, ret '{ret}'", + ## DGM flush=True, + ## DGM ) log.error(ret) assert ret.returncode == 0 return True @@ -590,10 +590,10 @@ class SaltPkgInstall: def install(self, upgrade=False, downgrade=False): self._install_pkgs(upgrade=upgrade, downgrade=downgrade) if self.distro_id in ("ubuntu", "debian"): - print( - f"DGM install_salt install, ubuntu or debian, stop services distro id '{self.distro_id}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt install, ubuntu or debian, stop services distro id '{self.distro_id}'", + ## DGM flush=True, + ## DGM ) self.stop_services() def stop_services(self): @@ -605,25 +605,25 @@ class SaltPkgInstall: ## DGM Why this comment, surely when Debian/Ubuntu restart automatically, they pick up the configuration already defined - unless there is some env override on configuration file to pick up. """ - print("DGM install_salt stop_services, entry", flush=True) + ## DGM print("DGM install_salt stop_services, entry", flush=True) retval = True for service in ["salt-syndic", "salt-master", "salt-minion"]: check_run = self.proc.run("systemctl", "status", service) if check_run.returncode != 0: # The system was not started automatically and we # are expecting it to be on install - print( - f"DGM install_salt stop_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt stop_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", + ## DGM flush=True, + ## DGM ) log.debug("The service %s was not started on install.", service) retval = False else: stop_service = self.proc.run("systemctl", "stop", service) - print( - f"DGM install_salt stop_services systemctl stop, service '{service}', ret '{stop_service}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt stop_services systemctl stop, service '{service}', ret '{stop_service}'", + ## DGM flush=True, + ## DGM ) self._check_retcode(stop_service) return retval @@ -637,20 +637,20 @@ class SaltPkgInstall: ## DGM Created this to restart services after an install which will stop. Need to find out the underlying reason Caleb added code to stop_services, what problem was he trying to fix, ## DGM for example: stopping service on Debian/Ubuntu when getting the _default_version ???????? """ - print("DGM install_salt restart_services, entry", flush=True) + ## DGM print("DGM install_salt restart_services, entry", flush=True) for service in ["salt-syndic", "salt-master", "salt-minion"]: check_run = self.proc.run("systemctl", "status", service) - print( - f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", + ## DGM flush=True, + ## DGM ) log.debug("The restart_services status for %s is %s.", service, check_run) restart_service = self.proc.run("systemctl", "restart", service) - print( - f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", + ## DGM flush=True, + ## DGM ) self._check_retcode(restart_service) def install_previous(self, downgrade=False): @@ -757,12 +757,12 @@ class SaltPkgInstall: if relenv: gpg_key = "SALT-PROJECT-GPG-PUBKEY-2023.gpg" - dgm_file1 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}" - dgm_file2 = f"/etc/apt/keyrings/{gpg_dest}" - print( - f"DGM install_salt install_previous download files , src '{dgm_file1}' and dest '{dgm_file2}'", - flush=True, - ) + ## DGM dgm_file1 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}" + ## DGM dgm_file2 = f"/etc/apt/keyrings/{gpg_dest}" + ## DGM print( + ## DGM f"DGM install_salt install_previous download files , src '{dgm_file1}' and dest '{dgm_file2}'", + ## DGM flush=True, + ## DGM ) download_file( f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}", @@ -771,12 +771,12 @@ class SaltPkgInstall: with salt.utils.files.fopen( pathlib.Path("/etc", "apt", "sources.list.d", "salt.list"), "w" ) as fp: - dgm_file3 = f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " - dgm_file4 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" - print( - f"DGM install_salt install_previous , write /etc/apt/sources.list.d/salt.list, '{dgm_file3}' and '{dgm_file4}'", - flush=True, - ) + ## DGM dgm_file3 = f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " + ## DGM dgm_file4 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" + ## DGM print( + ## DGM f"DGM install_salt install_previous , write /etc/apt/sources.list.d/salt.list, '{dgm_file3}' and '{dgm_file4}'", + ## DGM flush=True, + ## DGM ) fp.write( f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" @@ -790,9 +790,9 @@ class SaltPkgInstall: "-y", ] - print( - f"DGM install_salt install_previous, install cmd '{cmd}'", flush=True - ) + ## DGM print( + ## DGM f"DGM install_salt install_previous, install cmd '{cmd}'", flush=True + ## DGM ) if downgrade: pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt.pref") pref_file.parent.mkdir(exist_ok=True) @@ -819,10 +819,10 @@ class SaltPkgInstall: cmd.extend(extra_args) - print( - f"DGM install_salt install_previous, about to proc run cmd '{cmd}', env '{env}'", - flush=True, - ) + ## DGM print( + ## DGM f"DGM install_salt install_previous, about to proc run cmd '{cmd}', env '{env}'", + ## DGM flush=True, + ## DGM ) ret = self.proc.run(*cmd, env=env) # Pre-relenv packages down get downgraded to cleanly programmatically # They work manually, and the install tests after downgrades will catch problems with the install @@ -835,10 +835,10 @@ class SaltPkgInstall: self._check_retcode(ret) if downgrade: pref_file.unlink() - print( - "DGM install, install_previous , about to stop services", - flush=True, - ) + ## DGM print( + ## DGM "DGM install, install_previous , about to stop services", + ## DGM flush=True, + ## DGM ) self.stop_services() elif platform.is_windows(): self.bin_dir = self.install_dir / "bin" From 61a30532409a5ae325a13a91ffc9120b2dbea398 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 13:53:50 -0600 Subject: [PATCH 123/157] Fix typo --- tests/pytests/pkg/downgrade/test_salt_downgrade.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 1aeae6bf2ae..da925752d1b 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -99,7 +99,11 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): # since they were not explicitly stopped, but the Debian/Ubuntu are, but in testing Ubuntu 24.04 amd64 passed but arm64 did not ? # Also MacOS 13 also failed ???? - test_list = ["salt-syndic", "salt-minion", "salt-master"] + test_list = [ + "salt-minion", + "salt-master", + "salt-syndic", + ] for test_item in test_list: test_cmd = f"systemctl status {test_item}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) @@ -109,9 +113,9 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): ) # trying restart for Debian/Ubuntu to see the outcome - if install.distro_id in ("ubuntu", "debian"): + if install_salt.distro_id in ("ubuntu", "debian"): print( - f"DGM test_salt_downgrade_minion, ubuntu or debian, restart services for distro id '{install.distro_id}'", + f"DGM test_salt_downgrade_minion, ubuntu or debian, restart services for distro id '{install_salt.distro_id}'", flush=True, ) install.restart_services() From 1c1633a8da76b54664b80638e5a49d379d28001a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 15:36:33 -0600 Subject: [PATCH 124/157] Refine debugging and skip on part test for MacOS --- .../pkg/downgrade/test_salt_downgrade.py | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index da925752d1b..b7e0d4d0321 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -108,7 +108,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): test_cmd = f"systemctl status {test_item}" ret = salt_call_cli.run("--local", "cmd.run", test_cmd) print( - f"DGM test_salt_downgrade_minion systemctl status for service '{test_item}' ret '{ret}'", + f"DGM test_salt_downgrade_minion post downgrade install, systemctl status for service '{test_item}' ret '{ret}'", flush=True, ) @@ -118,10 +118,31 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): f"DGM test_salt_downgrade_minion, ubuntu or debian, restart services for distro id '{install_salt.distro_id}'", flush=True, ) - install.restart_services() + install_salt.restart_services() time.sleep(60) # give it some time + test_list = [ + "salt-minion", + "salt-master", + "salt-syndic", + ] + for test_item in test_list: + test_cmd = f"systemctl status {test_item}" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_downgrade_minion post downgrade install and restart and sleep, systemctl status for service '{test_item}' ret '{ret}'", + flush=True, + ) + + # DGM get the processes that are running + test_cmd = "ps -ef" + ret = salt_call_cli.run("--local", "cmd.run", test_cmd) + print( + f"DGM test_salt_downgrade_minion get ps -ef and compare against systemd for salt-minion, ret '{ret}'", + flush=True, + ) + # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade print( @@ -129,6 +150,10 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): flush=True, ) new_minion_pids = _get_running_named_salt_pid(process_name) + print( + f"DGM test_salt_downgrade_minion, getting new pids for process_name '{process_name}', old pids '{old_minion_pids}', new pids '{new_minion_pids}'", + flush=True, + ) assert new_minion_pids assert new_minion_pids != old_minion_pids @@ -147,7 +172,7 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): ret.stdout.strip().split()[1] ) < packaging.version.parse(install_salt.artifact_version) - if is_downgrade_to_relenv: + if is_downgrade_to_relenv and not platform.is_darwin(): new_py_version = install_salt.package_python_version() if new_py_version == original_py_version: # test pip install after a downgrade From fb5afea86b1414ced9caf52dd8f93fec2990a81b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 6 Aug 2024 10:59:32 -0600 Subject: [PATCH 125/157] Working fix, and clean up debug statements --- .../pkg/downgrade/test_salt_downgrade.py | 71 +-------------- tests/support/pkg.py | 88 ++++--------------- 2 files changed, 18 insertions(+), 141 deletions(-) diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index b7e0d4d0321..251804530b0 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -19,10 +19,6 @@ def _get_running_named_salt_pid(process_name): pids = [] for proc in psutil.process_iter(): cmdl_strg = " ".join(str(element) for element in proc.cmdline()) - print( - f"DGM _get_running_named_salt_pid, process_name '{process_name}', cmdl_strg '{cmdl_strg}'", - flush=True, - ) if process_name in cmdl_strg: pids.append(proc.pid) @@ -33,11 +29,6 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): """ Test an downgrade of Salt Minion. """ - print( - f"DGM test_salt_downgrade_minion entry, install_salt '{install_salt}'", - flush=True, - ) - is_restart_fixed = packaging.version.parse( install_salt.prev_version ) < packaging.version.parse("3006.9") @@ -79,81 +70,25 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): else: process_name = "salt-minion" - print( - f"DGM test_salt_downgrade_minion, getting old pids for process_name '{process_name}'", - flush=True, - ) old_minion_pids = _get_running_named_salt_pid(process_name) assert old_minion_pids # Downgrade Salt to the previous version and test install_salt.install(downgrade=True) - ## DGM test code time.sleep(10) # give it some time - # a downgrade install will stop services on Debian/Ubuntu (why they didn't worry about Redhat family) - # This is probably due to RedHat systems are not active after an install, but Debian/Ubuntu are active after an install - # this leads to issues depending on what the sequence of tests are run , leaving the systems systemd active or not - - # Q. why are RedHat systems passing these tests, perhaps there is a case being missed where the RedHat systems are active - # since they were not explicitly stopped, but the Debian/Ubuntu are, but in testing Ubuntu 24.04 amd64 passed but arm64 did not ? - # Also MacOS 13 also failed ???? - - test_list = [ - "salt-minion", - "salt-master", - "salt-syndic", - ] - for test_item in test_list: - test_cmd = f"systemctl status {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_downgrade_minion post downgrade install, systemctl status for service '{test_item}' ret '{ret}'", - flush=True, - ) - + # downgrade install will stop services on Debian/Ubuntu + # This is due to RedHat systems are not active after an install, but Debian/Ubuntu are active after an install + # want to ensure our tests start with the config settings we have set, # trying restart for Debian/Ubuntu to see the outcome if install_salt.distro_id in ("ubuntu", "debian"): - print( - f"DGM test_salt_downgrade_minion, ubuntu or debian, restart services for distro id '{install_salt.distro_id}'", - flush=True, - ) install_salt.restart_services() time.sleep(60) # give it some time - test_list = [ - "salt-minion", - "salt-master", - "salt-syndic", - ] - for test_item in test_list: - test_cmd = f"systemctl status {test_item}" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_downgrade_minion post downgrade install and restart and sleep, systemctl status for service '{test_item}' ret '{ret}'", - flush=True, - ) - - # DGM get the processes that are running - test_cmd = "ps -ef" - ret = salt_call_cli.run("--local", "cmd.run", test_cmd) - print( - f"DGM test_salt_downgrade_minion get ps -ef and compare against systemd for salt-minion, ret '{ret}'", - flush=True, - ) - # Verify there is a new running minion by getting its PID and comparing it # with the PID from before the upgrade - print( - f"DGM test_salt_downgrade_minion, getting new pids for process_name '{process_name}'", - flush=True, - ) new_minion_pids = _get_running_named_salt_pid(process_name) - print( - f"DGM test_salt_downgrade_minion, getting new pids for process_name '{process_name}', old pids '{old_minion_pids}', new pids '{new_minion_pids}'", - flush=True, - ) assert new_minion_pids assert new_minion_pids != old_minion_pids diff --git a/tests/support/pkg.py b/tests/support/pkg.py index d8a0da0c927..f519adcbd82 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -220,12 +220,8 @@ class SaltPkgInstall: version = self.prev_version parsed = packaging.version.parse(version) version = f"{parsed.major}.{parsed.minor}" - ## DGM why is this called out specically ??? + # ensure services stopped on Debian/Ubuntu (minic install for RedHat - non-starting) if self.distro_id in ("ubuntu", "debian"): - ## DGM print( - ## DGM f"DGM install_salt, _default_version, about to stop services, for distro '{self.distro_id}'", - ## DGM flush=True, - ## DGM ) self.stop_services() return version @@ -434,10 +430,6 @@ class SaltPkgInstall: If not raise AssertionError """ if ret.returncode != 0: - ## DGM print( - ## DGM f"DGM install_salt _check_retcode bad returncode, ret '{ret}'", - ## DGM flush=True, - ## DGM ) log.error(ret) assert ret.returncode == 0 return True @@ -590,67 +582,42 @@ class SaltPkgInstall: def install(self, upgrade=False, downgrade=False): self._install_pkgs(upgrade=upgrade, downgrade=downgrade) if self.distro_id in ("ubuntu", "debian"): - ## DGM print( - ## DGM f"DGM install_salt install, ubuntu or debian, stop services distro id '{self.distro_id}'", - ## DGM flush=True, - ## DGM ) self.stop_services() def stop_services(self): """ - Debian distros automatically start the services - We want to ensure our tests start with the config - settings we have set. This will also verify the expected - services are up and running. - - ## DGM Why this comment, surely when Debian/Ubuntu restart automatically, they pick up the configuration already defined - unless there is some env override on configuration file to pick up. + Debian/Ubuntu distros automatically start the services on install + We want to ensure our tests start with the config settings we have set. + This will also verify the expected services are up and running. """ - ## DGM print("DGM install_salt stop_services, entry", flush=True) retval = True for service in ["salt-syndic", "salt-master", "salt-minion"]: check_run = self.proc.run("systemctl", "status", service) if check_run.returncode != 0: - # The system was not started automatically and we - # are expecting it to be on install - ## DGM print( - ## DGM f"DGM install_salt stop_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", - ## DGM flush=True, - ## DGM ) + # The system was not started automatically and + # we are expecting it to be on install on Debian/Ubuntu systems log.debug("The service %s was not started on install.", service) retval = False else: stop_service = self.proc.run("systemctl", "stop", service) - ## DGM print( - ## DGM f"DGM install_salt stop_services systemctl stop, service '{service}', ret '{stop_service}'", - ## DGM flush=True, - ## DGM ) self._check_retcode(stop_service) return retval def restart_services(self): """ - Debian distros automatically start the services - We want to ensure our tests start with the config settings we have set. + Debian/Ubuntu distros automatically start the services + We want to ensure our tests start with the config settings we have set, + for example: after install the services are stopped (similar to RedHat not starting services on install) This will also verify the expected services are up and running. - - ## DGM Why this comment stop_services, surely when Debian/Ubuntu restart automatically, they pick up the configuration already defined - unless there is some env override on configuration file to pick up. - ## DGM Created this to restart services after an install which will stop. Need to find out the underlying reason Caleb added code to stop_services, what problem was he trying to fix, - ## DGM for example: stopping service on Debian/Ubuntu when getting the _default_version ???????? """ - ## DGM print("DGM install_salt restart_services, entry", flush=True) - for service in ["salt-syndic", "salt-master", "salt-minion"]: + for service in ["salt-minion", "salt-master", "salt-syndic"]: check_run = self.proc.run("systemctl", "status", service) - ## DGM print( - ## DGM f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", - ## DGM flush=True, - ## DGM ) - log.debug("The restart_services status for %s is %s.", service, check_run) - + log.debug( + "The restart_services status, before restart, for service %s is %s.", + service, + check_run, + ) restart_service = self.proc.run("systemctl", "restart", service) - ## DGM print( - ## DGM f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", - ## DGM flush=True, - ## DGM ) self._check_retcode(restart_service) def install_previous(self, downgrade=False): @@ -756,14 +723,6 @@ class SaltPkgInstall: gpg_key = gpg_dest if relenv: gpg_key = "SALT-PROJECT-GPG-PUBKEY-2023.gpg" - - ## DGM dgm_file1 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}" - ## DGM dgm_file2 = f"/etc/apt/keyrings/{gpg_dest}" - ## DGM print( - ## DGM f"DGM install_salt install_previous download files , src '{dgm_file1}' and dest '{dgm_file2}'", - ## DGM flush=True, - ## DGM ) - download_file( f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver}/{gpg_key}", f"/etc/apt/keyrings/{gpg_dest}", @@ -771,12 +730,6 @@ class SaltPkgInstall: with salt.utils.files.fopen( pathlib.Path("/etc", "apt", "sources.list.d", "salt.list"), "w" ) as fp: - ## DGM dgm_file3 = f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " - ## DGM dgm_file4 = f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" - ## DGM print( - ## DGM f"DGM install_salt install_previous , write /etc/apt/sources.list.d/salt.list, '{dgm_file3}' and '{dgm_file4}'", - ## DGM flush=True, - ## DGM ) fp.write( f"deb [signed-by=/etc/apt/keyrings/{gpg_dest} arch={arch}] " f"https://repo.saltproject.io/{root_url}{distro_name}/{self.distro_version}/{arch}/{major_ver} {self.distro_codename} main" @@ -790,9 +743,6 @@ class SaltPkgInstall: "-y", ] - ## DGM print( - ## DGM f"DGM install_salt install_previous, install cmd '{cmd}'", flush=True - ## DGM ) if downgrade: pref_file = pathlib.Path("/etc", "apt", "preferences.d", "salt.pref") pref_file.parent.mkdir(exist_ok=True) @@ -819,10 +769,6 @@ class SaltPkgInstall: cmd.extend(extra_args) - ## DGM print( - ## DGM f"DGM install_salt install_previous, about to proc run cmd '{cmd}', env '{env}'", - ## DGM flush=True, - ## DGM ) ret = self.proc.run(*cmd, env=env) # Pre-relenv packages down get downgraded to cleanly programmatically # They work manually, and the install tests after downgrades will catch problems with the install @@ -835,10 +781,6 @@ class SaltPkgInstall: self._check_retcode(ret) if downgrade: pref_file.unlink() - ## DGM print( - ## DGM "DGM install, install_previous , about to stop services", - ## DGM flush=True, - ## DGM ) self.stop_services() elif platform.is_windows(): self.bin_dir = self.install_dir / "bin" From 496bb08b58ebb338ffb9404effd64b430a7715e9 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 6 Aug 2024 14:56:58 -0600 Subject: [PATCH 126/157] Revert bad spelling for release name, was part of test --- tests/pytests/unit/utils/test_versions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/pytests/unit/utils/test_versions.py b/tests/pytests/unit/utils/test_versions.py index 794bfb10d1e..a1197778296 100644 --- a/tests/pytests/unit/utils/test_versions.py +++ b/tests/pytests/unit/utils/test_versions.py @@ -126,7 +126,7 @@ def test_warn_until_bad_version_name_raises_runtime_error(): # Ensure proper behavior with warnings.catch_warnings(record=True) as recorded_warnings: salt.utils.versions.warn_until( - 3001, "Deprecation Message!", _version_info_=(3000, 0) + "Sodium", "Deprecation Message!", _version_info_=(3000, 0) ) assert "Deprecation Message!" == str(recorded_warnings[0].message) @@ -134,7 +134,7 @@ def test_warn_until_bad_version_name_raises_runtime_error(): RuntimeError, match="Incorrect spelling for the release name in .*" ): salt.utils.versions.warn_until( - 3001, "Deprecation Message!", _version_info_=(3000, 0) + "Sudium", "Deprecation Message!", _version_info_=(3000, 0) ) @@ -154,7 +154,7 @@ def test_warn_until_warning_raised(subtests): def raise_named_version_warning(_version_info_=(0, 16, 0)): salt.utils.versions.warn_until( - 2014, "Deprecation Message!", _version_info_=_version_info_ + "hydrogen", "Deprecation Message!", _version_info_=_version_info_ ) with subtests.test( @@ -233,7 +233,7 @@ def test_warn_until_warning_raised(subtests): ), ): salt.utils.versions.warn_until( - 2014, + "Hydrogen", "Foo", _dont_call_warnings=True, _version_info_=(sys.maxsize, 16, 0), @@ -243,7 +243,7 @@ def test_warn_until_warning_raised(subtests): with warnings.catch_warnings(record=True) as recorded_warnings: vrs = salt.version.SaltStackVersion.from_name("Helium") salt.utils.versions.warn_until( - 2014, + "Helium", "Deprecation Message until {version}!", _version_info_=(vrs.major - 1, 0), ) From 4e41a00ef9780ed2298151876973cb92dc1ec1d0 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 7 Aug 2024 07:46:52 -0600 Subject: [PATCH 127/157] Allow for arm64 or x86_64 when testing MacOS --- tests/support/pkg.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index f519adcbd82..066db28921e 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -837,14 +837,21 @@ class SaltPkgInstall: self._install_ssm_service() elif platform.is_darwin(): + if relenv and platform.is_aarch64(): + arch = "arm64" + elif platform.is_aarch64() and self.classic: + arch = "arm64" + else: + arch = "x86_64" + if self.classic: - mac_pkg = f"salt-{self.prev_version}-py3-x86_64.pkg" + mac_pkg = f"salt-{self.prev_version}-py3-{arch}.pkg" mac_pkg_url = f"https://repo.saltproject.io/osx/{mac_pkg}" else: if not relenv: - mac_pkg = f"salt-{self.prev_version}-1-macos-x86_64.pkg" + mac_pkg = f"salt-{self.prev_version}-1-macos-{arch}.pkg" else: - mac_pkg = f"salt-{self.prev_version}-py3-x86_64.pkg" + mac_pkg = f"salt-{self.prev_version}-py3-{arch}.pkg" mac_pkg_url = ( f"https://repo.saltproject.io/salt/py3/macos/{major_ver}/{mac_pkg}" ) From b3f23256452c039018014114b5422a75c091ddbc Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 7 Aug 2024 09:33:28 -0600 Subject: [PATCH 128/157] Added debugging statements --- tests/support/pkg.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 066db28921e..1c21b4095d7 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -856,6 +856,16 @@ class SaltPkgInstall: f"https://repo.saltproject.io/salt/py3/macos/{major_ver}/{mac_pkg}" ) + if relenv: + dgm_relenv = True + else: + dgm_relenv = False + + print( + f"DGM test/support/pkg for darwin, relenv '{dgm_relenv}', is_aarchc64 '{platform.is_aarch64()}', classic '{self.classic}', arch '{arch}', mac_pkg '{mac_pkg}', mac_pkg_url '{mac_pkg_url}'", + flush=True, + ) + mac_pkg_path = f"/tmp/{mac_pkg}" if not os.path.exists(mac_pkg_path): download_file( From ce881d54fb84cca9d296fc4f0bf9b0d737ca58c8 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 7 Aug 2024 11:03:02 -0600 Subject: [PATCH 129/157] more debugging and added is_arm64 to utils platform --- salt/utils/platform.py | 17 +++++++++++++++++ tests/support/pkg.py | 10 +++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/salt/utils/platform.py b/salt/utils/platform.py index 100918b72d5..a0563b08266 100644 --- a/salt/utils/platform.py +++ b/salt/utils/platform.py @@ -231,6 +231,23 @@ def is_aarch64(): return platform.machine().startswith("aarch64") +@real_memoize +def is_arm64(): + """ + Simple function to return if host is Arm64 or not + """ + return platform.machine().startswith("arm64") + + +## DGM Debugging +@real_memoize +def dgm_machine(): + """ + Simple function to return what machine string, debug purpose only + """ + return platform.machine() + + def spawning_platform(): """ Returns True if multiprocessing.get_start_method(allow_none=False) returns "spawn" diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 1c21b4095d7..7b6c18ae598 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -837,9 +837,9 @@ class SaltPkgInstall: self._install_ssm_service() elif platform.is_darwin(): - if relenv and platform.is_aarch64(): + if relenv and platform.is_arm64(): arch = "arm64" - elif platform.is_aarch64() and self.classic: + elif platform.is_arm64() and self.classic: arch = "arm64" else: arch = "x86_64" @@ -862,7 +862,11 @@ class SaltPkgInstall: dgm_relenv = False print( - f"DGM test/support/pkg for darwin, relenv '{dgm_relenv}', is_aarchc64 '{platform.is_aarch64()}', classic '{self.classic}', arch '{arch}', mac_pkg '{mac_pkg}', mac_pkg_url '{mac_pkg_url}'", + f"DGM test/support/pkg for darwin, machine string '{platform.dgm_machine()}'", + flush=True, + ) + print( + f"DGM test/support/pkg for darwin, relenv '{dgm_relenv}', is_aarch64 '{platform.is_aarch64()}', is_arm64 '{platform.is_arm64()}', classic '{self.classic}', arch '{arch}', mac_pkg '{mac_pkg}', mac_pkg_url '{mac_pkg_url}'", flush=True, ) From e97ae272feafb23cd50623d3a0654967d80aa8f6 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 07:39:14 -0600 Subject: [PATCH 130/157] further debug --- tests/support/pkg.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 7b6c18ae598..c86c8385295 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -31,6 +31,7 @@ from saltfactories.daemons import api, master, minion from saltfactories.utils import cli_scripts import salt.utils.files +import salt.utils.platform as dgm_platform from tests.conftest import CODE_DIR from tests.support.pytest.helpers import TestAccount @@ -837,9 +838,9 @@ class SaltPkgInstall: self._install_ssm_service() elif platform.is_darwin(): - if relenv and platform.is_arm64(): + if relenv and dgm_platform.is_arm64(): arch = "arm64" - elif platform.is_arm64() and self.classic: + elif dgm_platform.is_arm64() and self.classic: arch = "arm64" else: arch = "x86_64" @@ -862,7 +863,7 @@ class SaltPkgInstall: dgm_relenv = False print( - f"DGM test/support/pkg for darwin, machine string '{platform.dgm_machine()}'", + f"DGM test/support/pkg for darwin, machine string '{dgm_platform.dgm_machine()}'", flush=True, ) print( From 34e0120a89f523cf2ce5c9a0ddf84bf57bf397f2 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 09:20:46 -0600 Subject: [PATCH 131/157] Fix debugging --- tests/support/pkg.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index c86c8385295..ae5efe4fd50 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -838,6 +838,10 @@ class SaltPkgInstall: self._install_ssm_service() elif platform.is_darwin(): + print( + f"DGM test/support/pkg for darwin, machine string '{dgm_platform.dgm_machine()}'", + flush=True, + ) if relenv and dgm_platform.is_arm64(): arch = "arm64" elif dgm_platform.is_arm64() and self.classic: @@ -863,11 +867,7 @@ class SaltPkgInstall: dgm_relenv = False print( - f"DGM test/support/pkg for darwin, machine string '{dgm_platform.dgm_machine()}'", - flush=True, - ) - print( - f"DGM test/support/pkg for darwin, relenv '{dgm_relenv}', is_aarch64 '{platform.is_aarch64()}', is_arm64 '{platform.is_arm64()}', classic '{self.classic}', arch '{arch}', mac_pkg '{mac_pkg}', mac_pkg_url '{mac_pkg_url}'", + f"DGM test/support/pkg for darwin, relenv '{dgm_relenv}', is_aarch64 '{platform.is_aarch64()}', dgm is_arm64 '{dgm_platform.is_arm64()}', classic '{self.classic}', arch '{arch}', mac_pkg '{mac_pkg}', mac_pkg_url '{mac_pkg_url}'", flush=True, ) From 6e43c93634e2ea4fb55b5448109573ff036395e9 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 13:20:04 -0600 Subject: [PATCH 132/157] Use updated pytest-skip-markers to pick up corrected MacOS Arm64 support --- requirements/pytest.txt | 2 ++ requirements/static/ci/py3.10/cloud.txt | 3 ++- requirements/static/ci/py3.10/darwin.txt | 3 ++- requirements/static/ci/py3.10/freebsd.txt | 3 ++- requirements/static/ci/py3.10/linux.txt | 3 ++- requirements/static/ci/py3.10/windows.txt | 3 ++- requirements/static/ci/py3.11/cloud.txt | 3 ++- requirements/static/ci/py3.11/darwin.txt | 3 ++- requirements/static/ci/py3.11/freebsd.txt | 3 ++- requirements/static/ci/py3.11/linux.txt | 3 ++- requirements/static/ci/py3.11/windows.txt | 3 ++- requirements/static/ci/py3.12/cloud.txt | 3 ++- requirements/static/ci/py3.12/darwin.txt | 3 ++- requirements/static/ci/py3.12/freebsd.txt | 3 ++- requirements/static/ci/py3.12/linux.txt | 3 ++- requirements/static/ci/py3.12/windows.txt | 3 ++- requirements/static/ci/py3.7/cloud.txt | 3 ++- requirements/static/ci/py3.7/freebsd.txt | 3 ++- requirements/static/ci/py3.7/linux.txt | 3 ++- requirements/static/ci/py3.7/windows.txt | 3 ++- requirements/static/ci/py3.8/cloud.txt | 3 ++- requirements/static/ci/py3.8/freebsd.txt | 3 ++- requirements/static/ci/py3.8/linux.txt | 3 ++- requirements/static/ci/py3.8/windows.txt | 3 ++- requirements/static/ci/py3.9/cloud.txt | 3 ++- requirements/static/ci/py3.9/darwin.txt | 3 ++- requirements/static/ci/py3.9/freebsd.txt | 3 ++- requirements/static/ci/py3.9/linux.txt | 3 ++- requirements/static/ci/py3.9/windows.txt | 3 ++- salt/utils/platform.py | 23 +++++------------------ tests/support/pkg.py | 19 ++----------------- 31 files changed, 65 insertions(+), 63 deletions(-) diff --git a/requirements/pytest.txt b/requirements/pytest.txt index ce8b9569125..82dd9138958 100644 --- a/requirements/pytest.txt +++ b/requirements/pytest.txt @@ -13,3 +13,5 @@ flaky more-itertools pyfakefs trustme +pytest-skip-markers >= 1.5.2 ; python_version >= '3.8' +pytest-skip-markers <= 1.5.1 ; python_version < '3.8' diff --git a/requirements/static/ci/py3.10/cloud.txt b/requirements/static/ci/py3.10/cloud.txt index ac9e868a1dc..b64e1117dc1 100644 --- a/requirements/static/ci/py3.10/cloud.txt +++ b/requirements/static/ci/py3.10/cloud.txt @@ -482,9 +482,10 @@ pytest-shell-utilities==1.8.0 # via # -c requirements/static/ci/py3.10/linux.txt # pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via # -c requirements/static/ci/py3.10/linux.txt + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.10/darwin.txt b/requirements/static/ci/py3.10/darwin.txt index 1fcec03349a..e5818d707bc 100644 --- a/requirements/static/ci/py3.10/darwin.txt +++ b/requirements/static/ci/py3.10/darwin.txt @@ -337,8 +337,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.10/freebsd.txt b/requirements/static/ci/py3.10/freebsd.txt index 695496a31fc..8df94c0cf59 100644 --- a/requirements/static/ci/py3.10/freebsd.txt +++ b/requirements/static/ci/py3.10/freebsd.txt @@ -330,8 +330,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.10/linux.txt b/requirements/static/ci/py3.10/linux.txt index 2d58958d020..e2142dcaa6b 100644 --- a/requirements/static/ci/py3.10/linux.txt +++ b/requirements/static/ci/py3.10/linux.txt @@ -347,8 +347,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.10/windows.txt b/requirements/static/ci/py3.10/windows.txt index c3d2ca7db3d..ae774c8c5da 100644 --- a/requirements/static/ci/py3.10/windows.txt +++ b/requirements/static/ci/py3.10/windows.txt @@ -308,8 +308,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.11/cloud.txt b/requirements/static/ci/py3.11/cloud.txt index a83527ee15b..c1f9e918364 100644 --- a/requirements/static/ci/py3.11/cloud.txt +++ b/requirements/static/ci/py3.11/cloud.txt @@ -446,9 +446,10 @@ pytest-shell-utilities==1.8.0 # via # -c requirements/static/ci/py3.11/linux.txt # pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via # -c requirements/static/ci/py3.11/linux.txt + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.11/darwin.txt b/requirements/static/ci/py3.11/darwin.txt index 7fd5ffd488e..f03ecc33041 100644 --- a/requirements/static/ci/py3.11/darwin.txt +++ b/requirements/static/ci/py3.11/darwin.txt @@ -308,8 +308,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.11/freebsd.txt b/requirements/static/ci/py3.11/freebsd.txt index b6fc17085ae..f590604d2be 100644 --- a/requirements/static/ci/py3.11/freebsd.txt +++ b/requirements/static/ci/py3.11/freebsd.txt @@ -307,8 +307,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.11/linux.txt b/requirements/static/ci/py3.11/linux.txt index e4dee258e06..1c23b60c181 100644 --- a/requirements/static/ci/py3.11/linux.txt +++ b/requirements/static/ci/py3.11/linux.txt @@ -324,8 +324,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.11/windows.txt b/requirements/static/ci/py3.11/windows.txt index 533a506872c..5805ca012b0 100644 --- a/requirements/static/ci/py3.11/windows.txt +++ b/requirements/static/ci/py3.11/windows.txt @@ -304,8 +304,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.12/cloud.txt b/requirements/static/ci/py3.12/cloud.txt index a7aca219fc5..deb11a5621f 100644 --- a/requirements/static/ci/py3.12/cloud.txt +++ b/requirements/static/ci/py3.12/cloud.txt @@ -446,9 +446,10 @@ pytest-shell-utilities==1.8.0 # via # -c requirements/static/ci/py3.12/linux.txt # pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via # -c requirements/static/ci/py3.12/linux.txt + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.12/darwin.txt b/requirements/static/ci/py3.12/darwin.txt index 5830968b7c2..dee6d2f8a3b 100644 --- a/requirements/static/ci/py3.12/darwin.txt +++ b/requirements/static/ci/py3.12/darwin.txt @@ -308,8 +308,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.12/freebsd.txt b/requirements/static/ci/py3.12/freebsd.txt index b0359448665..31444237bda 100644 --- a/requirements/static/ci/py3.12/freebsd.txt +++ b/requirements/static/ci/py3.12/freebsd.txt @@ -307,8 +307,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.12/linux.txt b/requirements/static/ci/py3.12/linux.txt index c0a9ce436b3..5c9055f8c86 100644 --- a/requirements/static/ci/py3.12/linux.txt +++ b/requirements/static/ci/py3.12/linux.txt @@ -324,8 +324,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.12/windows.txt b/requirements/static/ci/py3.12/windows.txt index 83a5207977d..c154d4f9878 100644 --- a/requirements/static/ci/py3.12/windows.txt +++ b/requirements/static/ci/py3.12/windows.txt @@ -304,8 +304,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.7/cloud.txt b/requirements/static/ci/py3.7/cloud.txt index a124d4c40a7..0c6c573ae00 100644 --- a/requirements/static/ci/py3.7/cloud.txt +++ b/requirements/static/ci/py3.7/cloud.txt @@ -530,9 +530,10 @@ pytest-shell-utilities==1.8.0 # via # -c requirements/static/ci/py3.7/linux.txt # pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.0 ; python_version < "3.8" # via # -c requirements/static/ci/py3.7/linux.txt + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.7/freebsd.txt b/requirements/static/ci/py3.7/freebsd.txt index 41265a081f7..a2bc4b2d666 100644 --- a/requirements/static/ci/py3.7/freebsd.txt +++ b/requirements/static/ci/py3.7/freebsd.txt @@ -371,8 +371,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.0 ; python_version < "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.7/linux.txt b/requirements/static/ci/py3.7/linux.txt index 03b9b6a2e88..8e5253ad65b 100644 --- a/requirements/static/ci/py3.7/linux.txt +++ b/requirements/static/ci/py3.7/linux.txt @@ -383,8 +383,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.0 ; python_version < "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.7/windows.txt b/requirements/static/ci/py3.7/windows.txt index de820b25b40..e59c9ccc427 100644 --- a/requirements/static/ci/py3.7/windows.txt +++ b/requirements/static/ci/py3.7/windows.txt @@ -323,8 +323,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.0 ; python_version < "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.8/cloud.txt b/requirements/static/ci/py3.8/cloud.txt index 92138a595db..a72f33cb2c9 100644 --- a/requirements/static/ci/py3.8/cloud.txt +++ b/requirements/static/ci/py3.8/cloud.txt @@ -516,9 +516,10 @@ pytest-shell-utilities==1.8.0 # via # -c requirements/static/ci/py3.8/linux.txt # pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via # -c requirements/static/ci/py3.8/linux.txt + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.8/freebsd.txt b/requirements/static/ci/py3.8/freebsd.txt index 00cdba1b225..cbacf12301e 100644 --- a/requirements/static/ci/py3.8/freebsd.txt +++ b/requirements/static/ci/py3.8/freebsd.txt @@ -357,8 +357,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.8/linux.txt b/requirements/static/ci/py3.8/linux.txt index 594b8c106b7..583da473b1d 100644 --- a/requirements/static/ci/py3.8/linux.txt +++ b/requirements/static/ci/py3.8/linux.txt @@ -369,8 +369,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.8/windows.txt b/requirements/static/ci/py3.8/windows.txt index 3e67555b202..9d490f6f899 100644 --- a/requirements/static/ci/py3.8/windows.txt +++ b/requirements/static/ci/py3.8/windows.txt @@ -309,8 +309,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.9/cloud.txt b/requirements/static/ci/py3.9/cloud.txt index 647fc725be9..8cc07e4db5d 100644 --- a/requirements/static/ci/py3.9/cloud.txt +++ b/requirements/static/ci/py3.9/cloud.txt @@ -518,9 +518,10 @@ pytest-shell-utilities==1.8.0 # via # -c requirements/static/ci/py3.9/linux.txt # pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via # -c requirements/static/ci/py3.9/linux.txt + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.9/darwin.txt b/requirements/static/ci/py3.9/darwin.txt index 12a75bae3d9..d54f2e9281f 100644 --- a/requirements/static/ci/py3.9/darwin.txt +++ b/requirements/static/ci/py3.9/darwin.txt @@ -366,8 +366,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.9/freebsd.txt b/requirements/static/ci/py3.9/freebsd.txt index f56f2ea6544..1e830cd7cf3 100644 --- a/requirements/static/ci/py3.9/freebsd.txt +++ b/requirements/static/ci/py3.9/freebsd.txt @@ -359,8 +359,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.9/linux.txt b/requirements/static/ci/py3.9/linux.txt index 772d1601a6c..8075f781b7d 100644 --- a/requirements/static/ci/py3.9/linux.txt +++ b/requirements/static/ci/py3.9/linux.txt @@ -369,8 +369,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/requirements/static/ci/py3.9/windows.txt b/requirements/static/ci/py3.9/windows.txt index af27c5a56d2..03d521b7b0d 100644 --- a/requirements/static/ci/py3.9/windows.txt +++ b/requirements/static/ci/py3.9/windows.txt @@ -310,8 +310,9 @@ pytest-salt-factories==1.0.1 # via -r requirements/pytest.txt pytest-shell-utilities==1.8.0 # via pytest-salt-factories -pytest-skip-markers==1.5.0 +pytest-skip-markers==1.5.2 ; python_version >= "3.8" # via + # -r requirements/pytest.txt # pytest-salt-factories # pytest-shell-utilities # pytest-system-statistics diff --git a/salt/utils/platform.py b/salt/utils/platform.py index a0563b08266..59a04b451bc 100644 --- a/salt/utils/platform.py +++ b/salt/utils/platform.py @@ -228,24 +228,11 @@ def is_aarch64(): """ Simple function to return if host is AArch64 or not """ - return platform.machine().startswith("aarch64") - - -@real_memoize -def is_arm64(): - """ - Simple function to return if host is Arm64 or not - """ - return platform.machine().startswith("arm64") - - -## DGM Debugging -@real_memoize -def dgm_machine(): - """ - Simple function to return what machine string, debug purpose only - """ - return platform.machine() + if is_darwin(): + # Allow for MacOS Arm64 platform returning differently from Linux + return platform.machine().startswith("arm64") + else: + return platform.machine().startswith("aarch64") def spawning_platform(): diff --git a/tests/support/pkg.py b/tests/support/pkg.py index ae5efe4fd50..066db28921e 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -31,7 +31,6 @@ from saltfactories.daemons import api, master, minion from saltfactories.utils import cli_scripts import salt.utils.files -import salt.utils.platform as dgm_platform from tests.conftest import CODE_DIR from tests.support.pytest.helpers import TestAccount @@ -838,13 +837,9 @@ class SaltPkgInstall: self._install_ssm_service() elif platform.is_darwin(): - print( - f"DGM test/support/pkg for darwin, machine string '{dgm_platform.dgm_machine()}'", - flush=True, - ) - if relenv and dgm_platform.is_arm64(): + if relenv and platform.is_aarch64(): arch = "arm64" - elif dgm_platform.is_arm64() and self.classic: + elif platform.is_aarch64() and self.classic: arch = "arm64" else: arch = "x86_64" @@ -861,16 +856,6 @@ class SaltPkgInstall: f"https://repo.saltproject.io/salt/py3/macos/{major_ver}/{mac_pkg}" ) - if relenv: - dgm_relenv = True - else: - dgm_relenv = False - - print( - f"DGM test/support/pkg for darwin, relenv '{dgm_relenv}', is_aarch64 '{platform.is_aarch64()}', dgm is_arm64 '{dgm_platform.is_arm64()}', classic '{self.classic}', arch '{arch}', mac_pkg '{mac_pkg}', mac_pkg_url '{mac_pkg_url}'", - flush=True, - ) - mac_pkg_path = f"/tmp/{mac_pkg}" if not os.path.exists(mac_pkg_path): download_file( From afbb42e812e5363fc9304641f6fedc9bc194d09c Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Mon, 5 Aug 2024 16:16:49 -0700 Subject: [PATCH 133/157] Call close method on finished processes --- salt/utils/process.py | 3 ++ .../pytests/functional/utils/test_process.py | 37 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/salt/utils/process.py b/salt/utils/process.py index ce3a8be7c87..9b5c0aa4181 100644 --- a/salt/utils/process.py +++ b/salt/utils/process.py @@ -1173,6 +1173,9 @@ class SubprocessList: if proc.is_alive(): continue proc.join() + # Only processes have a close method, threads do not. + if hasattr(proc, "close"): + proc.close() self.processes.remove(proc) self.count -= 1 log.debug("Subprocess %s cleaned up", proc.name) diff --git a/tests/pytests/functional/utils/test_process.py b/tests/pytests/functional/utils/test_process.py index ed165ea3e91..400fc362117 100644 --- a/tests/pytests/functional/utils/test_process.py +++ b/tests/pytests/functional/utils/test_process.py @@ -5,6 +5,10 @@ tests.pytests.functional.utils.test_process Test salt's process utility module """ +import os +import subprocess +import time + import pytest import salt.utils.process @@ -35,3 +39,36 @@ def test_process_manager_60749(process_manager): process_manager.add_process(Process) process_manager.check_children() + + +def _get_num_fds(pid): + "Determine the number of open fds for a process, linux only." + proc = subprocess.run( + ["ls", "-l", f"/proc/{pid}/fd"], capture_output=True, check=True + ) + return len(proc.stdout.decode().split("\n")) - 1 + + +@pytest.mark.skip_unless_on_linux +def test_subprocess_list_fds(): + pid = os.getpid() + process_list = salt.utils.process.SubprocessList() + + before_num = _get_num_fds(pid) + + def target(): + pass + + process = salt.utils.process.SignalHandlingProcess(target=target) + process.start() + process_list.add(process) + time.sleep(0.3) + + num = _get_num_fds(pid) + assert num == before_num + 2 + + process_list.cleanup() + + assert len(process_list.processes) == 0 + + assert _get_num_fds(pid) == num - 2 From 2b2c03893eff5681f8453b66acf25642f7dbcd2c Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Mon, 5 Aug 2024 16:18:14 -0700 Subject: [PATCH 134/157] Add changelog for #66726 --- changelog/66726.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/66726.fixed.md diff --git a/changelog/66726.fixed.md b/changelog/66726.fixed.md new file mode 100644 index 00000000000..b9682900d1d --- /dev/null +++ b/changelog/66726.fixed.md @@ -0,0 +1 @@ +Clean up multiprocessing file handles on minion From bcb0d79cdc7cc756c48858fe395ca5c7fcf3cc6a Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Tue, 6 Aug 2024 17:40:09 -0700 Subject: [PATCH 135/157] Wait longer for the test process to finish --- tests/pytests/functional/utils/test_process.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/pytests/functional/utils/test_process.py b/tests/pytests/functional/utils/test_process.py index 400fc362117..50a7fd1ee44 100644 --- a/tests/pytests/functional/utils/test_process.py +++ b/tests/pytests/functional/utils/test_process.py @@ -6,7 +6,7 @@ Test salt's process utility module """ import os -import subprocess +import pathlib import time import pytest @@ -43,10 +43,7 @@ def test_process_manager_60749(process_manager): def _get_num_fds(pid): "Determine the number of open fds for a process, linux only." - proc = subprocess.run( - ["ls", "-l", f"/proc/{pid}/fd"], capture_output=True, check=True - ) - return len(proc.stdout.decode().split("\n")) - 1 + return len(list(pathlib.Path(f"/proc/{pid}/fd").iterdir())) @pytest.mark.skip_unless_on_linux @@ -62,13 +59,12 @@ def test_subprocess_list_fds(): process = salt.utils.process.SignalHandlingProcess(target=target) process.start() process_list.add(process) - time.sleep(0.3) - num = _get_num_fds(pid) assert num == before_num + 2 - - process_list.cleanup() - + start = time.time() + while time.time() - start < 1: + process_list.cleanup() + if not process_list.processes: + break assert len(process_list.processes) == 0 - assert _get_num_fds(pid) == num - 2 From 092a79ccb9ff0b7fb067356d6deb14e1705f38e0 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 7 Aug 2024 00:37:59 -0700 Subject: [PATCH 136/157] Do not rely on is_alive --- salt/utils/process.py | 16 ++++++++++------ tests/pytests/functional/utils/test_process.py | 3 +++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/salt/utils/process.py b/salt/utils/process.py index 9b5c0aa4181..8704d9ab307 100644 --- a/salt/utils/process.py +++ b/salt/utils/process.py @@ -1169,13 +1169,17 @@ class SubprocessList: def cleanup(self): with self.lock: - for proc in self.processes: - if proc.is_alive(): - continue - proc.join() - # Only processes have a close method, threads do not. - if hasattr(proc, "close"): + for proc in self.processes[:]: + proc.join(0.01) + if hasattr(proc, "exitcode"): + # Only processes have exitcode and a close method, threads + # do not. + if proc.exitcode is None: + continue proc.close() + else: + if proc.is_alive(): + continue self.processes.remove(proc) self.count -= 1 log.debug("Subprocess %s cleaned up", proc.name) diff --git a/tests/pytests/functional/utils/test_process.py b/tests/pytests/functional/utils/test_process.py index 50a7fd1ee44..14525c426af 100644 --- a/tests/pytests/functional/utils/test_process.py +++ b/tests/pytests/functional/utils/test_process.py @@ -58,7 +58,10 @@ def test_subprocess_list_fds(): process = salt.utils.process.SignalHandlingProcess(target=target) process.start() + process_list.add(process) + time.sleep(0.3) + num = _get_num_fds(pid) assert num == before_num + 2 start = time.time() From 852bf0004a7a9ffa6be703e34885224df969ed2c Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Fri, 9 Aug 2024 15:19:32 -0700 Subject: [PATCH 137/157] Ensure Manjaro ARM reports the correct os_family of Arch. --- changelog/66796.fixed.md | 1 + salt/grains/core.py | 1 + tests/pytests/unit/grains/test_core.py | 33 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 changelog/66796.fixed.md diff --git a/changelog/66796.fixed.md b/changelog/66796.fixed.md new file mode 100644 index 00000000000..cff6c771fa9 --- /dev/null +++ b/changelog/66796.fixed.md @@ -0,0 +1 @@ +Ensure Manjaro ARM reports the correct os_family of Arch. diff --git a/salt/grains/core.py b/salt/grains/core.py index cc781a2ced9..51646f6f979 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -1867,6 +1867,7 @@ _OS_FAMILY_MAP = { "SLES_SAP": "Suse", "Arch ARM": "Arch", "Manjaro": "Arch", + "Manjaro ARM": "Arch", "Antergos": "Arch", "EndeavourOS": "Arch", "ALT": "RedHat", diff --git a/tests/pytests/unit/grains/test_core.py b/tests/pytests/unit/grains/test_core.py index 68a2c2f347a..03d55ede45e 100644 --- a/tests/pytests/unit/grains/test_core.py +++ b/tests/pytests/unit/grains/test_core.py @@ -1231,6 +1231,39 @@ def test_Parrot_OS_grains(): _run_os_grains_tests(_os_release_data, _os_release_map, expectation) +@pytest.mark.skip_unless_on_linux +def test_manjaro_arm_grains(): + """ + Test if OS grains are parsed correctly in Manjaro ARM + """ + # /etc/os-release data taken from ParrotOS 5.1 + _os_release_data = { + "NAME": "Manjaro ARM", + "ID": "manjaro-arm", + "ID_LIKE": "manjaro arch", + "PRETTY_NAME": "Manjaro ARM", + "ANSI_COLOR": "1;32", + "HOME_URL": "https://www.manjaro.org/", + "SUPPORT_URL": "https://forum.manjaro.org/c/arm/", + "LOGO": "manjarolinux", + } + _os_release_map = { + "_linux_distribution": ("Manjaro ARM", "24.03", "n/a"), + } + + expectation = { + "os": "Manjaro ARM", + "os_family": "Arch", + "oscodename": "Manjaro ARM", + "osfullname": "Manjaro ARM", + "osrelease": "24.03", + "osrelease_info": (24, 3), + "osmajorrelease": 24, + "osfinger": "Manjaro ARM-24", + } + _run_os_grains_tests(_os_release_data, _os_release_map, expectation) + + def test_unicode_error(): raise_unicode_mock = MagicMock(name="raise_unicode_error", side_effect=UnicodeError) with patch("salt.grains.core.hostname"), patch( From 3e8fb1a06a7044338ea338ba2f5eeee548cd19b7 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 7 Aug 2024 12:25:33 -0500 Subject: [PATCH 138/157] salt.utils.atomicfile: respect system umask when creating new files --- salt/utils/atomicfile.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/salt/utils/atomicfile.py b/salt/utils/atomicfile.py index 5dfffbb83c2..a3bf2346804 100644 --- a/salt/utils/atomicfile.py +++ b/salt/utils/atomicfile.py @@ -11,6 +11,7 @@ import sys import tempfile import time +import salt.utils.files import salt.utils.win_dacl CAN_RENAME_OPEN_FILE = False @@ -128,15 +129,19 @@ class _AtomicWFile: if self._fh.closed: return self._fh.close() - if os.path.isfile(self._filename): - if salt.utils.win_dacl.HAS_WIN32: + if salt.utils.win_dacl.HAS_WIN32: + if os.path.isfile(self._filename): salt.utils.win_dacl.copy_security( source=self._filename, target=self._tmp_filename ) - else: + else: + if os.path.isfile(self._filename): shutil.copymode(self._filename, self._tmp_filename) st = os.stat(self._filename) os.chown(self._tmp_filename, st.st_uid, st.st_gid) + else: + # chmod file to default mode based on umask + os.chmod(self._tmp_filename, 0o666 & ~salt.utils.files.get_umask()) atomic_rename(self._tmp_filename, self._filename) def __exit__(self, exc_type, exc_value, traceback): From 46ef29b9af458c6741b7976426247cf1c9f5498c Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 7 Aug 2024 14:59:13 -0500 Subject: [PATCH 139/157] Add test case --- tests/pytests/unit/utils/test_atomicfile.py | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/pytests/unit/utils/test_atomicfile.py diff --git a/tests/pytests/unit/utils/test_atomicfile.py b/tests/pytests/unit/utils/test_atomicfile.py new file mode 100644 index 00000000000..06dfd9a5b68 --- /dev/null +++ b/tests/pytests/unit/utils/test_atomicfile.py @@ -0,0 +1,27 @@ +""" +Tests for atomicfile utility module. +""" + +import pytest + +import salt.utils.files +from salt.utils.atomicfile import atomic_open + + +@pytest.mark.skip_on_windows(reason="Not a Windows test") +def test_atomicfile_respects_umask(tmp_path): + """ + Test that creating a file using atomic_open respects the umask, instead of + creating the file with 0600 perms. + """ + new_file = tmp_path / "foo" + contents = "bar" + + # Set the umask specifically for this test so that we know what the mode of + # the created file should be. + with salt.utils.files.set_umask(0o022): + with atomic_open(str(new_file), "w") as fh_: + fh_.write(contents) + + assert new_file.read_text() == contents + assert oct(new_file.stat().st_mode)[-3:] == "644" From 17dcfa29fd6ebf09269ae1de94110b6fd0ce5bb8 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 7 Aug 2024 15:27:44 -0500 Subject: [PATCH 140/157] Add changelog file --- changelog/66786.fixed.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/66786.fixed.md diff --git a/changelog/66786.fixed.md b/changelog/66786.fixed.md new file mode 100644 index 00000000000..22bb47e0806 --- /dev/null +++ b/changelog/66786.fixed.md @@ -0,0 +1,2 @@ +Fix an issue where files created using `salt.utils.atomicile.atomic_open()` +were created with restrictive permissions instead of respecting the umask. From 6d10c20ea89fada221f221d1248f1f0f80e53746 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 29 Jul 2024 16:14:45 -0600 Subject: [PATCH 141/157] Fix batch mode hang indefinitely in some scenarios - unit tests to follow --- changelog/66249.fixed.md | 1 + salt/cli/batch.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changelog/66249.fixed.md diff --git a/changelog/66249.fixed.md b/changelog/66249.fixed.md new file mode 100644 index 00000000000..dac7b563a49 --- /dev/null +++ b/changelog/66249.fixed.md @@ -0,0 +1 @@ +Fix batch mode hang indefinitely in some scenarios diff --git a/salt/cli/batch.py b/salt/cli/batch.py index 2e43b0ee22b..3a648c02b86 100644 --- a/salt/cli/batch.py +++ b/salt/cli/batch.py @@ -83,7 +83,14 @@ class Batch: ) break if m is not None: - fret.add(m) + if "failed" in ret[m] and ret[m]["failed"] is True: + log.debug( + "minion '%s' failed test.ping - will be returned as a down minion", + m, + ) + else: + fret.add(m) + return (list(fret), ping_gen, nret.difference(fret)) def get_bnum(self): @@ -292,11 +299,12 @@ class Batch: # We already know some minions didn't respond to the ping, so inform # inform user attempt to run a job failed salt.utils.stringutils.print_cli( - "Minion '%s' failed to respond to job sent", minion + f"Minion '{minion}' failed to respond to job sent" ) if self.opts.get("failhard"): failhard = True + ret[minion] = data else: # If we are executing multiple modules with the same cmd, # We use the highest retcode. From 3d7ebf028df816422b6cc6c718b7b5522f1bc2ff Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 14 Aug 2024 13:49:11 -0600 Subject: [PATCH 142/157] Removing tech debt and restoring original pytest.skip for tests --- tests/pytests/pkg/integration/test_enabled_disabled.py | 5 +---- tests/pytests/pkg/integration/test_salt_api.py | 2 +- tests/pytests/pkg/integration/test_salt_call.py | 4 ---- tests/pytests/pkg/integration/test_salt_exec.py | 2 +- tests/pytests/pkg/integration/test_salt_grains.py | 2 +- tests/pytests/pkg/integration/test_salt_key.py | 2 +- tests/pytests/pkg/integration/test_salt_output.py | 2 +- tests/pytests/pkg/integration/test_salt_state_file.py | 2 +- tests/pytests/pkg/integration/test_salt_user.py | 5 ++++- tests/pytests/pkg/integration/test_version.py | 9 +++++---- 10 files changed, 16 insertions(+), 19 deletions(-) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 9b98d47becd..43dd4d4366a 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -1,11 +1,8 @@ import pytest from pytestskipmarkers.utils import platform -pytestmark = [ - pytest.mark.skip_unless_on_linux, -] - +@pytest.mark.skip_on_windows(reason="Linux test only") def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled diff --git a/tests/pytests/pkg/integration/test_salt_api.py b/tests/pytests/pkg/integration/test_salt_api.py index 8706ed9e630..e962fbe3221 100644 --- a/tests/pytests/pkg/integration/test_salt_api.py +++ b/tests/pytests/pkg/integration/test_salt_api.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_unless_on_linux, + pytest.mark.skip_on_windows, ] diff --git a/tests/pytests/pkg/integration/test_salt_call.py b/tests/pytests/pkg/integration/test_salt_call.py index fe3bc1728aa..c16ecb67481 100644 --- a/tests/pytests/pkg/integration/test_salt_call.py +++ b/tests/pytests/pkg/integration/test_salt_call.py @@ -3,10 +3,6 @@ import subprocess import pytest from pytestskipmarkers.utils import platform -pytestmark = [ - pytest.mark.skip_unless_on_linux, -] - def test_salt_call_local(salt_call_cli): """ diff --git a/tests/pytests/pkg/integration/test_salt_exec.py b/tests/pytests/pkg/integration/test_salt_exec.py index cad14b6ba02..2e28999d7c3 100644 --- a/tests/pytests/pkg/integration/test_salt_exec.py +++ b/tests/pytests/pkg/integration/test_salt_exec.py @@ -3,7 +3,7 @@ from sys import platform import pytest pytestmark = [ - pytest.mark.skip_unless_on_linux, + pytest.mark.skip_on_windows, ] diff --git a/tests/pytests/pkg/integration/test_salt_grains.py b/tests/pytests/pkg/integration/test_salt_grains.py index d8da338ec2c..2a609cb9ea0 100644 --- a/tests/pytests/pkg/integration/test_salt_grains.py +++ b/tests/pytests/pkg/integration/test_salt_grains.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_unless_on_linux, + pytest.mark.skip_on_windows, ] diff --git a/tests/pytests/pkg/integration/test_salt_key.py b/tests/pytests/pkg/integration/test_salt_key.py index 4e8fb33ff7c..87275a677fa 100644 --- a/tests/pytests/pkg/integration/test_salt_key.py +++ b/tests/pytests/pkg/integration/test_salt_key.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_unless_on_linux, + pytest.mark.skip_on_windows, ] diff --git a/tests/pytests/pkg/integration/test_salt_output.py b/tests/pytests/pkg/integration/test_salt_output.py index 3c008774473..b4d61044846 100644 --- a/tests/pytests/pkg/integration/test_salt_output.py +++ b/tests/pytests/pkg/integration/test_salt_output.py @@ -1,7 +1,7 @@ import pytest pytestmark = [ - pytest.mark.skip_unless_on_linux, + pytest.mark.skip_on_windows, ] diff --git a/tests/pytests/pkg/integration/test_salt_state_file.py b/tests/pytests/pkg/integration/test_salt_state_file.py index 8e6c98b6fc0..0c4804654cb 100644 --- a/tests/pytests/pkg/integration/test_salt_state_file.py +++ b/tests/pytests/pkg/integration/test_salt_state_file.py @@ -6,7 +6,7 @@ from pytestskipmarkers.utils import platform from saltfactories.utils.functional import MultiStateResult pytestmark = [ - pytest.mark.skip_unless_on_linux, + pytest.mark.skip_on_windows, ] diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 310d283f113..280b51624e2 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -8,7 +8,10 @@ import psutil import pytest from saltfactories.utils.tempfiles import temp_directory -pytestmark = [pytest.mark.skip_unless_on_linux] +pytestmark = [ + pytest.mark.skip_on_windows, + pytest.mark.skip_on_darwin, +] @pytest.fixture diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index 48cf7081702..cda02921108 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -5,11 +5,8 @@ import subprocess import pytest from pytestskipmarkers.utils import platform -pytestmark = [ - pytest.mark.skip_unless_on_linux, -] - +@pytest.mark.skip_on_windows def test_salt_version(version, install_salt): """ Test version output from salt --version @@ -37,6 +34,7 @@ def test_salt_version(version, install_salt): assert actual == expected +@pytest.mark.skip_on_windows def test_salt_versions_report_master(install_salt): """ Test running --versions-report on master @@ -57,6 +55,7 @@ def test_salt_versions_report_master(install_salt): ret.stdout.matcher.fnmatch_lines([f"*{py_version}*"]) +@pytest.mark.skip_on_windows def test_salt_versions_report_minion(salt_cli, salt_call_cli, salt_minion): """ Test running test.versions_report on minion @@ -140,6 +139,8 @@ def test_symlinks_created(version, symlink, install_salt): ret.stdout.matcher.fnmatch_lines([f"*{version}*"]) +@pytest.mark.skip_on_windows +@pytest.mark.skip_on_darwin def test_compare_pkg_versions_redhat_rc(version, install_salt): """ Test compare pkg versions for redhat RC packages. A tilde should be included From f3a70834418ef1770c8b945277eafd94dba788f0 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 14 Aug 2024 14:05:43 -0600 Subject: [PATCH 143/157] Adjusted tests for classic or relenv, as everything is relenv now --- tests/pytests/pkg/conftest.py | 28 ++----------------- .../pkg/downgrade/test_salt_downgrade.py | 2 -- .../integration/test_clean_zmq_teardown.py | 6 ---- tests/pytests/pkg/integration/test_pip.py | 8 ------ tests/pytests/pkg/integration/test_python.py | 3 -- .../pytests/pkg/integration/test_salt_user.py | 6 ---- tests/pytests/pkg/integration/test_version.py | 7 ----- .../pytests/pkg/upgrade/test_salt_upgrade.py | 14 ++++------ 8 files changed, 8 insertions(+), 66 deletions(-) diff --git a/tests/pytests/pkg/conftest.py b/tests/pytests/pkg/conftest.py index b5596bb4371..e29a5a8b8c4 100644 --- a/tests/pytests/pkg/conftest.py +++ b/tests/pytests/pkg/conftest.py @@ -350,18 +350,7 @@ def salt_master(salt_factories, install_salt, pkg_tests_account): master_script = False if platform.is_windows(): - if install_salt.classic: - master_script = True - if install_salt.relenv: - master_script = True - elif not install_salt.upgrade: - master_script = True - if ( - not install_salt.relenv - and install_salt.use_prev_version - and not install_salt.classic - ): - master_script = False + master_script = True if master_script: salt_factories.system_service = False @@ -370,10 +359,7 @@ def salt_master(salt_factories, install_salt, pkg_tests_account): scripts_dir.mkdir(exist_ok=True) salt_factories.scripts_dir = scripts_dir python_executable = install_salt.bin_dir / "Scripts" / "python.exe" - if install_salt.classic: - python_executable = install_salt.bin_dir / "python.exe" - if install_salt.relenv: - python_executable = install_salt.install_dir / "Scripts" / "python.exe" + python_executable = install_salt.install_dir / "Scripts" / "python.exe" salt_factories.python_executable = python_executable factory = salt_factories.salt_master_daemon( random_string("master-"), @@ -384,10 +370,6 @@ def salt_master(salt_factories, install_salt, pkg_tests_account): ) salt_factories.system_service = True else: - - if install_salt.classic and platform.is_darwin(): - os.environ["PATH"] += ":/opt/salt/bin" - factory = salt_factories.salt_master_daemon( random_string("master-"), defaults=config_defaults, @@ -458,12 +440,6 @@ def salt_minion(salt_factories, salt_master, install_salt): ) config_overrides["winrepo_source_dir"] = r"salt://win/repo_ng" - if install_salt.classic and platform.is_windows(): - salt_factories.python_executable = None - - if install_salt.classic and platform.is_darwin(): - os.environ["PATH"] += ":/opt/salt/bin" - factory = salt_master.salt_minion_daemon( minion_id, overrides=config_overrides, diff --git a/tests/pytests/pkg/downgrade/test_salt_downgrade.py b/tests/pytests/pkg/downgrade/test_salt_downgrade.py index 251804530b0..a195bb880c7 100644 --- a/tests/pytests/pkg/downgrade/test_salt_downgrade.py +++ b/tests/pytests/pkg/downgrade/test_salt_downgrade.py @@ -98,8 +98,6 @@ def test_salt_downgrade_minion(salt_call_cli, install_salt): bin_file = install_salt.install_dir / "salt-call.bat" else: bin_file = install_salt.install_dir / "salt-call.exe" - elif platform.is_darwin() and install_salt.classic: - bin_file = install_salt.bin_dir / "salt-call" ret = install_salt.proc.run(bin_file, "--version") assert ret.returncode == 0 diff --git a/tests/pytests/pkg/integration/test_clean_zmq_teardown.py b/tests/pytests/pkg/integration/test_clean_zmq_teardown.py index 309493e69aa..d1dbe325ab2 100644 --- a/tests/pytests/pkg/integration/test_clean_zmq_teardown.py +++ b/tests/pytests/pkg/integration/test_clean_zmq_teardown.py @@ -12,12 +12,6 @@ pytestmark = [ log = logging.getLogger(__name__) -@pytest.fixture(autouse=True) -def _skip_on_non_relenv(install_salt): - if not install_salt.relenv: - pytest.skip("This test is for relenv versions of salt") - - def test_check_no_import_error(salt_call_cli, salt_master): """ Test that we don't have any errors on teardown of python when using a py-rendered sls file diff --git a/tests/pytests/pkg/integration/test_pip.py b/tests/pytests/pkg/integration/test_pip.py index 849dbbbfb8b..3dde96ebb7d 100644 --- a/tests/pytests/pkg/integration/test_pip.py +++ b/tests/pytests/pkg/integration/test_pip.py @@ -74,8 +74,6 @@ def test_pip_install_extras(shell, install_salt, extras_pypath_bin): """ Test salt-pip installs into the correct directory """ - if not install_salt.relenv: - pytest.skip("The extras directory is only in relenv versions") dep = "pep8" extras_keyword = "extras-3" if platform.is_windows(): @@ -125,11 +123,7 @@ def test_pip_non_root( pypath, pkg_tests_account_environ, ): - if install_salt.classic: - pytest.skip("We can install non-root for classic packages") check_path = extras_pypath_bin / "pep8" - if not install_salt.relenv and not install_salt.classic: - check_path = pypath / "pep8" # We should be able to issue a --help without being root ret = subprocess.run( install_salt.binary_paths["salt"] + ["--help"], @@ -179,8 +173,6 @@ def test_pip_install_salt_extension_in_extras(install_salt, extras_pypath, shell Test salt-pip installs into the correct directory and the salt extension is properly loaded. """ - if not install_salt.relenv: - pytest.skip("The extras directory is only in relenv versions") dep = "salt-analytics-framework" dep_version = "0.1.0" diff --git a/tests/pytests/pkg/integration/test_python.py b/tests/pytests/pkg/integration/test_python.py index 9b16cea3796..77d2a82a16c 100644 --- a/tests/pytests/pkg/integration/test_python.py +++ b/tests/pytests/pkg/integration/test_python.py @@ -6,9 +6,6 @@ import pytest @pytest.fixture def python_script_bin(install_salt): - # Tiamat builds run scripts via `salt python` - if not install_salt.relenv and not install_salt.classic: - return install_salt.binary_paths["python"][:1] + ["python"] return install_salt.binary_paths["python"] diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 280b51624e2..9e3d3f0de00 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -84,12 +84,6 @@ def pkg_paths_salt_user_exclusions(): return paths -@pytest.fixture(autouse=True) -def _skip_on_non_relenv(install_salt): - if not install_salt.relenv: - pytest.skip("The salt user only exists on relenv versions of salt") - - def test_salt_user_master(salt_master, install_salt): """ Test the correct user is running the Salt Master diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py index cda02921108..b1bee9d60af 100644 --- a/tests/pytests/pkg/integration/test_version.py +++ b/tests/pytests/pkg/integration/test_version.py @@ -39,9 +39,6 @@ def test_salt_versions_report_master(install_salt): """ Test running --versions-report on master """ - if not install_salt.relenv and not install_salt.classic: - pytest.skip("Unable to get the python version dynamically from tiamat builds") - test_bin = os.path.join(*install_salt.binary_paths["master"]) python_bin = os.path.join(*install_salt.binary_paths["python"]) ret = install_salt.proc.run(test_bin, "--versions-report") @@ -131,10 +128,6 @@ def test_symlinks_created(version, symlink, install_salt): """ Test symlinks created """ - if install_salt.classic: - pytest.skip("Symlinks not created for classic macos builds, we adjust the path") - if not install_salt.relenv and symlink == "spm": - symlink = "salt-spm" ret = install_salt.proc.run(pathlib.Path("/usr/local/sbin") / symlink, "--version") ret.stdout.matcher.fnmatch_lines([f"*{version}*"]) diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 79e7c259fb4..5bce37d6aeb 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -122,8 +122,7 @@ def test_salt_upgrade(salt_call_cli, install_salt): if not install_salt.upgrade: pytest.skip("Not testing an upgrade, do not run") - if install_salt.relenv: - original_py_version = install_salt.package_python_version() + original_py_version = install_salt.package_python_version() # Test pip install before an upgrade dep = "PyGithub==1.56.0" @@ -139,9 +138,8 @@ def test_salt_upgrade(salt_call_cli, install_salt): # pylint: disable=pointless-statement salt_test_upgrade - if install_salt.relenv: - new_py_version = install_salt.package_python_version() - if new_py_version == original_py_version: - # test pip install after an upgrade - use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) - assert "Authentication information could" in use_lib.stderr + new_py_version = install_salt.package_python_version() + if new_py_version == original_py_version: + # test pip install after an upgrade + use_lib = salt_call_cli.run("--local", "github.get_repo_info", repo) + assert "Authentication information could" in use_lib.stderr From cbcaf9fa2f441e84ba17d7c41f9ddb2bf43922b7 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 14 Aug 2024 15:44:01 -0600 Subject: [PATCH 144/157] Limit test to Linux which use systemctl --- tests/pytests/pkg/integration/test_enabled_disabled.py | 2 +- tests/pytests/pkg/integration/test_salt_ufw.py | 5 ++++- tests/pytests/pkg/integration/test_salt_user.py | 3 +-- tests/pytests/pkg/integration/test_systemd_config.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py index 43dd4d4366a..4cfa5d2adc1 100644 --- a/tests/pytests/pkg/integration/test_enabled_disabled.py +++ b/tests/pytests/pkg/integration/test_enabled_disabled.py @@ -2,7 +2,7 @@ import pytest from pytestskipmarkers.utils import platform -@pytest.mark.skip_on_windows(reason="Linux test only") +@pytest.mark.skip_unless_on_linux(reason="Linux test only") def test_services(install_salt, salt_call_cli): """ Check if Services are enabled/disabled diff --git a/tests/pytests/pkg/integration/test_salt_ufw.py b/tests/pytests/pkg/integration/test_salt_ufw.py index eebf0e2f014..0e0471aebf2 100644 --- a/tests/pytests/pkg/integration/test_salt_ufw.py +++ b/tests/pytests/pkg/integration/test_salt_ufw.py @@ -2,6 +2,10 @@ import pathlib import pytest +pytestmark = [ + pytest.mark.skip_unless_on_linux, +] + @pytest.fixture def salt_systemd_setup( @@ -26,7 +30,6 @@ def salt_systemd_setup( assert ret.returncode == 0 -@pytest.mark.skip_on_windows @pytest.mark.skip_if_binaries_missing("ufw") def test_salt_ufw(salt_systemd_setup, salt_call_cli, install_salt): """ diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py index 9e3d3f0de00..fb42ae3c9f6 100644 --- a/tests/pytests/pkg/integration/test_salt_user.py +++ b/tests/pytests/pkg/integration/test_salt_user.py @@ -9,8 +9,7 @@ import pytest from saltfactories.utils.tempfiles import temp_directory pytestmark = [ - pytest.mark.skip_on_windows, - pytest.mark.skip_on_darwin, + pytest.mark.skip_unless_on_linux, ] diff --git a/tests/pytests/pkg/integration/test_systemd_config.py b/tests/pytests/pkg/integration/test_systemd_config.py index 828e4413ad7..5f705eb2ee9 100644 --- a/tests/pytests/pkg/integration/test_systemd_config.py +++ b/tests/pytests/pkg/integration/test_systemd_config.py @@ -3,7 +3,7 @@ import subprocess import pytest pytestmark = [ - pytest.mark.skip_on_windows(reason="Linux test only"), + pytest.mark.skip_unless_on_linux, ] From 3cd7a62f3f378b94f244c3ea956b6c6ae966a96c Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 15 Aug 2024 09:44:36 -0600 Subject: [PATCH 145/157] Revised test due to reviewer comments --- tests/pytests/pkg/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/pytests/pkg/conftest.py b/tests/pytests/pkg/conftest.py index e29a5a8b8c4..258d794c89f 100644 --- a/tests/pytests/pkg/conftest.py +++ b/tests/pytests/pkg/conftest.py @@ -358,7 +358,6 @@ def salt_master(salt_factories, install_salt, pkg_tests_account): scripts_dir = salt_factories.root_dir / "Scripts" scripts_dir.mkdir(exist_ok=True) salt_factories.scripts_dir = scripts_dir - python_executable = install_salt.bin_dir / "Scripts" / "python.exe" python_executable = install_salt.install_dir / "Scripts" / "python.exe" salt_factories.python_executable = python_executable factory = salt_factories.salt_master_daemon( From 0d78611767b48aa0e145fa2e0a3a83c2de067d91 Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Tue, 23 Jul 2024 12:02:10 -0600 Subject: [PATCH 146/157] Fix win_wua to handle empty CDispatch objects --- changelog/66718.fixed.md | 2 ++ salt/utils/win_update.py | 16 +++++---- tests/pytests/unit/utils/test_win_update.py | 38 +++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 changelog/66718.fixed.md diff --git a/changelog/66718.fixed.md b/changelog/66718.fixed.md new file mode 100644 index 00000000000..8a4a15ebad4 --- /dev/null +++ b/changelog/66718.fixed.md @@ -0,0 +1,2 @@ +Fixed ``win_wua.available`` when some of the update objects are empty CDispatch +objects. The ``available`` function no longer crashes diff --git a/salt/utils/win_update.py b/salt/utils/win_update.py index dd54f213963..1c93c5b18ea 100644 --- a/salt/utils/win_update.py +++ b/salt/utils/win_update.py @@ -528,14 +528,18 @@ class WindowsUpdateAgent: found = updates.updates for update in self._updates: + # Some update objects seem to be empty or undefined. Those will be + # exposed here if they are missing these attributes + try: + if salt.utils.data.is_true(update.IsHidden) and skip_hidden: + continue - if salt.utils.data.is_true(update.IsHidden) and skip_hidden: - continue + if salt.utils.data.is_true(update.IsInstalled) and skip_installed: + continue - if salt.utils.data.is_true(update.IsInstalled) and skip_installed: - continue - - if salt.utils.data.is_true(update.IsMandatory) and skip_mandatory: + if salt.utils.data.is_true(update.IsMandatory) and skip_mandatory: + continue + except AttributeError: continue # Windows 10 build 2004 introduced some problems with the diff --git a/tests/pytests/unit/utils/test_win_update.py b/tests/pytests/unit/utils/test_win_update.py index a221ee31952..9939428c7ca 100644 --- a/tests/pytests/unit/utils/test_win_update.py +++ b/tests/pytests/unit/utils/test_win_update.py @@ -1,14 +1,52 @@ import pytest +try: + import win32com.client + + HAS_WIN32 = True +except ImportError: + HAS_WIN32 = False + import salt.utils.win_update as win_update from tests.support.mock import MagicMock, patch pytestmark = [ pytest.mark.windows_whitelisted, pytest.mark.skip_unless_on_windows, + pytest.mark.skipif(not HAS_WIN32, reason="Requires Win32 libraries"), ] +def test_available_no_updates(): + """ + Test installed when there are no updates on the system + """ + with patch("salt.utils.winapi.Com", autospec=True), patch( + "win32com.client.Dispatch", autospec=True + ), patch.object(win_update.WindowsUpdateAgent, "refresh", autospec=True): + wua = win_update.WindowsUpdateAgent(online=False) + wua._updates = [] + + available_updates = wua.available() + + assert available_updates.updates.Add.call_count == 0 + + +def test_available_no_updates_empty_objects(): + """ + Test installed when there are no updates on the system + """ + with patch("salt.utils.winapi.Com", autospec=True), patch( + "win32com.client.Dispatch", autospec=True + ), patch.object(win_update.WindowsUpdateAgent, "refresh", autospec=True): + wua = win_update.WindowsUpdateAgent(online=False) + wua._updates = [win32com.client.CDispatch, win32com.client.CDispatch] + + available_updates = wua.available() + + assert available_updates.updates.Add.call_count == 0 + + def test_installed_no_updates(): """ Test installed when there are no updates on the system From 671cdd9313f9cdeae6679cc63f2b0eb8d5ce2c39 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Thu, 8 Aug 2024 15:26:44 -0700 Subject: [PATCH 147/157] Migrate grains tests to pytest --- tests/filename_map.yml | 2 +- tests/integration/loader/test_ext_grains.py | 83 ------------------- tests/pytests/integration/loader/__init__.py | 0 .../integration/loader/test_ext_grains.py | 53 ++++++++++++ 4 files changed, 54 insertions(+), 84 deletions(-) delete mode 100644 tests/integration/loader/test_ext_grains.py create mode 100644 tests/pytests/integration/loader/__init__.py create mode 100644 tests/pytests/integration/loader/test_ext_grains.py diff --git a/tests/filename_map.yml b/tests/filename_map.yml index d4a2143d3be..e561f627cfd 100644 --- a/tests/filename_map.yml +++ b/tests/filename_map.yml @@ -211,8 +211,8 @@ salt/config/*: - pytests.unit.config.test__validate_opts salt/loader/*: - - integration.loader.test_ext_grains - integration.loader.test_ext_modules + - pytests.integration.loader.test_ext_grains - pytests.functional.loader.test_loader - pytests.functional.loader.test_loaded_base_name diff --git a/tests/integration/loader/test_ext_grains.py b/tests/integration/loader/test_ext_grains.py deleted file mode 100644 index 242519aa3f4..00000000000 --- a/tests/integration/loader/test_ext_grains.py +++ /dev/null @@ -1,83 +0,0 @@ -""" - integration.loader.ext_grains - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Test Salt's loader regarding external grains -""" - -import os -import time - -import pytest - -import salt.config -import salt.loader -from tests.support.case import ModuleCase -from tests.support.runtests import RUNTIME_VARS - - -@pytest.mark.windows_whitelisted -class LoaderGrainsTest(ModuleCase): - """ - Test the loader standard behavior with external grains - """ - - # def setUp(self): - # self.opts = minion_config(None) - # self.opts['disable_modules'] = ['pillar'] - # self.opts['grains'] = grains(self.opts) - - @pytest.mark.slow_test - def test_grains_overwrite(self): - # Force a grains sync - self.run_function("saltutil.sync_grains") - # To avoid a race condition on Windows, we need to make sure the - # `test_custom_grain2.py` file is present in the _grains directory - # before trying to get the grains. This test may execute before the - # minion has finished syncing down the files it needs. - module = os.path.join( - RUNTIME_VARS.RUNTIME_CONFIGS["minion"]["cachedir"], - "files", - "base", - "_grains", - "custom_grain2.py", - ) - tries = 0 - while not os.path.exists(module): - tries += 1 - if tries > 60: - self.fail( - "Failed to found custom grains module in cache path {}".format( - module - ) - ) - break - time.sleep(1) - grains = self.run_function("grains.items") - - # Check that custom grains are overwritten - self.assertEqual({"k2": "v2"}, grains["a_custom"]) - - -@pytest.mark.skip(reason="needs a way to reload minion after config change") -@pytest.mark.windows_whitelisted -class LoaderGrainsMergeTest(ModuleCase): - """ - Test the loader deep merge behavior with external grains - """ - - def setUp(self): - # XXX: This seems like it should become a unit test instead - self.opts = salt.config.minion_config(None) - self.opts["grains_deep_merge"] = True - self.assertTrue(self.opts["grains_deep_merge"]) - self.opts["disable_modules"] = ["pillar"] - __grains__ = salt.loader.grains(self.opts) - - def test_grains_merge(self): - __grain__ = self.run_function("grains.item", ["a_custom"]) - - # Check that the grain is present - self.assertIn("a_custom", __grain__) - # Check that the grains are merged - self.assertEqual({"k1": "v1", "k2": "v2"}, __grain__["a_custom"]) diff --git a/tests/pytests/integration/loader/__init__.py b/tests/pytests/integration/loader/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/pytests/integration/loader/test_ext_grains.py b/tests/pytests/integration/loader/test_ext_grains.py new file mode 100644 index 00000000000..227859db03f --- /dev/null +++ b/tests/pytests/integration/loader/test_ext_grains.py @@ -0,0 +1,53 @@ +import pytest + +from tests.conftest import FIPS_TESTRUN + + +def test_grains_overwrite(salt_cli, salt_master, salt_minion): + assert not salt_minion.config.get("grains_deep_merge", False) + # Force a grains sync + salt_cli.run("saltutil.sync_grains", minion_tgt=salt_minion.id) + + # XXX: This should no longer be neede because of using salt_cli.run. + # To avoid a race condition on Windows, we need to make sure the + # `test_custom_grain2.py` file is present in the _grains directory + # before trying to get the grains. This test may execute before the + # minion has finished syncing down the files it needs. + # module = os.path.join( + # salt_minion.config["cachedir"], + # "files", + # "base", + # "_grains", + # "custom_grain2.py", + # ) + # assert os.path.exists(module) + + # Check that custom grains are overwritten + ret = salt_cli.run("grains.items", minion_tgt=salt_minion.id) + assert ret.data["a_custom"] == {"k2": "v2"} + + +def test_grains_merge(salt_cli, salt_master): + minion = salt_master.salt_minion_daemon( + "test_grains_merge", + overrides={ + "grains_deep_merge": True, + # Grains in the minon config won't get merged. + # "grains": {"a_custom": {"k1": "v1"}}, + "fips_mode": FIPS_TESTRUN, + "encryption_algorithm": "OAEP-SHA224" if FIPS_TESTRUN else "OAEP-SHA1", + "signing_algorithm": "PKCS1v15-SHA224" if FIPS_TESTRUN else "PKCS1v15-SHA1", + }, + ) + minion.after_terminate( + pytest.helpers.remove_stale_minion_key, salt_master, minion.id + ) + content = """ + def grain(): + return {"a_custom": {"k1": "v1"}} + """ + with salt_master.state_tree.base.temp_file("_grains/tempcustom.py", content): + with minion.started(): + salt_cli.run("saltutil.sync_grains", minion_tgt=minion.id) + ret = salt_cli.run("grains.item", "a_custom", minion_tgt=minion.id) + assert ret.data["a_custom"] == {"k1": "v1", "k2": "v2"} From e987ff4c019eae7eb0cdffa6e2b4680ef5cc39ae Mon Sep 17 00:00:00 2001 From: Shane Lee Date: Tue, 23 Jul 2024 15:08:55 -0600 Subject: [PATCH 148/157] Fix status.master to detect master properly --- changelog/66716.fixed.md | 2 ++ salt/modules/win_status.py | 12 ++++++++++-- tests/pytests/unit/modules/test_win_status.py | 8 +++++--- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 changelog/66716.fixed.md diff --git a/changelog/66716.fixed.md b/changelog/66716.fixed.md new file mode 100644 index 00000000000..f3ad42f8edf --- /dev/null +++ b/changelog/66716.fixed.md @@ -0,0 +1,2 @@ +Fixed an issue where ``status.master`` wasn't detecting a connection to the +specified master properly diff --git a/salt/modules/win_status.py b/salt/modules/win_status.py index 2becc4cb19b..41b59bf11f6 100644 --- a/salt/modules/win_status.py +++ b/salt/modules/win_status.py @@ -497,8 +497,16 @@ def _get_connected_ips(port): for conn in conns: if conn.status == psutil.CONN_ESTABLISHED: - if conn.laddr.port == port: - connected_ips.add(conn.laddr.ip) + if conn.raddr.port == port: + log.debug( + "%s %s:%s --> %s:%s", + conn.status, + conn.laddr.ip, + conn.laddr.port, + conn.raddr.ip, + conn.raddr.port, + ) + connected_ips.add(conn.raddr.ip) return connected_ips diff --git a/tests/pytests/unit/modules/test_win_status.py b/tests/pytests/unit/modules/test_win_status.py index c941b9ccfa1..236e164935b 100644 --- a/tests/pytests/unit/modules/test_win_status.py +++ b/tests/pytests/unit/modules/test_win_status.py @@ -16,9 +16,11 @@ def test__get_connected_ips(): conns = psutil.net_connections() for conn in conns: if conn.status == psutil.CONN_ESTABLISHED: - ip = conn.laddr.ip - port = conn.laddr.port + ip = conn.raddr.ip + port = conn.raddr.port break assert port is not None assert ip is not None - assert win_status._get_connected_ips(port) == {ip} + # Since this may return more than one IP, let's make sure our test IP is in + # the list of IPs + assert ip in win_status._get_connected_ips(port) From 4e8fe71a80242b452e3e7314d3e14580cde77998 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Thu, 15 Aug 2024 23:19:17 -0700 Subject: [PATCH 149/157] Skip pkg tests that need new golden image --- tests/pytests/functional/states/test_pkg.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/pytests/functional/states/test_pkg.py b/tests/pytests/functional/states/test_pkg.py index f1980abf20c..8bfac258966 100644 --- a/tests/pytests/functional/states/test_pkg.py +++ b/tests/pytests/functional/states/test_pkg.py @@ -249,10 +249,13 @@ def test_pkg_002_installed_with_version(PKG_TARGETS, states, latest_version): @pytest.mark.requires_salt_states("pkg.installed", "pkg.removed") @pytest.mark.slow_test -def test_pkg_003_installed_multipkg(caplog, PKG_TARGETS, modules, states): +def test_pkg_003_installed_multipkg(caplog, PKG_TARGETS, modules, states, grains): """ This is a destructive test as it installs and then removes two packages """ + if grains["os_family"] == "Arch": + pytest.skip("Arch needs refresh_db logic added to golden image") + version = modules.pkg.version(*PKG_TARGETS) # If this assert fails, we need to find new targets, this test needs to @@ -274,10 +277,14 @@ def test_pkg_003_installed_multipkg(caplog, PKG_TARGETS, modules, states): @pytest.mark.usefixtures("VERSION_SPEC_SUPPORTED") @pytest.mark.requires_salt_states("pkg.installed", "pkg.removed") @pytest.mark.slow_test -def test_pkg_004_installed_multipkg_with_version(PKG_TARGETS, latest_version, states): +def test_pkg_004_installed_multipkg_with_version( + PKG_TARGETS, latest_version, states, grains +): """ This is a destructive test as it installs and then removes two packages """ + if grains["os_family"] == "Arch": + pytest.skip("Arch needs refresh_db logic added to golden image") version = latest_version(PKG_TARGETS[0]) # If this assert fails, we need to find new targets, this test needs to @@ -886,6 +893,7 @@ def test_pkg_cap_003_installed_multipkg_with_version( latest_version, modules, states, + grains, ): """ This is a destructive test as it installs and then removes two packages From 650f6089e15c211454d281fca0edc90b2fcf81b7 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 20 Aug 2024 13:49:53 -0600 Subject: [PATCH 150/157] Adjust timeout from 2 to 3 hours for MacOS package tests --- .github/workflows/test-packages-action-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index 5e8c3069178..ec1dca2c56a 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -105,7 +105,7 @@ jobs: test: name: Test runs-on: ${{ inputs.runner }} - timeout-minutes: 120 # 2 Hours - More than this and something is wrong + timeout-minutes: 180 # 3 Hours - More than this and something is wrong (MacOS needs a little more time) needs: - generate-matrix strategy: From c9603c262599a003dc4387f244dc5313a31fac3b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 21 Aug 2024 09:32:52 -0600 Subject: [PATCH 151/157] Bump to get rebuild --- .github/workflows/test-packages-action-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index ec1dca2c56a..699b33c7151 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -105,7 +105,7 @@ jobs: test: name: Test runs-on: ${{ inputs.runner }} - timeout-minutes: 180 # 3 Hours - More than this and something is wrong (MacOS needs a little more time) + timeout-minutes: 181 # 3 Hours - More than this and something is wrong (MacOS needs a little more time) needs: - generate-matrix strategy: From 3fea06f16d3c4c323fc9a5d67cce9ccf6ef01df3 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 21 Aug 2024 14:25:20 -0600 Subject: [PATCH 152/157] MacOS Test time limit is now 2 & 1/2 hours --- .github/workflows/test-packages-action-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index 699b33c7151..aca0b4cc244 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -105,7 +105,7 @@ jobs: test: name: Test runs-on: ${{ inputs.runner }} - timeout-minutes: 181 # 3 Hours - More than this and something is wrong (MacOS needs a little more time) + timeout-minutes: 150 # 2 & 1/2 Hours - More than this and something is wrong (MacOS needs a little more time) needs: - generate-matrix strategy: From 3ae69b96911824ddef4b7bcec76e3f0dc7e0afe4 Mon Sep 17 00:00:00 2001 From: Alexey Murz Korepov Date: Sun, 25 Apr 2021 07:44:50 +0300 Subject: [PATCH 153/157] Option no_spaces to remove spaces in separator Added new option `no_spaces` that controls adding spaces around separator in ini file. --- salt/modules/ini_manage.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/salt/modules/ini_manage.py b/salt/modules/ini_manage.py index f5aff8881e2..0cc62afb6fe 100644 --- a/salt/modules/ini_manage.py +++ b/salt/modules/ini_manage.py @@ -388,12 +388,14 @@ def get_ini(file_name, separator="=", encoding=None): class _Section(OrderedDict): - def __init__(self, name, inicontents="", separator="=", commenter="#"): + def __init__(self, name, inicontents="", separator="=", commenter="#", no_spaces=False): super().__init__(self) self.name = name self.inicontents = inicontents self.sep = separator self.com = commenter + if not no_spaces = + self.sep = ' ' + self.sep + ' ' opt_regx_prefix = r"(\s*)(.+?)\s*" opt_regx_suffix = r"\s*(.*)\s*" @@ -517,11 +519,10 @@ class _Section(OrderedDict): elif isinstance(value, _Section): sections_dict.update({name: value}) # Key / Value pairs - # Adds spaces between the separator else: yield "{}{}{}{}".format( name, - f" {self.sep} " if self.sep != " " else self.sep, + self.sep, value, os.linesep, ) From 7faee48ef3c501f066c3311c2cf745cb3035b33a Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 21 Aug 2024 14:15:23 -0600 Subject: [PATCH 154/157] Add an option to ini.set_option Adds an new option named ``no_spaces`` to the ini.set_option function that allows the user to deteremine whether the separator (``=``) should be wrapped with spaces or not. --- changelog/33669.added.md | 3 + salt/modules/ini_manage.py | 75 +++++++++++----- tests/pytests/unit/modules/test_ini_manage.py | 89 +++++++++++-------- 3 files changed, 108 insertions(+), 59 deletions(-) create mode 100644 changelog/33669.added.md diff --git a/changelog/33669.added.md b/changelog/33669.added.md new file mode 100644 index 00000000000..45fe6ead2ba --- /dev/null +++ b/changelog/33669.added.md @@ -0,0 +1,3 @@ +Issue #33669: Fixes an issue with the ``ini_managed`` execution module +where it would always wrap the separator with spaces. Adds a new parameter +named ``no_spaces`` that will not warp the separator with spaces. diff --git a/salt/modules/ini_manage.py b/salt/modules/ini_manage.py index 0cc62afb6fe..d2b6d7656d4 100644 --- a/salt/modules/ini_manage.py +++ b/salt/modules/ini_manage.py @@ -37,7 +37,7 @@ COM_REGX = re.compile(r"^\s*(#|;)\s*(.*)") INDENTED_REGX = re.compile(r"(\s+)(.*)") -def set_option(file_name, sections=None, separator="=", encoding=None): +def set_option(file_name, sections=None, separator="=", encoding=None, no_spaces=False): """ Edit an ini file, replacing one or more sections. Returns a dictionary containing the changes made. @@ -66,6 +66,14 @@ def set_option(file_name, sections=None, separator="=", encoding=None): .. versionadded:: 3006.6 + no_spaces (bool): + A bool value that specifies if the separator will be wrapped with + spaces. This parameter was added to have the ability to not wrap the + separator with spaces. Default is ``False``, which maintains + backwards compatibility. + + .. versionadded:: 3006.10 + Returns: dict: A dictionary representing the changes made to the ini file @@ -88,7 +96,9 @@ def set_option(file_name, sections=None, separator="=", encoding=None): """ sections = sections or {} - inifile = _Ini.get_ini_file(file_name, separator=separator, encoding=encoding) + inifile = _Ini.get_ini_file( + file_name, separator=separator, encoding=encoding, no_spaces=no_spaces + ) changes = inifile.update(sections) inifile.flush() return changes @@ -388,20 +398,19 @@ def get_ini(file_name, separator="=", encoding=None): class _Section(OrderedDict): - def __init__(self, name, inicontents="", separator="=", commenter="#", no_spaces=False): + def __init__( + self, name, inicontents="", separator="=", commenter="#", no_spaces=False + ): super().__init__(self) self.name = name self.inicontents = inicontents self.sep = separator self.com = commenter - if not no_spaces = - self.sep = ' ' + self.sep + ' ' + self.no_spaces = no_spaces opt_regx_prefix = r"(\s*)(.+?)\s*" opt_regx_suffix = r"\s*(.*)\s*" - self.opt_regx_str = r"{}(\{}){}".format( - opt_regx_prefix, self.sep, opt_regx_suffix - ) + self.opt_regx_str = rf"{opt_regx_prefix}(\{self.sep}){opt_regx_suffix}" self.opt_regx = re.compile(self.opt_regx_str) def refresh(self, inicontents=None): @@ -477,7 +486,11 @@ class _Section(OrderedDict): # Ensure the value is either a _Section or a string if isinstance(value, (dict, OrderedDict)): sect = _Section( - name=key, inicontents="", separator=self.sep, commenter=self.com + name=key, + inicontents="", + separator=self.sep, + commenter=self.com, + no_spaces=self.no_spaces, ) sect.update(value) value = sect @@ -509,7 +522,7 @@ class _Section(OrderedDict): return changes def gen_ini(self): - yield "{0}[{1}]{0}".format(os.linesep, self.name) + yield f"{os.linesep}[{self.name}]{os.linesep}" sections_dict = OrderedDict() for name, value in self.items(): # Handle Comment Lines @@ -520,12 +533,19 @@ class _Section(OrderedDict): sections_dict.update({name: value}) # Key / Value pairs else: - yield "{}{}{}{}".format( - name, - self.sep, - value, - os.linesep, - ) + # multiple spaces will be a single space + if all(c == " " for c in self.sep): + self.sep = " " + # Default is to add spaces + if self.no_spaces: + if self.sep != " ": + # We only strip whitespace if the delimiter is not a space + self.sep = self.sep.strip() + else: + if self.sep != " ": + # We only add spaces if the delimiter itself is not a space + self.sep = f" {self.sep.strip()} " + yield f"{name}{self.sep}{value}{os.linesep}" for name, value in sections_dict.items(): yield from value.gen_ini() @@ -558,15 +578,26 @@ class _Section(OrderedDict): class _Ini(_Section): def __init__( - self, name, inicontents="", separator="=", commenter="#", encoding=None + self, + name, + inicontents="", + separator="=", + commenter="#", + encoding=None, + no_spaces=False, ): super().__init__( - self, inicontents=inicontents, separator=separator, commenter=commenter + self, + inicontents=inicontents, + separator=separator, + commenter=commenter, + no_spaces=no_spaces, ) self.name = name if encoding is None: encoding = __salt_system_encoding__ self.encoding = encoding + self.no_spaces = no_spaces def refresh(self, inicontents=None): if inicontents is None: @@ -613,7 +644,7 @@ class _Ini(_Section): self.name, "w", encoding=self.encoding ) as outfile: ini_gen = self.gen_ini() - next(ini_gen) + next(ini_gen) # Next to skip the file name ini_gen_list = list(ini_gen) # Avoid writing an initial line separator. if ini_gen_list: @@ -625,8 +656,10 @@ class _Ini(_Section): ) @staticmethod - def get_ini_file(file_name, separator="=", encoding=None): - inifile = _Ini(file_name, separator=separator, encoding=encoding) + def get_ini_file(file_name, separator="=", encoding=None, no_spaces=False): + inifile = _Ini( + file_name, separator=separator, encoding=encoding, no_spaces=no_spaces + ) inifile.refresh() return inifile diff --git a/tests/pytests/unit/modules/test_ini_manage.py b/tests/pytests/unit/modules/test_ini_manage.py index 499bae71e06..e226f34dfaa 100644 --- a/tests/pytests/unit/modules/test_ini_manage.py +++ b/tests/pytests/unit/modules/test_ini_manage.py @@ -94,24 +94,22 @@ def test_get_option(encoding, linesep, ini_file, ini_content): ) ini_file.write_bytes(content) - assert ( - ini.get_option(str(ini_file), "main", "test1", encoding=encoding) == "value 1" - ) - assert ( - ini.get_option(str(ini_file), "main", "test2", encoding=encoding) == "value 2" - ) - assert ( - ini.get_option(str(ini_file), "SectionB", "test1", encoding=encoding) - == "value 1B" - ) - assert ( - ini.get_option(str(ini_file), "SectionB", "test3", encoding=encoding) - == "value 3B" - ) - assert ( - ini.get_option(str(ini_file), "SectionC", "empty_option", encoding=encoding) - == "" + option = ini.get_option(str(ini_file), "main", "test1", encoding=encoding) + assert option == "value 1" + + option = ini.get_option(str(ini_file), "main", "test2", encoding=encoding) + assert option == "value 2" + + option = ini.get_option(str(ini_file), "SectionB", "test1", encoding=encoding) + assert option == "value 1B" + + option = ini.get_option(str(ini_file), "SectionB", "test3", encoding=encoding) + assert option == "value 3B" + + option = ini.get_option( + str(ini_file), "SectionC", "empty_option", encoding=encoding ) + assert option == "" @pytest.mark.parametrize("linesep", ["\r", "\n", "\r\n"]) @@ -249,11 +247,12 @@ def test_set_option(encoding, linesep, ini_file, ini_content): ) +@pytest.mark.parametrize("no_spaces", [True, False]) @pytest.mark.parametrize("linesep", ["\r", "\n", "\r\n"]) @pytest.mark.parametrize( "encoding", [None, "cp1252" if sys.platform == "win32" else "ISO-2022-JP"] ) -def test_empty_value(encoding, linesep, ini_file, ini_content): +def test_empty_value(encoding, linesep, no_spaces, ini_file, ini_content): """ Test empty value preserved after edit """ @@ -263,19 +262,23 @@ def test_empty_value(encoding, linesep, ini_file, ini_content): ini_file.write_bytes(content) ini.set_option( - str(ini_file), {"SectionB": {"test3": "new value 3B"}}, encoding=encoding + str(ini_file), + {"SectionB": {"test3": "new value 3B"}}, + encoding=encoding, + no_spaces=no_spaces, ) with salt.utils.files.fopen(str(ini_file), "r") as fp_: file_content = salt.utils.stringutils.to_unicode(fp_.read(), encoding=encoding) - expected = "{0}{1}{0}".format(os.linesep, "empty_option = ") + expected = f"{os.linesep}empty_option{'=' if no_spaces else ' = '}{os.linesep}" assert expected in file_content, "empty_option was not preserved" +@pytest.mark.parametrize("no_spaces", [True, False]) @pytest.mark.parametrize("linesep", ["\r", "\n", "\r\n"]) @pytest.mark.parametrize( "encoding", [None, "cp1252" if sys.platform == "win32" else "ISO-2022-JP"] ) -def test_empty_lines(encoding, linesep, ini_file, ini_content): +def test_empty_lines(encoding, linesep, no_spaces, ini_file, ini_content): """ Test empty lines preserved after edit """ @@ -289,42 +292,48 @@ def test_empty_lines(encoding, linesep, ini_file, ini_content): "# Comment on the first line", "", "# First main option", - "option1 = main1", + f"option1{'=' if no_spaces else ' = '}main1", "", "# Second main option", - "option2 = main2", + f"option2{'=' if no_spaces else ' = '}main2", "", "[main]", "# Another comment", - "test1 = value 1", + f"test1{'=' if no_spaces else ' = '}value 1", "", - "test2 = value 2", + f"test2{'=' if no_spaces else ' = '}value 2", "", "[SectionB]", - "test1 = value 1B", + f"test1{'=' if no_spaces else ' = '}value 1B", "", "# Blank line should be above", - "test3 = new value 3B", + f"test3{'=' if no_spaces else ' = '}new value 3B", "", "[SectionC]", "# The following option is empty", - "empty_option = ", + f"empty_option{'=' if no_spaces else ' = '}", "", ] ) ini.set_option( - str(ini_file), {"SectionB": {"test3": "new value 3B"}}, encoding=encoding + str(ini_file), + {"SectionB": {"test3": "new value 3B"}}, + encoding=encoding, + no_spaces=no_spaces, ) with salt.utils.files.fopen(str(ini_file), "r") as fp_: file_content = fp_.read() assert expected == file_content +@pytest.mark.parametrize("no_spaces", [True, False]) @pytest.mark.parametrize("linesep", ["\r", "\n", "\r\n"]) @pytest.mark.parametrize( "encoding", [None, "cp1252" if sys.platform == "win32" else "ISO-2022-JP"] ) -def test_empty_lines_multiple_edits(encoding, linesep, ini_file, ini_content): +def test_empty_lines_multiple_edits( + encoding, linesep, no_spaces, ini_file, ini_content +): """ Test empty lines preserved after multiple edits """ @@ -337,6 +346,7 @@ def test_empty_lines_multiple_edits(encoding, linesep, ini_file, ini_content): str(ini_file), {"SectionB": {"test3": "this value will be edited two times"}}, encoding=encoding, + no_spaces=no_spaces, ) expected = os.linesep.join( @@ -344,31 +354,34 @@ def test_empty_lines_multiple_edits(encoding, linesep, ini_file, ini_content): "# Comment on the first line", "", "# First main option", - "option1 = main1", + f"option1{'=' if no_spaces else ' = '}main1", "", "# Second main option", - "option2 = main2", + f"option2{'=' if no_spaces else ' = '}main2", "", "[main]", "# Another comment", - "test1 = value 1", + f"test1{'=' if no_spaces else ' = '}value 1", "", - "test2 = value 2", + f"test2{'=' if no_spaces else ' = '}value 2", "", "[SectionB]", - "test1 = value 1B", + f"test1{'=' if no_spaces else ' = '}value 1B", "", "# Blank line should be above", - "test3 = new value 3B", + f"test3{'=' if no_spaces else ' = '}new value 3B", "", "[SectionC]", "# The following option is empty", - "empty_option = ", + f"empty_option{'=' if no_spaces else ' = '}", "", ] ) ini.set_option( - str(ini_file), {"SectionB": {"test3": "new value 3B"}}, encoding=encoding + str(ini_file), + {"SectionB": {"test3": "new value 3B"}}, + encoding=encoding, + no_spaces=no_spaces, ) with salt.utils.files.fopen(str(ini_file), "r") as fp_: file_content = fp_.read() From fb031ac41827392654e4967a07ac92f688c0fd97 Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 21 Aug 2024 14:22:14 -0600 Subject: [PATCH 155/157] Add warning to docs --- salt/modules/ini_manage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/salt/modules/ini_manage.py b/salt/modules/ini_manage.py index d2b6d7656d4..b676451c631 100644 --- a/salt/modules/ini_manage.py +++ b/salt/modules/ini_manage.py @@ -72,6 +72,10 @@ def set_option(file_name, sections=None, separator="=", encoding=None, no_spaces separator with spaces. Default is ``False``, which maintains backwards compatibility. + .. warning:: + This will affect all key/value pairs in the ini file, not just + the specific value being set. + .. versionadded:: 3006.10 Returns: From d0d820673f1dbb36a8f5b67e7c44f1fd4387d64d Mon Sep 17 00:00:00 2001 From: twangboy Date: Wed, 21 Aug 2024 15:30:19 -0600 Subject: [PATCH 156/157] Add encoding and no_spaces options to state --- salt/modules/ini_manage.py | 8 +- salt/states/ini_manage.py | 247 +++++++++++++++++++++++++++++++------ 2 files changed, 214 insertions(+), 41 deletions(-) diff --git a/salt/modules/ini_manage.py b/salt/modules/ini_manage.py index b676451c631..6935cf2c0be 100644 --- a/salt/modules/ini_manage.py +++ b/salt/modules/ini_manage.py @@ -67,10 +67,10 @@ def set_option(file_name, sections=None, separator="=", encoding=None, no_spaces .. versionadded:: 3006.6 no_spaces (bool): - A bool value that specifies if the separator will be wrapped with - spaces. This parameter was added to have the ability to not wrap the - separator with spaces. Default is ``False``, which maintains - backwards compatibility. + A bool value that specifies that the key/value separator will be + wrapped with spaces. This parameter was added to have the ability to + not wrap the separator with spaces. Default is ``False``, which + maintains backwards compatibility. .. warning:: This will affect all key/value pairs in the ini file, not just diff --git a/salt/states/ini_manage.py b/salt/states/ini_manage.py index 9851d792734..eec3ab843f6 100644 --- a/salt/states/ini_manage.py +++ b/salt/states/ini_manage.py @@ -21,8 +21,61 @@ def __virtual__(): return __virtualname__ if "ini.set_option" in __salt__ else False -def options_present(name, sections=None, separator="=", strict=False): +def options_present( + name, sections=None, separator="=", strict=False, encoding=None, no_spaces=False +): """ + Set or create a key/value pair in an ``ini`` file. Options present in the + ini file and not specified in the sections dict will be untouched, unless + the ``strict: True`` flag is used. + + Sections that do not exist will be created. + + Args: + + name (str): + The path to the ini file + + sections (dict): + A dictionary of sections and key/value pairs that will be used to + update the ini file. Other sections and key/value pairs in the ini + file will be untouched unless ``strict: True`` is passed. + + separator (str): + The character used to separate keys and values. Standard ini files + use the "=" character. The default is ``=``. + + strict (bool): + A boolean value that specifies that the ``sections`` dictionary + contains all settings in the ini file. ``True`` will create an ini + file with only the values specified in ``sections``. ``False`` will + append or update values in an existing ini file and leave the rest + untouched. + + encoding (str): + A string value representing encoding of the target ini file. If + ``None`` is passed, it uses the system default which is likely + ``utf-8``. Default is ``None`` + + .. versionadded:: 3006.10 + + no_spaces (bool): + A bool value that specifies that the key/value separator will be + wrapped with spaces. This parameter was added to have the ability to + not wrap the separator with spaces. Default is ``False``, which + maintains backwards compatibility. + + .. warning:: + This will affect all key/value pairs in the ini file, not just + the specific value being set. + + .. versionadded:: 3006.10 + + Returns: + dict: A dictionary containing list of changes made + + Example: + .. code-block:: yaml /home/saltminion/api-paste.ini: @@ -35,12 +88,6 @@ def options_present(name, sections=None, separator="=", strict=False): secondoption: 'secondvalue' test1: testkey1: 'testval121' - - options present in file and not specified in sections - dict will be untouched, unless `strict: True` flag is - used - - changes dict will contain the list of changes made """ ret = { "name": name, @@ -58,7 +105,9 @@ def options_present(name, sections=None, separator="=", strict=False): for sname, sbody in sections.items(): if not isinstance(sbody, (dict, OrderedDict)): options.update({sname: sbody}) - cur_ini = __salt__["ini.get_ini"](name, separator) + cur_ini = __salt__["ini.get_ini"]( + file_name=name, separator=separator, encoding=encoding + ) original_top_level_opts = {} original_sections = {} for key, val in cur_ini.items(): @@ -78,7 +127,13 @@ def options_present(name, sections=None, separator="=", strict=False): ret["comment"] += f"Changed key {option}.\n" ret["result"] = None else: - options_updated = __salt__["ini.set_option"](name, options, separator) + options_updated = __salt__["ini.set_option"]( + file_name=name, + sections=options, + separator=separator, + encoding=encoding, + no_spaces=no_spaces, + ) changes.update(options_updated) if strict: for opt_to_remove in set(original_top_level_opts).difference(options): @@ -87,7 +142,11 @@ def options_present(name, sections=None, separator="=", strict=False): ret["result"] = None else: __salt__["ini.remove_option"]( - name, None, opt_to_remove, separator + file_name=name, + section=None, + option=opt_to_remove, + separator=separator, + encoding=encoding, ) changes.update( { @@ -119,7 +178,11 @@ def options_present(name, sections=None, separator="=", strict=False): ret["result"] = None else: __salt__["ini.remove_option"]( - name, section_name, key_to_remove, separator + file_name=name, + section=section_name, + option=key_to_remove, + separator=separator, + encoding=encoding, ) changes[section_name].update({key_to_remove: ""}) changes[section_name].update( @@ -140,7 +203,11 @@ def options_present(name, sections=None, separator="=", strict=False): ret["result"] = None else: options_updated = __salt__["ini.set_option"]( - name, {section_name: section_body}, separator + file_name=name, + sections={section_name: section_body}, + separator=separator, + encoding=encoding, + no_spaces=no_spaces, ) if options_updated: changes[section_name].update(options_updated[section_name]) @@ -148,7 +215,13 @@ def options_present(name, sections=None, separator="=", strict=False): del changes[section_name] else: if not __opts__["test"]: - changes = __salt__["ini.set_option"](name, sections, separator) + changes = __salt__["ini.set_option"]( + file_name=name, + sections=sections, + separator=separator, + encoding=encoding, + no_spaces=no_spaces, + ) except (OSError, KeyError) as err: ret["comment"] = f"{err}" ret["result"] = False @@ -165,8 +238,37 @@ def options_present(name, sections=None, separator="=", strict=False): return ret -def options_absent(name, sections=None, separator="="): +def options_absent(name, sections=None, separator="=", encoding=None): """ + Remove a key/value pair from an ini file. Key/value pairs present in the ini + file and not specified in sections dict will be untouched. + + Args: + + name (str): + The path to the ini file + + sections (dict): + A dictionary of sections and key/value pairs that will be removed + from the ini file. Other key/value pairs in the ini file will be + untouched. + + separator (str): + The character used to separate keys and values. Standard ini files + use the "=" character. The default is ``=``. + + encoding (str): + A string value representing encoding of the target ini file. If + ``None`` is passed, it uses the system default which is likely + ``utf-8``. Default is ``None`` + + .. versionadded:: 3006.10 + + Returns: + dict: A dictionary containing list of changes made + + Example: + .. code-block:: yaml /home/saltminion/api-paste.ini: @@ -178,11 +280,6 @@ def options_absent(name, sections=None, separator="="): - secondoption test1: - testkey1 - - options present in file and not specified in sections - dict will be untouched - - changes dict will contain the list of changes made """ ret = { "name": name, @@ -196,7 +293,12 @@ def options_absent(name, sections=None, separator="="): for section in sections or {}: section_name = " in section " + section if section else "" try: - cur_section = __salt__["ini.get_section"](name, section, separator) + cur_section = __salt__["ini.get_section"]( + file_name=name, + section=section, + separator=separator, + encoding=encoding, + ) except OSError as err: ret["comment"] = f"{err}" ret["result"] = False @@ -215,7 +317,13 @@ def options_absent(name, sections=None, separator="="): ret["result"] = None else: option = section - if not __salt__["ini.get_option"](name, None, option, separator): + if not __salt__["ini.get_option"]( + file_name=name, + section=None, + option=option, + separator=separator, + encoding=encoding, + ): ret["comment"] += f"Key {option} does not exist.\n" continue ret["comment"] += f"Deleted key {option}.\n" @@ -229,7 +337,11 @@ def options_absent(name, sections=None, separator="="): for key in keys: try: current_value = __salt__["ini.remove_option"]( - name, section, key, separator + file_name=name, + section=section, + option=key, + separator=separator, + encoding=encoding, ) except OSError as err: ret["comment"] = f"{err}" @@ -247,8 +359,38 @@ def options_absent(name, sections=None, separator="="): return ret -def sections_present(name, sections=None, separator="="): +def sections_present(name, sections=None, separator="=", encoding=None): """ + Add sections to an ini file. This will only create empty sections. To also + create key/value pairs, use options_present state. + + Args: + + name (str): + The path to the ini file + + sections (dict): + A dictionary of sections and key/value pairs that will be used to + update the ini file. Only the sections portion is used, key/value + pairs are ignored. To also set key/value pairs, use the + options_present state. + + separator (str): + The character used to separate keys and values. Standard ini files + use the "=" character. The default is ``=``. + + encoding (str): + A string value representing encoding of the target ini file. If + ``None`` is passed, it uses the system default which is likely + ``utf-8``. Default is ``None`` + + .. versionadded:: 3006.10 + + Returns: + dict: A dictionary containing list of changes made + + Example: + .. code-block:: yaml /home/saltminion/api-paste.ini: @@ -257,12 +399,6 @@ def sections_present(name, sections=None, separator="="): - sections: - section_one - section_two - - This will only create empty sections. To also create options, use - options_present state - - options present in file and not specified in sections will be deleted - changes dict will contain the sections that changed """ ret = { "name": name, @@ -274,7 +410,9 @@ def sections_present(name, sections=None, separator="="): ret["result"] = True ret["comment"] = "" try: - cur_ini = __salt__["ini.get_ini"](name, separator) + cur_ini = __salt__["ini.get_ini"]( + file_name=name, separator=separator, encoding=encoding + ) except OSError as err: ret["result"] = False ret["comment"] = f"{err}" @@ -293,7 +431,12 @@ def sections_present(name, sections=None, separator="="): for section_name in sections or []: section_to_update.update({section_name: {}}) try: - changes = __salt__["ini.set_option"](name, section_to_update, separator) + changes = __salt__["ini.set_option"]( + file_name=name, + section=section_to_update, + separator=separator, + encoding=encoding, + ) except OSError as err: ret["result"] = False ret["comment"] = f"{err}" @@ -307,8 +450,37 @@ def sections_present(name, sections=None, separator="="): return ret -def sections_absent(name, sections=None, separator="="): +def sections_absent(name, sections=None, separator="=", encoding=None): """ + Remove sections from the ini file. All key/value pairs in the section will + also be removed. + + Args: + + name (str): + The path to the ini file + + sections (dict): + A dictionary of sections and key/value pairs that will be used to + update the ini file. Other sections and key/value pairs in the ini + file will be untouched unless ``strict: True`` is passed. + + separator (str): + The character used to separate keys and values. Standard ini files + use the "=" character. The default is ``=``. + + encoding (str): + A string value representing encoding of the target ini file. If + ``None`` is passed, it uses the system default which is likely + ``utf-8``. Default is ``None`` + + .. versionadded:: 3006.6 + + Returns: + dict: A dictionary containing list of changes made + + Example: + .. code-block:: yaml /home/saltminion/api-paste.ini: @@ -317,9 +489,6 @@ def sections_absent(name, sections=None, separator="="): - sections: - test - test1 - - options present in file and not specified in sections will be deleted - changes dict will contain the sections that changed """ ret = { "name": name, @@ -331,7 +500,9 @@ def sections_absent(name, sections=None, separator="="): ret["result"] = True ret["comment"] = "" try: - cur_ini = __salt__["ini.get_ini"](name, separator) + cur_ini = __salt__["ini.get_ini"]( + file_name=name, separator=separator, encoding=encoding + ) except OSError as err: ret["result"] = False ret["comment"] = f"{err}" @@ -347,7 +518,9 @@ def sections_absent(name, sections=None, separator="="): return ret for section in sections or []: try: - cur_section = __salt__["ini.remove_section"](name, section, separator) + cur_section = __salt__["ini.remove_section"]( + file_name=name, section=section, separator=separator, encoding=encoding + ) except OSError as err: ret["result"] = False ret["comment"] = f"{err}" From 2536ff635bea80d377bb50a79da2ca50ba40a390 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Fri, 23 Aug 2024 14:35:41 -0700 Subject: [PATCH 157/157] Allow builds to proceed without coverage file --- .github/workflows/test-action-windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-action-windows.yml b/.github/workflows/test-action-windows.yml index e40354b9489..385b6eed95f 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -377,8 +377,8 @@ jobs: if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success' && job.status != 'cancelled' run: | nox --force-color -e create-xml-coverage-reports - mv artifacts/coverage/salt.xml artifacts/coverage/salt..${{ inputs.distro-slug }}..${{ inputs.nox-session }}.xml - mv artifacts/coverage/tests.xml artifacts/coverage/tests..${{ inputs.distro-slug }}..${{ inputs.nox-session }}.xml + mv artifacts/coverage/salt.xml artifacts/coverage/salt..${{ inputs.distro-slug }}..${{ inputs.nox-session }}.xml || true + mv artifacts/coverage/tests.xml artifacts/coverage/tests..${{ inputs.distro-slug }}..${{ inputs.nox-session }}.xml || true - name: Report Salt Code Coverage if: always() && inputs.skip-code-coverage == false && steps.download-coverage-artifacts.outcome == 'success'