Merge develop into stable for v2024.12.12 release

This commit is contained in:
Salt Project Packaging 2024-12-12 20:17:10 +00:00
commit fe5d64771a
9 changed files with 253 additions and 151 deletions

View file

@ -180,6 +180,36 @@ jobs:
amazonlinux-2023:
name: Amazon 2023
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: amazonlinux-2023
display-name: Amazon 2023
container-slug: amazonlinux-2023
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
debian-11:
name: Debian 11
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: debian-11
display-name: Debian 11
container-slug: debian-11
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
debian-12:
name: Debian 12
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
@ -190,7 +220,7 @@ jobs:
with:
distro-slug: debian-12
display-name: Debian 12
container-slug: systemd-debian-12
container-slug: debian-12
timeout: 20
instances: '["stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'
@ -205,7 +235,7 @@ jobs:
with:
distro-slug: photon-5
display-name: Photon OS 5
container-slug: systemd-photon-5
container-slug: photon-5
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
@ -220,7 +250,7 @@ jobs:
with:
distro-slug: rockylinux-8
display-name: Rocky Linux 8
container-slug: systemd-rockylinux-8
container-slug: rockylinux-8
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
@ -235,7 +265,7 @@ jobs:
with:
distro-slug: rockylinux-9
display-name: Rocky Linux 9
container-slug: systemd-rockylinux-9
container-slug: rockylinux-9
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
@ -250,7 +280,7 @@ jobs:
with:
distro-slug: ubuntu-2204
display-name: Ubuntu 22.04
container-slug: systemd-ubuntu-22.04
container-slug: ubuntu-22.04
timeout: 20
instances: '["stable-3006", "git-3006", "onedir-3006", "stable-3006-8", "stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'
@ -267,6 +297,8 @@ jobs:
- macos-13
- macos-14
- windows-2022
- amazonlinux-2023
- debian-11
- debian-12
- photon-5
- rockylinux-8

View file

@ -6,17 +6,15 @@ import pathlib
os.chdir(os.path.abspath(os.path.dirname(__file__)))
# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "debian-11",
# "debian-13",
# "fedora-40",
# "photon-4",
# "ubuntu-2004",
# "ubuntu-2404",
LINUX_DISTROS = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"photon-5",
"rockylinux-8",
@ -34,17 +32,15 @@ OSX = [
"macos-14",
]
# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "debian-11",
# "debian-13",
# "fedora-40",
# "photon-4",
# "ubuntu-2004",
# "ubuntu-2404",
STABLE_DISTROS = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"photon-5",
"rockylinux-8",
@ -52,17 +48,15 @@ STABLE_DISTROS = [
"ubuntu-2204",
]
# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "debian-11",
# "debian-13",
# "fedora-40",
# "photon-4",
# "ubuntu-2004",
# "ubuntu-2404",
ONEDIR_DISTROS = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"photon-5",
"rockylinux-8",
@ -70,8 +64,6 @@ ONEDIR_DISTROS = [
"ubuntu-2204",
]
# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "photon-4",
@ -102,6 +94,7 @@ BLACKLIST_GIT_3006 = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"debian-13",
"fedora-40",
"photon-4",
"photon-5",
@ -217,19 +210,19 @@ DISTRO_DISPLAY_NAMES = {
}
CONTAINER_SLUG_NAMES = {
"amazonlinux-2": "systemd-amazonlinux-2",
"amazonlinux-2023": "systemd-amazonlinux-2023",
"debian-11": "systemd-debian-11",
"debian-12": "systemd-debian-12",
"debian-13": "systemd-debian-13",
"fedora-40": "systemd-fedora-40",
"photon-4": "systemd-photon-4",
"photon-5": "systemd-photon-5",
"rockylinux-8": "systemd-rockylinux-8",
"rockylinux-9": "systemd-rockylinux-9",
"ubuntu-2004": "systemd-ubuntu-20.04",
"ubuntu-2204": "systemd-ubuntu-22.04",
"ubuntu-2404": "systemd-ubuntu-24.04",
"amazonlinux-2": "amazonlinux-2",
"amazonlinux-2023": "amazonlinux-2023",
"debian-11": "debian-11",
"debian-12": "debian-12",
"debian-13": "debian-13",
"fedora-40": "fedora-40",
"photon-4": "photon-4",
"photon-5": "photon-5",
"rockylinux-8": "rockylinux-8",
"rockylinux-9": "rockylinux-9",
"ubuntu-2004": "ubuntu-20.04",
"ubuntu-2204": "ubuntu-22.04",
"ubuntu-2404": "ubuntu-24.04",
"macos-12": "macos-12",
"macos-13": "macos-13",
"macos-14": "macOS 14",

View file

@ -32,10 +32,6 @@ jobs:
Test:
name: ${{ matrix.instance }}
runs-on: ubuntu-latest
container:
image: ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }}
options: --privileged
timeout-minutes: ${{ inputs.timeout }}
strategy:
max-parallel: 2
@ -46,16 +42,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install Python Dependencies with pip breakage
if: ${{ ( inputs.distro-slug == 'debian-11' ) || ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }}
run: |
python3 -m pip install --break-system-packages -r tests/requirements.txt
- name: Install Python Dependencies without pip breakage
if: ${{ ( inputs.distro-slug != 'debian-11' ) && ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }}
run: |
python3 -m pip install -r tests/requirements.txt
- name: Get Version
run: |
# We need to get the version here and make it an environment variable
@ -65,17 +51,39 @@ jobs:
vt_parm_ver=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}')
echo "SaltVersion=$vt_parm_ver" >> $GITHUB_ENV
- name: "Pull container ${{ inputs.container-slug }}"
run: |
docker pull ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }}
- name: "Create container ${{ inputs.container-slug }}"
run: |
/usr/bin/docker create --name ${{ github.run_id }}_salt-test --workdir /_w/ --privileged -e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -e $GITHUB_ENV -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work":"/__w" -v "/home/runner/work/_temp":"/__w/_temp" -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/salt-bootstrap/salt-bootstrap":"/_w/btstrap" --entrypoint "/usr/lib/systemd/systemd" ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }} --systemd --unit rescue.target
- name: "Start container ${{ inputs.container-slug }}"
run: |
/usr/bin/docker start ${{ github.run_id }}_salt-test
- name: "Install Python Dependencies with pip breakage in container ${{ inputs.container-slug }}"
if: ${{ ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }}
run: |
docker exec ${{ github.run_id}}_salt-test python3 -m pip install --break-system-packages -r /_w/btstrap/tests/requirements.txt
- name: "Install Python Dependencies without pip breakage in container ${{ inputs.container-slug }}"
if: ${{ ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }}
run: |
docker exec ${{ github.run_id}}_salt-test python3 -m pip install -r /_w/btstrap/tests/requirements.txt
- name: Bootstrap Salt
run: |
# sed 1st - becomes space, 2nd - becomes dot
bt_arg1=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $1}')
bt_arg2=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}')
echo "bt parms ,$bt_parms, bt_arg1 ,$bt_arg1, bt_arg2 ,$bt_arg2,"
sh -x ./bootstrap-salt.sh "$bt_arg1" "$bt_arg2"
docker exec ${{ github.run_id}}_salt-test sh -x /_w/btstrap/bootstrap-salt.sh "$bt_arg1" "$bt_arg2"
- name: Test Bootstrap
run: |
pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/
docker exec ${{ github.run_id}}_salt-test pytest --cache-clear -v -s -ra --log-cli-level=debug /_w/btstrap/tests/integration/
- name: Set Exit Status
if: always()

