diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e81e9b3d1..8b24db506 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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", "onedir-3005", "onedir-3006", "git-master", "latest"]' amazon-2: @@ -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", "onedir-3005", "onedir-3006", "git-master", "latest"]' debian-10: @@ -364,20 +364,6 @@ jobs: 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"]' - - fedora-36: name: Fedora 36 if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' @@ -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"]' 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"]' 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"]' gentoo: @@ -504,6 +490,34 @@ jobs: instances: '["stable-3003", "stable-3004", "stable-3005", "onedir-3005", "stable-3006", "onedir-3006", "latest"]' + 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"]' + + + 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"]' + + rockylinux-8: name: Rocky Linux 8 if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' @@ -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", "onedir-3005", "onedir-3006", "git-master", "latest"]' ubuntu-2004: @@ -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 f21ace903..ba051048a 100755 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -16,7 +16,6 @@ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -26,6 +25,8 @@ "opensuse-tumbleweed", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -55,7 +56,6 @@ "centos-stream8", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -65,6 +65,8 @@ "opensuse-tumbleweed", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", "ubuntu-2004", "ubuntu-2204", @@ -79,8 +81,13 @@ "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 +105,8 @@ "debian-11", "oraclelinux-7", "oraclelinux-8", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -109,7 +118,6 @@ "arch", "centos-stream9", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -117,6 +125,8 @@ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2204", @@ -129,7 +139,6 @@ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -137,6 +146,8 @@ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-8", "rockylinux-9", "ubuntu-2004", @@ -148,7 +159,6 @@ "almalinux-9", "arch", "centos-stream9", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -156,12 +166,13 @@ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "rockylinux-9", ] BLACKLIST_3005 = [ "arch", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -169,6 +180,8 @@ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", ] BLACKLIST_GIT_3004 = [ @@ -178,7 +191,6 @@ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -190,6 +202,8 @@ "ubuntu-2110", "ubuntu-2204", "rockylinux-9", + "photon-3", + "photon-4", ] BLACKLIST_GIT_3005 = [ @@ -197,7 +211,6 @@ "arch", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -205,6 +218,8 @@ "gentoo-systemd", "opensuse-15", "opensuse-tumbleweed", + "photon-3", + "photon-4", "ubuntu-2004", "ubuntu-2110", "ubuntu-2204", @@ -212,10 +227,6 @@ BLACKLIST_3006 = [ "arch", - "fedora-35", - "fedora-36", - "fedora-37", - "fedora-38", "gentoo", "gentoo-systemd", "opensuse-15", @@ -229,7 +240,6 @@ "centos-stream9", "debian-10", "debian-11", - "fedora-35", "fedora-36", "fedora-37", "fedora-38", @@ -237,12 +247,16 @@ "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 +315,7 @@ "rockylinux-8", ] -LATEST_PKG_BLACKLIST = [ - "almalinux-9", - "centos-stream9", - "rockylinux-9", -] +LATEST_PKG_BLACKLIST = [] DISTRO_DISPLAY_NAMES = { "almalinux-8": "AlmaLinux 8", @@ -317,7 +327,6 @@ "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 +336,8 @@ "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", @@ -566,10 +577,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 +595,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 +605,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 diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 2b056a2c1..93d4bf12e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2153,6 +2153,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 @@ -2678,7 +2687,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() { @@ -4185,6 +4194,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 @@ -4449,9 +4493,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 } @@ -6738,6 +6846,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 615a8b267..7a0886327 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