From 9d8e348f0236bc6672e4aa14797e9027c1dad45d Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 30 Jul 2024 10:36:57 -0600 Subject: [PATCH 01/20] 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 a2ac44e2ae93..000000000000 --- 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 750887fde1e8a6549184809a0bc2cf64d883da65 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 30 Jul 2024 10:47:39 -0600 Subject: [PATCH 02/20] 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 000000000000..aca1198858e0 --- /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 516caba67c9ed7b456806e6bfb0d33529d2b4bda Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 30 Jul 2024 14:53:38 -0600 Subject: [PATCH 03/20] 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 a1197778296b..794bfb10d1e0 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 raise_warning(_version_info_=(0, 16, 0)): 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 raise_named_version_warning(_version_info_=(0, 16, 0)): ), ): salt.utils.versions.warn_until( - "Hydrogen", + 2014, "Foo", _dont_call_warnings=True, _version_info_=(sys.maxsize, 16, 0), @@ -243,7 +243,7 @@ def raise_named_version_warning(_version_info_=(0, 16, 0)): 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 ef37ec91450917f744e3e4bd3cf6d13610eb1f6a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 1 Aug 2024 11:05:40 -0600 Subject: [PATCH 04/20] 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 a3206485f1d6..6d0a8c758540 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 a91bd08810f923dd4a278bf52e14b2b07426a868 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 1 Aug 2024 14:50:40 -0600 Subject: [PATCH 05/20] 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 6d0a8c758540..33250343703f 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 34d52a29fbe21e6ffde1e980c2094cec59cb4b4b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 2 Aug 2024 11:45:29 -0600 Subject: [PATCH 06/20] 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 20c851dceddb..e5005e869314 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -221,6 +221,10 @@ def _default_version(self): 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 @@ def _check_retcode(self, ret): 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 @@ def package_python_version(self): 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 @@ def stop_services(self): 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): "-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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 4d646104dc63b7bc636095648d31446b8df2136f Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 2 Aug 2024 15:35:28 -0600 Subject: [PATCH 07/20] 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 e5005e869314..037b8d69984a 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -220,9 +220,10 @@ def _default_version(self): 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 @@ 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}' 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 @@ def stop_services(self): 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 @@ def stop_services(self): # 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 @@ def install_previous(self, downgrade=False): ] 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 c2513f52d7d0b525bf67bf3aa53590ccad02ed5d Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 10:03:32 -0600 Subject: [PATCH 08/20] 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 33250343703f..1aeae6bf2ae2 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 037b8d69984a..81228be06445 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -591,10 +591,10 @@ 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}' 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 @@ def stop_services(self): 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 @@ def install_previous(self, downgrade=False): 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 072ec5ac79ee999540dc7a9597ef95b503fefb0a Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 12:12:16 -0600 Subject: [PATCH 09/20] 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 81228be06445..bc9371ca2bf9 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -638,26 +638,20 @@ def restart_services(self): ## 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 73807a7e4ed1478e32b37be5f04b8d68d87a32dc Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 13:47:03 -0600 Subject: [PATCH 10/20] 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 bc9371ca2bf9..d8a0da0c9271 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -222,10 +222,10 @@ def _default_version(self): 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 @@ def _check_retcode(self, ret): 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 @@ def package_python_version(self): 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 @@ def stop_services(self): ## 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 @@ def restart_services(self): ## 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): "-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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 d0c8ed5f8d87e8e772c2aa1bb3ceca309a37190b Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 13:53:50 -0600 Subject: [PATCH 11/20] 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 1aeae6bf2ae2..da925752d1b7 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 200bfb874c8a1bb396888bb457a5a80a538ae201 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 15:36:33 -0600 Subject: [PATCH 12/20] 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 da925752d1b7..b7e0d4d03218 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 aabb2329d26b2afc068bcee457cf26a36f5d7176 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 6 Aug 2024 10:59:32 -0600 Subject: [PATCH 13/20] 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 b7e0d4d03218..251804530b08 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 d8a0da0c9271..f519adcbd82f 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -220,12 +220,8 @@ def _default_version(self): 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 @@ def _check_retcode(self, ret): 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 @@ def package_python_version(self): 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): "-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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 3fe04f94c9a723a6dce1052c823cf8cc61451104 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 6 Aug 2024 14:56:58 -0600 Subject: [PATCH 14/20] 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 794bfb10d1e0..a1197778296b 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 raise_warning(_version_info_=(0, 16, 0)): 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 raise_named_version_warning(_version_info_=(0, 16, 0)): ), ): salt.utils.versions.warn_until( - 2014, + "Hydrogen", "Foo", _dont_call_warnings=True, _version_info_=(sys.maxsize, 16, 0), @@ -243,7 +243,7 @@ def raise_named_version_warning(_version_info_=(0, 16, 0)): 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 591a5dfa299e5a47cee2e286125a592ddd295522 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 7 Aug 2024 07:46:52 -0600 Subject: [PATCH 15/20] 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 f519adcbd82f..066db28921e2 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -837,14 +837,21 @@ def install_previous(self, downgrade=False): 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 9caf9f023e1b347b04a60f6da01160cd8e2d0cee Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 7 Aug 2024 09:33:28 -0600 Subject: [PATCH 16/20] 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 066db28921e2..1c21b4095d78 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -856,6 +856,16 @@ def install_previous(self, downgrade=False): 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 49426a9473edbe7fd6060845e50ac277871584d5 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Wed, 7 Aug 2024 11:03:02 -0600 Subject: [PATCH 17/20] 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 100918b72d59..a0563b08266b 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 1c21b4095d78..7b6c18ae5989 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -837,9 +837,9 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 6290fa02a0cab57e2eb11800de51dc57c5470d3d Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 07:39:14 -0600 Subject: [PATCH 18/20] 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 7b6c18ae5989..c86c83852953 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -31,6 +31,7 @@ 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 225bf46cb4c80fe0d5762d3d412635d5a6137206 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Thu, 8 Aug 2024 09:20:46 -0600 Subject: [PATCH 19/20] 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 c86c83852953..ae5efe4fd50a 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -838,6 +838,10 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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 ee4d07623579452db85cfab4cf115dc4153b7918 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Fri, 9 Aug 2024 13:20:04 -0600 Subject: [PATCH 20/20] 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 ce8b9569125d..82dd91389585 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 ac9e868a1dc7..b64e1117dc19 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 1fcec03349a1..e5818d707bcb 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 695496a31fc6..8df94c0cf59a 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 2d58958d020a..e2142dcaa6b7 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 c3d2ca7db3da..ae774c8c5da2 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 a83527ee15b9..c1f9e9183648 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 7fd5ffd488eb..f03ecc33041a 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 b6fc17085aea..f590604d2be9 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 e4dee258e06a..1c23b60c1818 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 533a506872c4..5805ca012b04 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 a7aca219fc53..deb11a5621f0 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 5830968b7c27..dee6d2f8a3bd 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 b03594486655..31444237bdad 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 c0a9ce436b38..5c9055f8c864 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 83a5207977d4..c154d4f98785 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 a124d4c40a78..0c6c573ae001 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 41265a081f7e..a2bc4b2d666f 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 03b9b6a2e882..8e5253ad65b2 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 de820b25b406..e59c9ccc427c 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 92138a595db1..a72f33cb2c92 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 00cdba1b2256..cbacf12301e8 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 594b8c106b76..583da473b1d7 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 3e67555b202e..9d490f6f8994 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 647fc725be98..8cc07e4db5d7 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 12a75bae3d96..d54f2e9281f8 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 f56f2ea6544a..1e830cd7cf3d 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 772d1601a6c4..8075f781b7d9 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 af27c5a56d20..03d521b7b0d9 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 a0563b08266b..59a04b451bcd 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 ae5efe4fd50a..066db28921e2 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -31,7 +31,6 @@ 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 @@ def install_previous(self, downgrade=False): 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 @@ def install_previous(self, downgrade=False): 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(