View file

@ -41,8 +41,10 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.9+
args: [--py39-plus]
name: Rewrite Code to be Py3.6+
args: [--py36-plus]
## DGM name: Rewrite Code to be Py3.9+
## DGM args: [--py39-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.12.0

View file

@ -1,3 +1,12 @@
# v2024.12.12
## What's Changed
- Restrict use of dnf to Fedora only, otherwise use yum when dealing with RedHat family by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2070
- Updating container usage to that used in new Salt pipelines for CI/CD, fix Amazon Linux by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2071
**Full Changelog**: https://github.com/saltstack/salt-bootstrap/compare/v2024.12.09...v2024.12.12
# v2024.12.09
## What's Changed

View file

@ -37,6 +37,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file.
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
- 2024.12.09: ``44f9405a6d9622ad8fa7c93e83a52e01ca328f27e4e9dea4a52268c6a22dbe6d``
- 2024.11.29: ``0ac87384dee051aceded69704485a5de0e4a308551a462b10c262111b57acff0``
- 2024.11.27: ``e972bd1ef01d09cd1d9294374ef974c9e3dd9a2aee37cf3859144585fd8bf1d0``
- 2024.11.26: ``832c7a20b96e1df171d715323df9afff8a11aef42d15598c007f240bc89d723c``

View file

@ -108,7 +108,7 @@ if ($help) {
exit 0
}
$__ScriptVersion = "2024.12.09"
$__ScriptVersion = "2024.12.12"
$ScriptName = $myInvocation.MyCommand.Name
# We'll check for the Version next, because it also has no requirements

View file

