diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e81e9b3..cd33983 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -249,7 +249,7 @@ jobs: distro-slug: almalinux-8 display-name: AlmaLinux 8 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' almalinux-9: @@ -263,7 +263,7 @@ jobs: distro-slug: almalinux-9 display-name: AlmaLinux 9 timeout: 20 - instances: '["git-3005", "onedir-3005", "onedir-3006", "git-master"]' + instances: '["git-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' amazon-2: @@ -277,7 +277,7 @@ jobs: distro-slug: amazon-2 display-name: Amazon 2 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' arch: @@ -291,7 +291,7 @@ jobs: distro-slug: arch display-name: Arch timeout: 20 - instances: '["git-master", "latest"]' + instances: '["git-master", "latest", "default"]' centos-7: @@ -305,7 +305,7 @@ jobs: distro-slug: centos-7 display-name: CentOS 7 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' centos-stream8: @@ -319,7 +319,7 @@ jobs: distro-slug: centos-stream8 display-name: CentOS Stream 8 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' centos-stream9: @@ -333,7 +333,7 @@ jobs: distro-slug: centos-stream9 display-name: CentOS Stream 9 timeout: 20 - instances: '["git-3005", "onedir-3005", "onedir-3006", "git-master"]' + instances: '["git-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' debian-10: @@ -347,7 +347,7 @@ jobs: distro-slug: debian-10 display-name: Debian 10 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' debian-11: @@ -361,21 +361,7 @@ jobs: distro-slug: debian-11 display-name: Debian 11 timeout: 20 - instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest"]' - - - fedora-35: - name: Fedora 35 - 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: fedora-35 - display-name: Fedora 35 - timeout: 20 - instances: '["git-master", "latest"]' + instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' fedora-36: @@ -389,7 +375,7 @@ jobs: distro-slug: fedora-36 display-name: Fedora 36 timeout: 20 - instances: '["git-master", "latest"]' + instances: '["stable-3006", "onedir-3006", "git-master", "latest", "default"]' fedora-37: @@ -403,7 +389,7 @@ jobs: distro-slug: fedora-37 display-name: Fedora 37 timeout: 20 - instances: '["latest"]' + instances: '["stable-3006", "onedir-3006", "latest", "default"]' fedora-38: @@ -417,7 +403,7 @@ jobs: distro-slug: fedora-38 display-name: Fedora 38 timeout: 20 - instances: '["latest"]' + instances: '["stable-3006", "onedir-3006", "latest", "default"]' gentoo: @@ -431,7 +417,7 @@ jobs: distro-slug: gentoo display-name: Gentoo timeout: 90 - instances: '["git-master", "latest"]' + instances: '["git-master", "latest", "default"]' gentoo-systemd: @@ -445,7 +431,7 @@ jobs: distro-slug: gentoo-systemd display-name: Gentoo (systemd) timeout: 90 - instances: '["git-master", "latest"]' + instances: '["git-master", "latest", "default"]' opensuse-15: @@ -459,7 +445,7 @@ jobs: distro-slug: opensuse-15 display-name: Opensuse 15 timeout: 20 - instances: '["latest"]' + instances: '["latest", "default"]' opensuse-tumbleweed: @@ -473,7 +459,7 @@ jobs: distro-slug: opensuse-tumbleweed display-name: Opensuse Tumbleweed timeout: 20 - instances: '["git-master", "latest"]' + instances: '["git-master", "latest", "default"]' oraclelinux-7: @@ -487,7 +473,7 @@ jobs: distro-slug: oraclelinux-7 display-name: Oracle Linux 7 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' oraclelinux-8: @@ -501,7 +487,35 @@ jobs: distro-slug: oraclelinux-8 display-name: Oracle Linux 8 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' + + + photon-3: + name: Photon OS 3 + 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: photon-3 + display-name: Photon OS 3 + timeout: 20 + instances: '["stable-3006", "onedir-3006", "git-master", "latest", "default"]' + + + photon-4: + name: Photon OS 4 + 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: photon-4 + display-name: Photon OS 4 + timeout: 20 + instances: '["stable-3006", "onedir-3006", "git-master", "latest", "default"]' rockylinux-8: @@ -515,7 +529,7 @@ jobs: distro-slug: rockylinux-8 display-name: Rocky Linux 8 timeout: 20 - instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest", "default"]' rockylinux-9: @@ -529,7 +543,7 @@ jobs: distro-slug: rockylinux-9 display-name: Rocky Linux 9 timeout: 20 - instances: '["git-3005", "onedir-3005", "onedir-3006", "git-master"]' + instances: '["git-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' ubuntu-2004: @@ -543,7 +557,7 @@ jobs: distro-slug: ubuntu-2004 display-name: Ubuntu 20.04 timeout: 20 - instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest"]' + instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' ubuntu-2204: @@ -557,7 +571,7 @@ jobs: distro-slug: ubuntu-2204 display-name: Ubuntu 22.04 timeout: 20 - instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest"]' + instances: '["stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "git-master", "latest", "default"]' set-pipeline-exit-status: @@ -585,7 +599,6 @@ jobs: - centos-stream9 - debian-10 - debian-11 - - fedora-35 - fedora-36 - fedora-37 - fedora-38 @@ -595,6 +608,8 @@ jobs: - opensuse-tumbleweed - oraclelinux-7 - oraclelinux-8 + - photon-3 + - photon-4 - rockylinux-8 - rockylinux-9 - ubuntu-2004 diff --git a/.github/workflows/templates/generate.py b/.github/workflows/templates/generate.py index f21ace9..38593e9 100755 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -16,7 +16,6 @@ LINUX_DISTROS = [ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -26,6 +25,8 @@ LINUX_DISTROS = [ "opensuse-tumbleweed", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -49,13 +50,14 @@ BSD = [ STABLE_DISTROS = [ "almalinux-8", + "almalinux-9", "amazon-2", "arch", "centos-7", "centos-stream8", + "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -65,7 +67,10 @@ STABLE_DISTROS = [ "opensuse-tumbleweed", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", + "rockylinux-9", "ubuntu-2004", "ubuntu-2204", ] @@ -79,8 +84,13 @@ ONEDIR_DISTROS = [ "centos-stream9", "debian-10", "debian-11", + "fedora-36", + "fedora-37", + "fedora-38", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -98,6 +108,8 @@ ONEDIR_RC_DISTROS = [ "debian-11", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -109,7 +121,6 @@ BLACKLIST_3003 = [ "arch", "centos-stream9", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -117,6 +128,8 @@ BLACKLIST_3003 = [ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2204", @@ -129,7 +142,6 @@ BLACKLIST_GIT_3003 = [ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -137,6 +149,8 @@ BLACKLIST_GIT_3003 = [ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -148,7 +162,6 @@ BLACKLIST_3004 = [ "almalinux-9", "arch", "centos-stream9", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -156,12 +169,15 @@ BLACKLIST_3004 = [ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-9", ] BLACKLIST_3005 = [ + "almalinux-9", "arch", - "fedora-35", + "centos-stream9", "fedora-36", "fedora-37", "fedora-38", @@ -169,6 +185,9 @@ BLACKLIST_3005 = [ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", + "rockylinux-9", ] BLACKLIST_GIT_3004 = [ @@ -178,7 +197,6 @@ BLACKLIST_GIT_3004 = [ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -190,6 +208,8 @@ BLACKLIST_GIT_3004 = [ "ubuntu-2110", "ubuntu-2204", "rockylinux-9", + "photon-3", + "photon-4", ] BLACKLIST_GIT_3005 = [ @@ -197,7 +217,6 @@ BLACKLIST_GIT_3005 = [ "arch", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -205,6 +224,8 @@ BLACKLIST_GIT_3005 = [ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "ubuntu-2004", "ubuntu-2110", "ubuntu-2204", @@ -212,10 +233,6 @@ BLACKLIST_GIT_3005 = [ BLACKLIST_3006 = [ "arch", - "fedora-35", - "fedora-36", - "fedora-37", - "fedora-38", "gentoo", "gentoo-systemd", "opensuse-15", @@ -229,7 +246,6 @@ BLACKLIST_GIT_3006 = [ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -237,12 +253,16 @@ BLACKLIST_GIT_3006 = [ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-9", "ubuntu-2004", "ubuntu-2110", "ubuntu-2204", ] +BLACKLIST_GIT_MASTER = [] + SALT_VERSIONS = [ "3003", "3004", @@ -301,11 +321,7 @@ GIT_DISTRO_BLACKLIST = [ "rockylinux-8", ] -LATEST_PKG_BLACKLIST = [ - "almalinux-9", - "centos-stream9", - "rockylinux-9", -] +LATEST_PKG_BLACKLIST = [] DISTRO_DISPLAY_NAMES = { "almalinux-8": "AlmaLinux 8", @@ -317,7 +333,6 @@ DISTRO_DISPLAY_NAMES = { "centos-stream9": "CentOS Stream 9", "debian-10": "Debian 10", "debian-11": "Debian 11", - "fedora-35": "Fedora 35", "fedora-36": "Fedora 36", "fedora-37": "Fedora 37", "fedora-38": "Fedora 38", @@ -327,6 +342,8 @@ DISTRO_DISPLAY_NAMES = { "opensuse-tumbleweed": "Opensuse Tumbleweed", "oraclelinux-7": "Oracle Linux 7", "oraclelinux-8": "Oracle Linux 8", + "photon-3": "Photon OS 3", + "photon-4": "Photon OS 4", "rockylinux-8": "Rocky Linux 8", "rockylinux-9": "Rocky Linux 9", "ubuntu-2004": "Ubuntu 20.04", @@ -471,6 +488,11 @@ def generate_test_jobs(): kitchen_target = f"{bootstrap_type}-{salt_version}" instances.append(kitchen_target) + for bootstrap_type in ("default",): + if distro not in STABLE_DISTROS: + continue + instances.append(bootstrap_type) + if instances: needs.append(distro) test_jobs += TEMPLATE.format( @@ -511,6 +533,11 @@ def generate_test_jobs(): kitchen_target = f"{bootstrap_type}-{salt_version}" instances.append(kitchen_target) + for bootstrap_type in ("default",): + if distro not in STABLE_DISTROS: + continue + instances.append(bootstrap_type) + if instances: needs.append(distro) test_jobs += TEMPLATE.format( @@ -566,10 +593,6 @@ def generate_test_jobs(): if distro not in STABLE_DISTROS: continue - if distro.startswith("fedora") and salt_version != "latest": - # Fedora does not keep old builds around - continue - if bootstrap_type == "git": if salt_version in GIT_VERSION_BLACKLIST: continue @@ -588,6 +611,7 @@ def generate_test_jobs(): "3004": BLACKLIST_GIT_3004, "3005": BLACKLIST_GIT_3005, "3006": BLACKLIST_GIT_3006, + "master": BLACKLIST_GIT_MASTER, } # .0 versions are a virtual version for pinning to the first @@ -597,7 +621,7 @@ def generate_test_jobs(): continue if ( - salt_version in ("3003", "3004", "3005", "3006") + salt_version in ("3003", "3004", "3005", "3006", "master") and distro in BLACKLIST[salt_version] ): continue @@ -605,6 +629,11 @@ def generate_test_jobs(): kitchen_target = f"{bootstrap_type}-{salt_version}" instances.append(kitchen_target) + for bootstrap_type in ("default",): + if distro not in STABLE_DISTROS: + continue + instances.append(bootstrap_type) + if instances: needs.append(distro) test_jobs += TEMPLATE.format( diff --git a/.github/workflows/test-bsd.yml b/.github/workflows/test-bsd.yml index 62fcfa5..db8fc58 100644 --- a/.github/workflows/test-bsd.yml +++ b/.github/workflows/test-bsd.yml @@ -51,6 +51,11 @@ jobs: ruby-version: 2.6.10 bundler-cache: true + - name: Update Vagrant + run: | + brew update + brew upgrade vagrant + - name: Setup Vagrant Cache uses: actions/cache@v3 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 63788aa..b018222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v2023.04.26 + +## What's Changed + +- Updates for Fedora and Photon by @garethgreenaway in https://github.com/saltstack/salt-bootstrap/pull/1920 +- Fixing defaults by @garethgreenaway in https://github.com/saltstack/salt-bootstrap/pull/1921 + +**Full Changelog**: https://github.com/saltstack/salt-bootstrap/compare/v2023.04.21...v2023.04.26 + # v2023.04.21 ## What's Changed diff --git a/README.rst b/README.rst index ba2e9ee..6c1c086 100644 --- a/README.rst +++ b/README.rst @@ -32,6 +32,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file. The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is: +- 2023.04.21: ``e364428aa7a25f8e2c5e18e36e222351724c6cf35a1d57158f3357cde1e0a0f0`` - 2023.04.06: ``994bf7e8bd92fe6d70d291c7562aff299f5651046b4e76dfa506cee0d9bb0843`` - 2022.10.04: ``d0686c2daeed18bb726e58eef75a69afe9ee56a1a23b2c32cd4e87d6005638e2`` - 2022.08.13: ``af922699c1a2bb3b89b6dac04397389999df1b3416b8d0b5c93766412f14c95c`` diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a7240e5..6d69bf6 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -23,7 +23,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2023.04.21" +__ScriptVersion="2023.04.26" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -616,7 +616,7 @@ if [ "$ITYPE" = "git" ]; then elif [ "$ITYPE" = "stable" ]; then if [ "$#" -eq 0 ];then ONEDIR_REV="latest" - _ONEDIR_REV="$1" + _ONEDIR_REV="latest" ITYPE="onedir" else if [ "$(echo "$1" | grep -E '^(nightly|latest|3006)$')" != "" ]; then @@ -1859,12 +1859,6 @@ else fi fi -# Red Hat variants after 9.x not supported by stable type -if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(centos|red_hat|scientific|almalinux|rocky)')" != "" ] && [ "$ITYPE" = "stable" ] && [ "$DISTRO_MAJOR_VERSION" -ge 9 ]; then - echoerror "${DISTRO_NAME} ${DISTRO_VERSION} not supported by stable type, use type onedir." - exit 1 -fi - # For Ubuntu derivatives, pretend to be their Ubuntu base version __ubuntu_derivatives_translation @@ -2152,6 +2146,15 @@ __dnf_install_noinput() { dnf -y install "${@}" || return $? } # ---------- end of function __dnf_install_noinput ---------- +#--- FUNCTION ------------------------------------------------------------------------------------------------------- +# NAME: __tdnf_install_noinput +# DESCRIPTION: (DRY) dnf install with noinput options +#---------------------------------------------------------------------------------------------------------------------- +__tdnf_install_noinput() { + + tdnf -y install "${@}" || return $? +} # ---------- end of function __tdnf_install_noinput ---------- + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __git_clone_and_checkout # DESCRIPTION: (DRY) Helper function to clone and checkout salt to a @@ -2677,7 +2680,7 @@ __activate_virtualenv() { # NAME: __install_pip_pkgs # DESCRIPTION: Return 0 or 1 if successfully able to install pip packages. Can provide a different python version to # install pip packages with. If $py_ver is not specified it will use the default python version. -# PARAMETERS: pkgs, py_ver +# PARAMETERS: pkgs, py_ver, upgrade #---------------------------------------------------------------------------------------------------------------------- __install_pip_pkgs() { @@ -4184,6 +4187,41 @@ install_debian_check_services() { # Fedora Install Functions # +__install_saltstack_fedora_onedir_repository() { + if [ "$ITYPE" = "stable" ]; then + REPO_REV="$ONEDIR_REV" + else + REPO_REV="latest" + fi + + __PY_VERSION_REPO="yum" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + __PY_VERSION_REPO="py3" + fi + + GPG_KEY="SALT-PROJECT-GPG-PUBKEY-2023.pub" + + REPO_FILE="/etc/yum.repos.d/salt.repo" + + if [ ! -s "$REPO_FILE" ] || [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; then + FETCH_URL="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/fedora/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${ONEDIR_REV}" + if [ "${ONEDIR_REV}" = "nightly" ] ; then + FETCH_URL="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_NIGHTLY_DIR}/${__PY_VERSION_REPO}/fedora/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/" + fi + + __fetch_url "${REPO_FILE}" "${FETCH_URL}.repo" + + __rpm_import_gpg "${FETCH_URL}/${GPG_KEY}" || return 1 + + yum clean metadata || return 1 + elif [ "$REPO_REV" != "latest" ]; then + echowarn "salt.repo already exists, ignoring salt version argument." + echowarn "Use -F (forced overwrite) to install $REPO_REV." + fi + + return 0 +} + install_fedora_deps() { if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then dnf -y update || return 1 @@ -4448,9 +4486,73 @@ install_fedora_check_services() { return 0 } + +install_fedora_onedir_deps() { + + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + yum -y update || return 1 + fi + + if [ "$_DISABLE_REPOS" -eq "$BS_TRUE" ] && [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + echowarn "Detected -r or -R option while installing Salt packages for Python 3." + echowarn "Python 3 packages for older Salt releases requires the EPEL repository to be installed." + echowarn "Installing the EPEL repository automatically is disabled when using the -r or -R options." + fi + + if [ "$_DISABLE_REPOS" -eq "$BS_FALSE" ]; then + __install_saltstack_fedora_onedir_repository || return 1 + fi + + # If -R was passed, we need to configure custom repo url with rsync-ed packages + # Which is still handled in __install_saltstack_rhel_repository. This call has + # its own check in case -r was passed without -R. + if [ "$_CUSTOM_REPO_URL" != "null" ]; then + __install_saltstack_fedora_onedir_repository || return 1 + fi + + if [ "$DISTRO_MAJOR_VERSION" -ge 8 ]; then + __PACKAGES="dnf-utils chkconfig" + else + __PACKAGES="yum-utils chkconfig" + fi + + __PACKAGES="${__PACKAGES} procps" + + # shellcheck disable=SC2086 + __yum_install_noinput ${__PACKAGES} || return 1 + + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + __yum_install_noinput ${_EXTRA_PACKAGES} || return 1 + fi + + return 0 + +} + + install_fedora_onedir() { STABLE_REV=$ONEDIR_REV - install_fedora_stable || return 1 + #install_fedora_stable || return 1 + + __PACKAGES="" + + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then + __PACKAGES="${__PACKAGES} salt-cloud" + fi + if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then + __PACKAGES="${__PACKAGES} salt-master" + fi + if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then + __PACKAGES="${__PACKAGES} salt-minion" + fi + if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then + __PACKAGES="${__PACKAGES} salt-syndic" + fi + + # shellcheck disable=SC2086 + __yum_install_noinput ${__PACKAGES} || return 1 return 0 } @@ -6737,6 +6839,325 @@ install_arch_linux_onedir_post() { # ####################################################################################################################### +####################################################################################################################### +# +# Photon OS Install Functions +# + +__install_saltstack_photon_onedir_repository() { + if [ "$ITYPE" = "stable" ]; then + REPO_REV="$ONEDIR_REV" + else + REPO_REV="latest" + fi + + __PY_VERSION_REPO="yum" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + __PY_VERSION_REPO="py3" + fi + + REPO_FILE="/etc/yum.repos.d/salt.repo" + + if [ ! -s "$REPO_FILE" ] || [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; then + FETCH_URL="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_DIR}/${__PY_VERSION_REPO}/photon/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${ONEDIR_REV}" + if [ "${ONEDIR_REV}" = "nightly" ] ; then + FETCH_URL="${HTTP_VAL}://${_REPO_URL}/${_ONEDIR_NIGHTLY_DIR}/${__PY_VERSION_REPO}/photon/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/" + fi + + __fetch_url "${REPO_FILE}" "${FETCH_URL}.repo" + + GPG_KEY="SALT-PROJECT-GPG-PUBKEY-2023.pub" + + __rpm_import_gpg "${FETCH_URL}/${GPG_KEY}" || return 1 + + tdnf makecache || return 1 + elif [ "$REPO_REV" != "latest" ]; then + echowarn "salt.repo already exists, ignoring salt version argument." + echowarn "Use -F (forced overwrite) to install $REPO_REV." + fi + + return 0 +} + +install_photon_deps() { + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + tdnf -y update || return 1 + fi + + __PACKAGES="${__PACKAGES:=}" + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -lt 3 ]; then + echoerror "There are no Python 2 stable packages for Fedora, only Py3 packages" + return 1 + fi + + PY_PKG_VER=3 + + __PACKAGES="${__PACKAGES} 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" + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + fi + + # shellcheck disable=SC2086 + __tdnf_install_noinput ${__PACKAGES} ${_EXTRA_PACKAGES} || return 1 + + return 0 +} + +install_photon_stable_post() { + for fname in api master minion syndic; do + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + + # Skip if not meant to be installed + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) + sleep 1 + systemctl daemon-reload + done +} + +install_photon_git_deps() { + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + # Packages are named python3- + PY_PKG_VER=3 + else + PY_PKG_VER=2 + fi + + __PACKAGES="" + if ! __check_command_exists ps; then + __PACKAGES="${__PACKAGES} procps-ng" + fi + if ! __check_command_exists git; then + __PACKAGES="${__PACKAGES} git" + fi + + if [ -n "${__PACKAGES}" ]; then + # shellcheck disable=SC2086 + __tdnf_install_noinput ${__PACKAGES} || return 1 + __PACKAGES="" + fi + + __git_clone_and_checkout || return 1 + + if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then + + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + __PACKAGES="${__PACKAGES} ca-certificates" + fi + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then + __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-libcloud python${PY_PKG_VER}-netaddr" + fi + + install_photon_deps || return 1 + + if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + if __check_command_exists python3; then + __python="python3" + fi + elif [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 2 ]; then + if __check_command_exists python2; then + __python="python2" + fi + else + if ! __check_command_exists python; then + echoerror "Unable to find a python binary?!" + return 1 + fi + # Let's hope it's the right one + __python="python" + fi + + grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" | while IFS=' + ' read -r dep; do + echodebug "Running '${__python}' -m pip install '${dep}'" + "${__python}" -m pip install "${dep}" || return 1 + done + else + __PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc" + # shellcheck disable=SC2086 + __tdnf_install_noinput ${__PACKAGES} || return 1 + fi + + # Need newer version of setuptools on Photon + _setuptools_dep="setuptools>=${_MINIMUM_SETUPTOOLS_VERSION}" + echodebug "Running '${_PY_EXE} -m pip --upgrade install ${_setuptools_dep}'" + ${_PY_EXE} -m pip install --upgrade "${_setuptools_dep}" + + # Let's trigger config_salt() + if [ "$_TEMP_CONFIG_DIR" = "null" ]; then + _TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/" + CONFIG_SALT_FUNC="config_salt" + fi + + return 0 +} + +install_photon_git() { + if [ "${_PY_EXE}" != "" ]; then + _PYEXE=${_PY_EXE} + echoinfo "Using the following python version: ${_PY_EXE} to install salt" + else + _PYEXE='python2' + fi + + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then + ${_PYEXE} setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1 + else + ${_PYEXE} setup.py ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1 + fi + return 0 +} + +install_photon_git_post() { + for fname in api master minion syndic; do + # Skip if not meant to be installed + [ $fname = "api" ] && \ + ([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + # Account for new path for services files in later releases + if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/common/salt-${fname}.service" ]; then + _SERVICE_DIR="${_SALT_GIT_CHECKOUT_DIR}/pkg/common" + else + _SERVICE_DIR="${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm" + fi + __copyfile "${_SERVICE_DIR}/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" + + # Salt executables are located under `/usr/local/bin/` on Fedora 36+ + #if [ "${DISTRO_VERSION}" -ge 36 ]; then + # sed -i -e 's:/usr/bin/:/usr/local/bin/:g' /lib/systemd/system/salt-*.service + #fi + + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + + systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) + sleep 1 + systemctl daemon-reload + done +} + +install_photon_restart_daemons() { + [ $_START_DAEMONS -eq $BS_FALSE ] && return + + for fname in api master minion syndic; do + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + + # Skip if not meant to be installed + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + systemctl stop salt-$fname > /dev/null 2>&1 + systemctl start salt-$fname.service && continue + echodebug "Failed to start salt-$fname using systemd" + if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then + systemctl status salt-$fname.service + journalctl -xe + fi + done +} + +install_photon_check_services() { + for fname in api master minion syndic; do + # Skip salt-api since the service should be opt-in and not necessarily started on boot + [ $fname = "api" ] && continue + + # Skip if not meant to be installed + [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue + [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue + [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue + + __check_services_systemd salt-$fname || return 1 + done + + return 0 +} + +install_photon_onedir_deps() { + + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then + tdnf -y update || return 1 + fi + + if [ "$_DISABLE_REPOS" -eq "$BS_TRUE" ] && [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then + echowarn "Detected -r or -R option while installing Salt packages for Python 3." + echowarn "Python 3 packages for older Salt releases requires the EPEL repository to be installed." + echowarn "Installing the EPEL repository automatically is disabled when using the -r or -R options." + fi + + if [ "$_DISABLE_REPOS" -eq "$BS_FALSE" ]; then + __install_saltstack_photon_onedir_repository || return 1 + fi + + # If -R was passed, we need to configure custom repo url with rsync-ed packages + # Which is still handled in __install_saltstack_rhel_repository. This call has + # its own check in case -r was passed without -R. + if [ "$_CUSTOM_REPO_URL" != "null" ]; then + __install_saltstack_photon_onedir_repository || return 1 + fi + + __PACKAGES="procps-ng" + + # shellcheck disable=SC2086 + __tdnf_install_noinput ${__PACKAGES} || return 1 + + if [ "${_EXTRA_PACKAGES}" != "" ]; then + echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" + # shellcheck disable=SC2086 + __tdnf_install_noinput ${_EXTRA_PACKAGES} || return 1 + fi + + return 0 + +} + + +install_photon_onedir() { + STABLE_REV=$ONEDIR_REV + + __PACKAGES="" + + if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then + __PACKAGES="${__PACKAGES} salt-cloud" + fi + if [ "$_INSTALL_MASTER" -eq $BS_TRUE ];then + __PACKAGES="${__PACKAGES} salt-master" + fi + if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then + __PACKAGES="${__PACKAGES} salt-minion" + fi + if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ];then + __PACKAGES="${__PACKAGES} salt-syndic" + fi + + # shellcheck disable=SC2086 + __tdnf_install_noinput ${__PACKAGES} || return 1 + + return 0 +} + +install_photon_onedir_post() { + STABLE_REV=$ONEDIR_REV + install_photon_stable_post || return 1 + + return 0 +} +# +# Ended Fedora Install Functions +# +####################################################################################################################### + ####################################################################################################################### # # FreeBSD Install Functions diff --git a/kitchen.yml b/kitchen.yml index 615a8b2..21fecc5 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -146,6 +146,22 @@ platforms: - name: ubuntu-18.04 driver: run_command: /lib/systemd/systemd + - name: photon-3 + driver: + image: photon:3.0 + provision_command: + - tdnf -y install rpm procps-ng coreutils gawk + - echo "PubkeyAcceptedKeyTypes +ssh-rsa" | tee -a /etc/ssh/sshd_config + - sed -ie 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config + - systemctl enable sshd.service + - name: photon-4 + driver: + image: photon:4.0 + provision_command: + - tdnf -y install rpm procps-ng coreutils gawk + - echo "PubkeyAcceptedKeyTypes +ssh-rsa" | tee -a /etc/ssh/sshd_config + - sed -ie 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config + - systemctl enable sshd.service suites: - name: git-3003 @@ -194,6 +210,20 @@ suites: - freebsd-131 - freebsd-123 - openbsd-6 + - name: git-3006x + provisioner: + salt_version: 3006.x + salt_bootstrap_options: -x python3 -MPfq git %s + excludes: + - opensuse-15 + - opensuse-tumbleweed + - debian-11 + - arch + - gentoo + - gentoo-systemd + - freebsd-131 + - freebsd-123 + - openbsd-6 - name: stable-3003-0 provisioner: salt_version: 3003 @@ -281,6 +311,11 @@ suites: salt_version: latest salt_bootstrap_options: -MP stable %s + - name: default + provisioner: + salt_version: latest + salt_bootstrap_options: -MP + - name: onedir-nightly provisioner: salt_version: nightly diff --git a/tests/conftest.py b/tests/conftest.py index b24d90c..1366f85 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -50,6 +50,6 @@ def target_salt_version(): target_salt = os.environ["KITCHEN_SUITE"].split("-", 2)[-1].replace("-", ".") if target_salt.startswith("v"): target_salt = target_salt[1:] - if target_salt in ("latest", "master", "nightly"): + if target_salt in ("default", "latest", "master", "nightly"): pytest.skip("Don't have a specific salt version to test against") return target_salt