diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c71583c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/salt-3006.8.tar.gz diff --git a/.salt.metadata b/.salt.metadata new file mode 100644 index 0000000..7baf8d0 --- /dev/null +++ b/.salt.metadata @@ -0,0 +1 @@ +cff6fe9151cc8d1c231ce166aac975450d72c118 SOURCES/salt-3006.8.tar.gz diff --git a/SOURCES/0001-Added-MSVSphere-support.patch b/SOURCES/0001-Added-MSVSphere-support.patch new file mode 100644 index 0000000..a14a9c9 --- /dev/null +++ b/SOURCES/0001-Added-MSVSphere-support.patch @@ -0,0 +1,267 @@ +From 1d1b727772b4c866cabacb0a6b942285c4c31be9 Mon Sep 17 00:00:00 2001 +From: Sergey Cherevko +Date: Mon, 20 Jan 2025 16:25:50 +0300 +Subject: [PATCH 1/2] Added MSVSphere support + +--- + salt/cloud/deploy/bootstrap-salt.sh | 87 ++++++++++++++++++- + salt/grains/core.py | 4 +- + .../pkg/integration/test_enabled_disabled.py | 1 + + .../pytests/pkg/integration/test_salt_user.py | 1 + + tests/pytests/pkg/integration/test_version.py | 1 + + tests/support/pkg.py | 7 +- + 6 files changed, 95 insertions(+), 6 deletions(-) + +diff --git a/salt/cloud/deploy/bootstrap-salt.sh b/salt/cloud/deploy/bootstrap-salt.sh +index c632146..d530c3f 100644 +--- a/salt/cloud/deploy/bootstrap-salt.sh ++++ b/salt/cloud/deploy/bootstrap-salt.sh +@@ -1081,7 +1081,7 @@ __strip_duplicates() { + __sort_release_files() { + KNOWN_RELEASE_FILES=$(echo "(arch|alpine|centos|debian|ubuntu|fedora|redhat|suse|\ + mandrake|mandriva|gentoo|slackware|turbolinux|unitedlinux|void|lsb|system|\ +- oracle|os|almalinux|rocky)(-|_)(release|version)" | sed -E 's:[[:space:]]::g') ++ oracle|os|almalinux|rocky|msvsphere)(-|_)(release|version)" | sed -E 's:[[:space:]]::g') + primary_release_files="" + secondary_release_files="" + # Sort know VS un-known files first +@@ -1095,7 +1095,7 @@ __sort_release_files() { + done + + # Now let's sort by know files importance, max important goes last in the max_prio list +- max_prio="redhat-release centos-release oracle-release fedora-release almalinux-release rocky-release" ++ max_prio="redhat-release centos-release oracle-release fedora-release almalinux-release rocky-release sphere-release" + for entry in $max_prio; do + if [ "$(echo "${primary_release_files}" | grep "$entry")" != "" ]; then + primary_release_files=$(echo "${primary_release_files}" | sed -e "s:\\(.*\\)\\($entry\\)\\(.*\\):\\2 \\1 \\3:g") +@@ -1226,6 +1226,7 @@ __gather_linux_system_info() { + oracle ) n="Oracle Linux" ;; + almalinux ) n="AlmaLinux" ;; + rocky ) n="Rocky Linux" ;; ++ rocky ) n="MSVSphere" ;; + system ) + while read -r line; do + [ "${n}x" != "systemx" ] && break +@@ -1973,14 +1974,14 @@ elif [ "${DISTRO_NAME_L}" = "debian" ]; then + __debian_codename_translation + fi + +-if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|gentoo|red_hat|oracle|scientific|amazon|fedora|macosx|almalinux|rocky)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then ++if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|gentoo|red_hat|oracle|scientific|amazon|fedora|macosx|almalinux|rocky|msvsphere)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then + echoerror "${DISTRO_NAME} does not have major version pegged packages support" + exit 1 + fi + + # Only RedHat based distros have testing support + if [ "${ITYPE}" = "testing" ]; then +- if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(centos|red_hat|amazon|oracle|almalinux|rocky)')" = "" ]; then ++ if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(centos|red_hat|amazon|oracle|almalinux|rocky|msvsphere)')" = "" ]; then + echoerror "${DISTRO_NAME} does not have testing packages support" + exit 1 + fi +@@ -5719,6 +5720,84 @@ install_almalinux_check_services() { + # + ####################################################################################################################### + ++####################################################################################################################### ++# ++# MSVSphere Install Functions ++# ++install_msvsphere_stable_deps() { ++ install_centos_stable_deps || return 1 ++ return 0 ++} ++ ++install_msvsphere_git_deps() { ++ install_centos_git_deps || return 1 ++ return 0 ++} ++ ++install_msvsphere_onedir_deps() { ++ install_centos_onedir_deps || return 1 ++ return 0 ++} ++ ++install_msvsphere_testing_deps() { ++ install_centos_testing_deps || return 1 ++ return 0 ++} ++ ++install_msvsphere_stable() { ++ install_centos_stable || return 1 ++ return 0 ++} ++ ++install_msvsphere_git() { ++ install_centos_git || return 1 ++ return 0 ++} ++ ++install_msvsphere_onedir() { ++ install_centos_onedir || return 1 ++ return 0 ++} ++ ++install_msvsphere_testing() { ++ install_centos_testing || return 1 ++ return 0 ++} ++ ++install_msvsphere_stable_post() { ++ install_centos_stable_post || return 1 ++ return 0 ++} ++ ++install_msvsphere_git_post() { ++ install_centos_git_post || return 1 ++ return 0 ++} ++ ++install_msvsphere_onedir_post() { ++ install_centos_onedir_post || return 1 ++ return 0 ++} ++ ++install_msvsphere_testing_post() { ++ install_centos_testing_post || return 1 ++ return 0 ++} ++ ++install_msvsphere_restart_daemons() { ++ install_centos_restart_daemons || return 1 ++ return 0 ++} ++ ++install_msvsphere_check_services() { ++ install_centos_check_services || return 1 ++ return 0 ++} ++# ++# Ended MSVSphere Install Functions ++# ++####################################################################################################################### ++ + ####################################################################################################################### + # + # Rocky Linux Install Functions +diff --git a/salt/grains/core.py b/salt/grains/core.py +index 17a1d68..bbd3830 100644 +--- a/salt/grains/core.py ++++ b/salt/grains/core.py +@@ -1772,6 +1772,7 @@ _OS_NAME_MAP = { + "cloudserve": "CloudLinux", + "cloudlinux": "CloudLinux", + "almalinux": "AlmaLinux", ++ "msvsphere": "MSVSphere", + "pidora": "Fedora", + "scientific": "ScientificLinux", + "synology": "Synology", +@@ -2145,7 +2146,7 @@ def _os_release_quirks_for_oscodename(os_release): + # Astra Linux has no version codename, but Salt used + # to report the variant ID as oscodename. + return os_release.get("VARIANT_ID") +- if os_release["ID"] in ("almalinux", "rocky"): ++ if os_release["ID"] in ("almalinux", "rocky", "msvsphere"): + # VERSION_CODENAME is not set, but the codename is + # mentioned in PRETTY_NAME and VERSION. + match = _VERSION_RE.match(os_release.get("VERSION", "")) +@@ -2234,6 +2235,7 @@ def _linux_distribution_data(): + "debian", + "linuxmint", + "mendel", ++ "msvsphere", + "pop", + "rocky", + "ubuntu", +diff --git a/tests/pytests/pkg/integration/test_enabled_disabled.py b/tests/pytests/pkg/integration/test_enabled_disabled.py +index 99097b1..b4eef3c 100644 +--- a/tests/pytests/pkg/integration/test_enabled_disabled.py ++++ b/tests/pytests/pkg/integration/test_enabled_disabled.py +@@ -14,6 +14,7 @@ def test_services(install_salt, salt_cli, salt_minion): + elif install_salt.distro_id in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +diff --git a/tests/pytests/pkg/integration/test_salt_user.py b/tests/pytests/pkg/integration/test_salt_user.py +index 74bf458..2f50614 100644 +--- a/tests/pytests/pkg/integration/test_salt_user.py ++++ b/tests/pytests/pkg/integration/test_salt_user.py +@@ -191,6 +191,7 @@ def test_paths_log_rotation( + if install_salt.distro_id not in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +diff --git a/tests/pytests/pkg/integration/test_version.py b/tests/pytests/pkg/integration/test_version.py +index 24a665d..61e967c 100644 +--- a/tests/pytests/pkg/integration/test_version.py ++++ b/tests/pytests/pkg/integration/test_version.py +@@ -128,6 +128,7 @@ def test_compare_pkg_versions_redhat_rc(version, install_salt): + if install_salt.distro_id not in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +diff --git a/tests/support/pkg.py b/tests/support/pkg.py +index d9c6487..eed579a 100644 +--- a/tests/support/pkg.py ++++ b/tests/support/pkg.py +@@ -114,6 +114,7 @@ class SaltPkgInstall: + if self.distro_id in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +@@ -131,6 +132,7 @@ class SaltPkgInstall: + if self.distro_id in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +@@ -147,6 +149,7 @@ class SaltPkgInstall: + if self.distro_id in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +@@ -171,6 +174,7 @@ class SaltPkgInstall: + if self.distro_id in ( + "almalinux", + "rocky", ++ "msvsphere", + "centos", + "redhat", + "amzn", +@@ -611,7 +615,7 @@ class SaltPkgInstall: + "3006.0" + ) + distro_name = self.distro_name +- if distro_name in ("almalinux", "rocky", "centos", "fedora"): ++ if distro_name in ("almalinux", "rocky", "centos", "fedora", "msvsphere"): + distro_name = "redhat" + root_url = "salt/py3/" + if self.classic: +@@ -620,6 +624,7 @@ class SaltPkgInstall: + if self.distro_name in [ + "almalinux", + "rocky", ++ "msvsphere", + "redhat", + "centos", + "amazon", +-- +2.43.5 + diff --git a/SOURCES/0002-Using-timezone-aware-objects-to-represent-datetimes-in-UTC.patch b/SOURCES/0002-Using-timezone-aware-objects-to-represent-datetimes-in-UTC.patch new file mode 100644 index 0000000..0b17ed4 --- /dev/null +++ b/SOURCES/0002-Using-timezone-aware-objects-to-represent-datetimes-in-UTC.patch @@ -0,0 +1,26 @@ +From 82fd2b26deb3dd04d08576415622f017527ba072 Mon Sep 17 00:00:00 2001 +From: Sergey Cherevko +Date: Wed, 22 Jan 2025 16:23:32 +0300 +Subject: [PATCH 2/2] Using timezone-aware objects to represent datetimes in + UTC + +--- + salt/grains/core.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/salt/grains/core.py b/salt/grains/core.py +index bbd3830..42f5ef5 100644 +--- a/salt/grains/core.py ++++ b/salt/grains/core.py +@@ -2904,7 +2904,7 @@ def ip_fqdn(): + if not ret["ipv" + ipv_num]: + ret[key] = [] + else: +- start_time = datetime.datetime.utcnow() ++ start_time = datetime.datetime.now(datetime.UTC) + try: + info = socket.getaddrinfo(_fqdn, None, socket_type) + ret[key] = list({item[4][0] for item in info}) +-- +2.43.5 + diff --git a/SOURCES/README.fedora b/SOURCES/README similarity index 100% rename from SOURCES/README.fedora rename to SOURCES/README diff --git a/SOURCES/salt-3006.8.tar.gz b/SOURCES/salt-3006.8.tar.gz deleted file mode 100644 index 7cb9225..0000000 Binary files a/SOURCES/salt-3006.8.tar.gz and /dev/null differ diff --git a/SPECS/salt.spec b/SPECS/salt.spec index 14a2695..51b0b35 100644 --- a/SPECS/salt.spec +++ b/SPECS/salt.spec @@ -11,7 +11,7 @@ Name: salt Version: 3006.8 -Release: 1%{?dist} +Release: 1%{?dist}.inferit Summary: A parallel remote execution system Group: System Environment/Daemons License: Apache-2.0 @@ -26,7 +26,7 @@ Source6: %{name}-master.service Source7: %{name}-syndic.service Source8: %{name}-minion.service Source9: %{name}-api.service -Source10: README.fedora +Source10: README Source11: %{name}-common.logrotate Source12: %{name}.bash Source13: %{name}.fish @@ -42,6 +42,9 @@ Source22: %{name}.sysusers Patch0: contextvars.patch Patch1: match_hostname.patch +# MSVSphere +Patch1001: 0001-Added-MSVSphere-support.patch +Patch1002: 0002-Using-timezone-aware-objects-to-represent-datetimes-in-UTC.patch BuildArch: noarch %ifarch %{ix86} x86_64 @@ -219,7 +222,7 @@ mkdir -p %{buildroot}%{_sysconfdir}/%{name}/gpgkeys %files -f %{pyproject_files} %license LICENSE -%doc README.fedora +%doc README %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %{_sysconfdir}/bash_completion.d/%{name}.bash %dir %{_var}/cache/%{name}/ @@ -332,6 +335,10 @@ chown salt:salt %{_sysconfdir}/%{name}/gpgkeys -R %changelog +* Wed Jan 22 2025 Sergey Cherevko - 3006.8-1.inferit +- Added MSVSphere support +- Using timezone-aware objects to represent datetimes in UTC + * Thu May 02 2024 Gwyn Ciesla - 3006.8-1 - 3006.8