@ -26,7 +26,7 @@
#======================================================================================================================
set -o nounset # Treat unset variables as an error
__ScriptVersion="2024.12.09"
__ScriptVersion="2024.12.12"
__ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0"
@ -3189,11 +3189,8 @@ install_ubuntu_git_deps() {
__PACKAGES="${__PACKAGES} util-linux-extra"
fi
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES="${__PACKAGES} procps pciutils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
# Additionally install procps pciutils and sudo which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES="${__PACKAGES} procps pciutils sudo"
# shellcheck disable=SC2086
__apt_get_install_noinput ${__PACKAGES} || return 1
@ -3592,15 +3589,12 @@ install_debian_onedir_deps() {
return 1
fi
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES='procps pciutils'
# Additionally install procps, pciutils and sudo which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES='procps pciutils sudo'
# YAML module is used for generating custom master/minion configs
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-yaml"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
# shellcheck disable=SC2086
__apt_get_install_noinput ${__PACKAGES} || return 1
@ -3643,11 +3637,8 @@ install_debian_git_deps() {
__PACKAGES="python${PY_PKG_VER}-dev python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc"
echodebug "install_debian_git_deps() Installing ${__PACKAGES}"
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES="${__PACKAGES} procps pciutils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
# Additionally install procps, pciutils and sudo which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES="${__PACKAGES} procps pciutils sudo"
# shellcheck disable=SC2086
__apt_get_install_noinput ${__PACKAGES} || return 1
@ -3947,14 +3938,11 @@ install_fedora_deps() {
__PACKAGES="${__PACKAGES} dnf-utils libyaml procps-ng python${PY_PKG_VER}-crypto python${PY_PKG_VER}-jinja2"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-msgpack python${PY_PKG_VER}-requests python${PY_PKG_VER}-zmq"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-pip python${PY_PKG_VER}-m2crypto python${PY_PKG_VER}-pyyaml"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-systemd"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-systemd sudo"
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
fi
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
# shellcheck disable=SC2086
__dnf_install_noinput ${__PACKAGES} ${_EXTRA_PACKAGES} || return 1
@ -3985,10 +3973,7 @@ install_fedora_git_deps() {
# shellcheck disable=SC2119
__git_clone_and_checkout || return 1
__PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc gcc-c++"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc gcc-c++ sudo"
# shellcheck disable=SC2086
__dnf_install_noinput ${__PACKAGES} || return 1
@ -4117,10 +4102,7 @@ install_fedora_onedir_deps() {
__install_saltstack_fedora_onedir_repository || return 1
fi
__PACKAGES="dnf-utils chkconfig procps-ng"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="dnf-utils chkconfig procps-ng sudo"
# shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1
@ -4224,8 +4206,8 @@ __install_saltstack_rhel_onedir_repository() {
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-3007-sts
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-3007-sts
fi
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
@ -4243,11 +4225,11 @@ __install_saltstack_rhel_onedir_repository() {
fi
else
# Enable the Salt LATEST repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-latest
yum config-manager --set-disable salt-repo-*
yum config-manager --set-enabled salt-repo-latest
fi
dnf clean expire-cache || return 1
dnf makecache || return 1
yum clean expire-cache || return 1
yum makecache || return 1
elif [ "$ONEDIR_REV" != "latest" ]; then
echowarn "salt.repo already exists, ignoring salt version argument."
echowarn "Use -F (forced overwrite) to install $ONEDIR_REV."
@ -4280,10 +4262,7 @@ install_centos_stable_deps() {
__install_saltstack_rhel_onedir_repository || return 1
fi
__PACKAGES="yum-utils chkconfig procps-ng findutils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
# shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1
@ -4329,9 +4308,6 @@ install_centos_stable() {
__PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG"
fi
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
# shellcheck disable=SC2086
yum makecache || return 1
__yum_install_noinput ${__PACKAGES} || return 1
@ -4410,10 +4386,7 @@ install_centos_git_deps() {
return 1
fi
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc sudo"
# shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1
@ -4509,10 +4482,7 @@ install_centos_onedir_deps() {
__install_saltstack_rhel_onedir_repository || return 1
fi
__PACKAGES="yum-utils chkconfig procps-ng findutils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
# shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1
@ -4559,8 +4529,8 @@ install_centos_onedir() {
fi
# shellcheck disable=SC2086
dnf makecache || return 1
dnf list salt-minion || return 1
yum makecache || return 1
yum list salt-minion || return 1
__yum_install_noinput ${__PACKAGES} || return 1
return 0
@ -5613,10 +5583,7 @@ install_amazon_linux_ami_2_git_deps() {
# shellcheck disable=SC2119
__git_clone_and_checkout || return 1
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc sudo"
# shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1
@ -5638,10 +5605,7 @@ install_amazon_linux_ami_2_deps() {
# We need to install yum-utils before doing anything else when installing on
# Amazon Linux ECS-optimized images. See issue #974.
__PACKAGES="yum-utils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="yum-utils sudo"
__yum_install_noinput ${__PACKAGES}
@ -5652,8 +5616,10 @@ install_amazon_linux_ami_2_deps() {
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
if [ ! -s "${YUM_REPO_FILE}" ]; then
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
## Amazon Linux yum (v3) doesn't support config-manager
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
# shellcheck disable=SC2129
if [ "$STABLE_REV" != "latest" ]; then
# 3006.x is default, and latest for 3006.x branch
if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then
@ -5661,14 +5627,33 @@ install_amazon_linux_ami_2_deps() {
REPO_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-3007-sts
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
else
# Salt 3006 repo
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
echo "[salt-repo-${STABLE_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
# shellcheck disable=SC2129
echo "name=Salt Repo for Salt v${STABLE_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
@ -5680,11 +5665,18 @@ install_amazon_linux_ami_2_deps() {
fi
else
# Enable the Salt LATEST repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-latest
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
dnf clean expire-cache || return 1
dnf makecache || return 1
yum clean expire-cache || return 1
yum makecache || return 1
fi
fi
@ -5703,10 +5695,7 @@ install_amazon_linux_ami_2_onedir_deps() {
# We need to install yum-utils before doing anything else when installing on
# Amazon Linux ECS-optimized images. See issue #974.
__PACKAGES="yum-utils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
__yum_install_noinput ${__PACKAGES}
@ -5717,8 +5706,10 @@ install_amazon_linux_ami_2_onedir_deps() {
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
if [ ! -s "${YUM_REPO_FILE}" ]; then
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
## Amazon Linux yum (v3) doesn't support config-manager
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
# shellcheck disable=SC2129
if [ "$ONEDIR_REV" != "latest" ]; then
# 3006.x is default, and latest for 3006.x branch
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
@ -5726,14 +5717,33 @@ install_amazon_linux_ami_2_onedir_deps() {
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-3007-sts
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
else
# Salt 3006 repo
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
# shellcheck disable=SC2129
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
@ -5745,11 +5755,18 @@ install_amazon_linux_ami_2_onedir_deps() {
fi
else
# Enable the Salt LATEST repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-latest
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
dnf clean expire-cache || return 1
dnf makecache || return 1
yum clean expire-cache || return 1
yum makecache || return 1
fi
fi
@ -5835,10 +5852,7 @@ install_amazon_linux_ami_2023_git_deps() {
# shellcheck disable=SC2119
__git_clone_and_checkout || return 1
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc sudo"
# shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1
@ -5852,14 +5866,18 @@ install_amazon_linux_ami_2023_git_deps() {
return 0
}
install_amazon_linux_ami_2023_deps() {
# Set ONEDIR_REV to STABLE_REV
ONEDIR_REV=${STABLE_REV}
install_amazon_linux_ami_2023_onedir_deps || return 1
}
install_amazon_linux_ami_2023_onedir_deps() {
# We need to install yum-utils before doing anything else when installing on
# Amazon Linux ECS-optimized images. See issue #974.
__PACKAGES="yum-utils"
# ensure sudo installed
__PACKAGES="${__PACKAGES} sudo"
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
__yum_install_noinput ${__PACKAGES}
@ -5870,8 +5888,10 @@ install_amazon_linux_ami_2023_onedir_deps() {
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
if [ ! -s "${YUM_REPO_FILE}" ]; then
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
## Amazon Linux yum (v3) doesn't support config-manager
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
# shellcheck disable=SC2129
if [ "$ONEDIR_REV" != "latest" ]; then
# 3006.x is default, and latest for 3006.x branch
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
@ -5879,14 +5899,33 @@ install_amazon_linux_ami_2023_onedir_deps() {
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
# Enable the Salt 3007 STS repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-3007-sts
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
else
# Salt 3006 repo
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
# using minor version
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
# shellcheck disable=SC2129
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
@ -5898,11 +5937,18 @@ install_amazon_linux_ami_2023_onedir_deps() {
fi
else
# Enable the Salt LATEST repo
dnf config-manager --set-disable salt-repo-*
dnf config-manager --set-enabled salt-repo-latest
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
echo "priority=10" >> "${YUM_REPO_FILE}"
echo "enabled=1" >> "${YUM_REPO_FILE}"
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
fi
dnf clean expire-cache || return 1
dnf makecache || return 1
yum clean expire-cache || return 1
yum makecache || return 1
fi
fi

View file

@ -35,10 +35,21 @@ def run_salt_call(cmd):
log.error(f"failed to produce output result, '{result}'")
else:
cmdl = ["sudo"]
if platform.system() == "Darwin":
cmdl = ["sudo"]
else:
cmdl = []
cmdl.extend(cmd)
cmdl.append("--out=json")
result = subprocess.run(cmdl, capture_output=True, text=True)
try:
result = subprocess.run(cmdl, capture_output=True, text=True)
except TypeError:
result = subprocess.run(
cmdl,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
)
if 0 == result.returncode:
json_data = json.loads(result.stdout)
else: