diff --git a/changelog/67765.fixed.md b/changelog/67765.fixed.md new file mode 100644 index 000000000000..10e44c28bccf --- /dev/null +++ b/changelog/67765.fixed.md @@ -0,0 +1 @@ +Added back support for init.d service scripts diff --git a/pkg/old/deb/salt-api.init b/pkg/debian/salt-api.init similarity index 100% rename from pkg/old/deb/salt-api.init rename to pkg/debian/salt-api.init diff --git a/pkg/old/deb/salt-master.init b/pkg/debian/salt-master.init similarity index 100% rename from pkg/old/deb/salt-master.init rename to pkg/debian/salt-master.init diff --git a/pkg/old/deb/salt-minion.init b/pkg/debian/salt-minion.init similarity index 100% rename from pkg/old/deb/salt-minion.init rename to pkg/debian/salt-minion.init diff --git a/pkg/old/deb/salt-syndic.init b/pkg/debian/salt-syndic.init similarity index 100% rename from pkg/old/deb/salt-syndic.init rename to pkg/debian/salt-syndic.init diff --git a/tests/pytests/pkg/upgrade/test_salt_upgrade.py b/tests/pytests/pkg/upgrade/test_salt_upgrade.py index 1f07014571b0..58b34ba9ab4d 100644 --- a/tests/pytests/pkg/upgrade/test_salt_upgrade.py +++ b/tests/pytests/pkg/upgrade/test_salt_upgrade.py @@ -1,4 +1,6 @@ import logging +import os +import subprocess import sys import time @@ -7,6 +9,8 @@ import pytest from pytestskipmarkers.utils import platform +import salt.utils.path + log = logging.getLogger(__name__) @@ -101,7 +105,7 @@ def salt_test_upgrade( new_minion_pids = _get_running_named_salt_pid(process_minion_name) new_master_pids = _get_running_named_salt_pid(process_master_name) - if sys.platform == "linux" and install_salt.distro_id not in ("ubuntu", "debian"): + if sys.platform == "linux": assert new_minion_pids assert new_master_pids assert new_minion_pids != old_minion_pids @@ -132,6 +136,55 @@ def _get_running_named_salt_pid(process_name): return pids +def test_salt_sysv_service_files(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 sys.platform != "linux": + pytest.skip("Not testing on a Linux platform, do not run") + + if not (salt.utils.path.which("dpkg") or salt.utils.path.which("rpm")): + pytest.skip("Not testing on a Debian or RedHat family platform, do not run") + + test_pkgs = install_salt.pkgs + for test_pkg_name in test_pkgs: + test_pkg_basename = os.path.basename(test_pkg_name) + # Debian/Ubuntu name typically salt-minion_300xxxxxx + # Redhat name typically salt-minion-300xxxxxx + test_pkg_basename_dash_underscore = test_pkg_basename.split("300")[0] + test_pkg_basename_adj = test_pkg_basename_dash_underscore[:-1] + if test_pkg_basename_adj in ( + "salt-minion", + "salt-master", + "salt-syndic", + "salt-api", + ): + test_initd_name = f"/etc/init.d/{test_pkg_basename_adj}" + if salt.utils.path.which("dpkg"): + proc = subprocess.run( + ["dpkg", "-c", f"{test_pkg_name}"], + capture_output=True, + check=True, + ) + elif salt.utils.path.which("rpm"): + proc = subprocess.run( + ["rpm", "-q", "-l", "-p", f"{test_pkg_name}"], + capture_output=True, + check=True, + ) + found_line = False + for line in proc.stdout.decode().splitlines(): + # If test_initd_name not present we should fail. + if test_initd_name in line: + found_line = True + break + + assert found_line + + def test_salt_upgrade(salt_call_cli, install_salt): """ Test an upgrade of Salt, Minion and Master