diff --git a/AUTHORS.rst b/AUTHORS.rst index b96b08f..fe59f7c 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -12,6 +12,7 @@ Adam Wright hipikat adam@hipikat.org Alec Koumjian akoumjian akoumjian@gmail.com Alex Van't Hof alexvh Alexander Krasnukhin themalkolm the.malkolm@gmail.com +Alexey dmitrievav Angelo Gründler plueschopath angelo.gruendler@w1r3.net Ari Aosved devaos ari.aosved@gmail.com Beau Hargis beaucephus beau@customermobile.com @@ -35,6 +36,7 @@ denmat denmat Denys Havrysh vutny denys.gavrysh@gmail.com deployboy deployboy Diego Woitasen diegows diego@flugel.it +ek9 ek9 Elias Probst eliasp eliezerlp eliezerlp Emiel Kollof ekollof @@ -66,8 +68,9 @@ lomeroe lomeroe Liu Xiaohui oreh herolxh@gmail.com Lubomir Host lhost Marc Vieira-Cardinal marccadinal -Mark Lee malept +Marco Molteni marco-m Marcus Furlong furlongm furlongm@gmail.com +Mark Lee malept markgaylard markgaylard Matt Black mafrosis Matthew Garrett cingeyedog matt@clemson.edu diff --git a/ChangeLog b/ChangeLog index 785189d..7e35cb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Version 2017.01.10: + * Update AUTHORS.rst with new contributors (rallytime) #1011 + * fix bootstrap in Arch Linux by updating package name from salt-zmq to salt (ek9) #1007 + * Add python-systemd package to debian 8 git install (rallytime) #1003 + * Updated supported versions for Ubuntu: 12.04, 14.04, 16.04, and 16.10 (best effort) (rallytime) #1002 + * Add "yakkety" to ubuntu_codename_translation function (rallytime) #1001 + * Update supported versions for Fedora: 23, 24, and 25. (rallytime) #1000 + * Handle renaming of gnupg-curl to gnupg1-curl for Ubuntu 16.10 (marco-m) #998 + * fix systemctl path (dmitrievav) #997 + * Drop unnecessary workarounds (creating directories) for early releases (vutny) #995 + * Let's detect newly released Salt 2016.11 stable release (vutny) #994 + * Adjust code examples to use the actual bootstrap-salt.sh file name (rallytime) #993 + * Install TLS certs before cloning git repo via https (vutny) #991 + * Remove fix me comment and fix systemsmanagement link (rallytime) #990 + * Correct usage description about "config only" mode (vutny) #989 + * Fix overwriting Minion config from temporarily directory (vutny) #988 + * Configure Salt components after the dependencies installation (vutny) #987 + * Add CloudLinux support (rallytime) #986 + * Apply the insecure flag to git as well (cachedout) #981 + Version 2016.10.25: * Update AUTHORS.rst with new contributors (rallytime) #978 * Let's start detecting the upcoming Debian 9 (Stretch) (lhost) #975 diff --git a/README.rst b/README.rst index 951f9e0..6eb2b7b 100644 --- a/README.rst +++ b/README.rst @@ -58,37 +58,37 @@ Using ``curl`` to install latest development version from GitHub: .. code:: console - curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh git develop + curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh git develop If you want to install a specific release version (based on the Git tags): .. code:: console - curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh git v2016.3.2 + curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh git v2016.3.2 To install a specific branch from a Git fork: .. code:: console - curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh -g https://github.com/myuser/salt.git git mybranch + curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh -g https://github.com/myuser/salt.git git mybranch If all you want is to install a ``salt-master`` using latest Git: .. code:: console - curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh -M -N git develop + curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh -M -N git develop If your host has Internet access only via HTTP proxy: .. code:: console PROXY='http://user:password@myproxy.example.com:3128' - curl -o bootstrap_salt.sh -L -x "$PROXY" https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh -H "$PROXY" git + curl -o bootstrap-salt.sh -L -x "$PROXY" https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh -H "$PROXY" git Install using wget @@ -98,15 +98,15 @@ Using ``wget`` to install your distribution's stable packages: .. code:: console - wget -O bootstrap_salt.sh https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh + wget -O bootstrap-salt.sh https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh Installing a specific version from git using ``wget``: .. code:: console - wget -O bootstrap_salt.sh https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh -P git v2015.8.11 + wget -O bootstrap-salt.sh https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh -P git v2015.8.11 .. note:: @@ -121,15 +121,15 @@ If you already have Python installed, ``python 2.6``, then it's as easy as: .. code:: console - python -m urllib "https://bootstrap.saltstack.com" > bootstrap_salt.sh - sudo sh bootstrap_salt.sh git develop + python -m urllib "https://bootstrap.saltstack.com" > bootstrap-salt.sh + sudo sh bootstrap-salt.sh git develop All Python versions should support the following in-line code: .. code:: console - python -c 'import urllib; print urllib.urlopen("https://bootstrap.saltstack.com").read()' > bootstrap_salt.sh - sudo sh bootstrap_salt.sh git develop + python -c 'import urllib; print urllib.urlopen("https://bootstrap.saltstack.com").read()' > bootstrap-salt.sh + sudo sh bootstrap-salt.sh git develop Install using fetch @@ -140,8 +140,8 @@ have ``fetch`` available though: .. code:: console - fetch -o bootstrap_salt.sh https://bootstrap.saltstack.com - sudo sh bootstrap_salt.sh + fetch -o bootstrap-salt.sh https://bootstrap.saltstack.com + sudo sh bootstrap-salt.sh If you have any SSL issues install ``ca_root_nssp``: @@ -200,7 +200,7 @@ Supported Operating Systems .. note:: Bootstrap may fail to install Salt on the cutting-edge version of distributions with frequent - release cycle, such as: Amazon Linux, Fedora, openSUSE Tumbleweed or Ubuntu non-LTS. Check the + release cycles such as: Amazon Linux, Fedora, openSUSE Tumbleweed, or Ubuntu non-LTS. Check the versions from the list below. Also, see the `Unsupported Distro`_ and `Adding Support for Other Operating Systems`_ sections. @@ -216,8 +216,8 @@ Debian and derivatives .. note:: Installation of Salt packages on Debian 8 based distribution from repo.saltstack.com repository - is currently supported for ``amd64`` (``x86-64``) and ``armhf`` architechtures ONLY. Use ``git`` - bootstrap mode as described above to install Salt on other architechtures, such as ``i386`` or + is currently supported for ``amd64`` (``x86-64``) and ``armhf`` architectures ONLY. Use ``git`` + bootstrap mode as described above to install Salt on other architectures, such as ``i386`` or ``armel``. You also may need to disable repository configuration and allow ``pip`` installations by providing ``-r`` and ``-P`` options to the bootstrap script, i.e.: @@ -231,7 +231,7 @@ Red Hat family - Amazon Linux 2012.09/2013.03/2013.09/2014.03/2014.09 - CentOS 5/6/7 -- Fedora 17/18/20/21/22 +- Fedora 23/24/25 - Oracle Linux 5/6/7 - Red Hat Enterprise Linux 5/6/7 - Scientific Linux 5/6/7 @@ -251,9 +251,22 @@ Ubuntu and derivatives - Elementary OS 0.2 (based on Ubuntu 12.04) - Linaro 12.04 -- Linux Mint 13/14/16/17/18 +- Linux Mint 13/17/18 - Trisquel GNU/Linux 6 (based on Ubuntu 12.04) -- Ubuntu 10.x/11.x/12.x/13.x/14.x/15.x/16.04 +- Ubuntu 12.04/14.04/16.04 + +Ubuntu Best Effort Support: Non-LTS Releases +******************************************** + +This script provides best-effort support for current, non-LTS Ubuntu releases. If package +repositories are not provided on `SaltStack's Ubuntu repository`_ for the non-LTS release, the +bootstrap script will attempt to install the packages for the most closely related LTS Ubuntu +release instead. + +For example, when installing Salt on Ubuntu 16.10, the bootstrap script will setup the repository +for Ubuntu 16.04 from `SaltStack's Ubuntu repository`_ and install the 16.04 packages. + +.. _`SaltStack's Ubuntu repository`: http://repo.saltstack.com/#ubuntu Other Linux distro @@ -479,8 +492,8 @@ version. .. code:: console - curl -o bootstrap_salt.sh -L https://bootstrap.saltstack.com/develop - sudo sh bootstrap_salt.sh git develop + curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com/develop + sudo sh bootstrap-salt.sh git develop Or the insecure one liner: diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1028a33..cc1c4ff 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -9,7 +9,7 @@ # # BUGS: https://github.com/saltstack/salt-bootstrap/issues # -# COPYRIGHT: (c) 2012-2016 by the SaltStack Team, see AUTHORS.rst for more +# COPYRIGHT: (c) 2012-2017 by the SaltStack Team, see AUTHORS.rst for more # details. # # LICENSE: Apache 2.0 @@ -18,7 +18,7 @@ #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2016.10.25" +__ScriptVersion="2017.01.10" __ScriptName="bootstrap-salt.sh" __ScriptFullName="$0" @@ -309,9 +309,10 @@ __usage() { -F Allow copied files to overwrite existing (config, init.d, etc) -K If set, keep the temporary files in the temporary directories specified with -c and -k - -C Only run the configuration function. This option automatically bypasses - any installation. Implies -F (forced overwrite). To overwrite master or - syndic configs, -M or -S, respectively, must also be specified. + -C Only run the configuration function. Implies -F (forced overwrite). + To overwrite Master or Syndic configs, -M or -S, respectively, must + also be specified. Salt installation will be ommitted, but some of the + dependencies could be installed to write configuration with -j or -J. -A Pass the salt-master DNS name or IP. This will be stored under \${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf -i Pass the salt-minion id. This will be stored under @@ -342,12 +343,12 @@ __usage() { repo.saltstack.com. The option passed with -R replaces the "repo.saltstack.com". If -R is passed, -r is also set. Currently only works on CentOS/RHEL based distributions. - -J Replace the Master config file with data passed in as a json string. If + -J Replace the Master config file with data passed in as a JSON string. If a Master config file is found, a reasonable effort will be made to save the file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" file will be created as either of those options will force a complete overwrite of the file. - -j Replace the Minion config file with data passed in as a json string. If + -j Replace the Minion config file with data passed in as a JSON string. If a Minion config file is found, a reasonable effort will be made to save the file with a ".bak" extension. If used in conjunction with -C or -F, no ".bak" file will be created as either of those options will force @@ -475,7 +476,7 @@ fi # Check that we're installing or configuring a master if we're being passed a master config json dict if [ "$_CUSTOM_MASTER_CONFIG" != "null" ]; then if [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then - echoerror "Don't pass a master config json dict (-J) if no master is going to be bootstrapped or configured." + echoerror "Don't pass a master config JSON dict (-J) if no master is going to be bootstrapped or configured." exit 1 fi fi @@ -483,7 +484,7 @@ fi # Check that we're installing or configuring a minion if we're being passed a minion config json dict if [ "$_CUSTOM_MINION_CONFIG" != "null" ]; then if [ "$_INSTALL_MINION" -eq $BS_FALSE ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then - echoerror "Don't pass a minion config json dict (-j) if no minion is going to be bootstrapped or configured." + echoerror "Don't pass a minion config JSON dict (-j) if no minion is going to be bootstrapped or configured." exit 1 fi fi @@ -850,7 +851,7 @@ __derive_debian_numeric_version() { # DESCRIPTION: Strip single or double quotes from the provided string. #---------------------------------------------------------------------------------------------------------------------- __unquote_string() { - echo "$*" | sed -e "s/^\([\"']\)\(.*\)\1\$/\2/g" + echo "$*" | sed -e "s/^\([\"\']\)\(.*\)\1\$/\2/g" } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -924,6 +925,8 @@ __gather_linux_system_info() { DISTRO_NAME=$(lsb_release -si) if [ "${DISTRO_NAME}" = "Scientific" ]; then DISTRO_NAME="Scientific Linux" + elif [ "$(echo "$DISTRO_NAME" | grep ^CloudLinux)" != "" ]; then + DISTRO_NAME="Cloud Linux" elif [ "$(echo "$DISTRO_NAME" | grep ^RedHat)" != "" ]; then # Let's convert 'CamelCased' to 'Camel Cased' n=$(__camelcase_split "$DISTRO_NAME") @@ -1037,6 +1040,9 @@ __gather_linux_system_info() { n="Arch Linux" v="" # Arch Linux does not provide a version. ;; + cloudlinux ) + n="Cloud Linux" + ;; debian ) n="Debian" v=$(__derive_debian_numeric_version "$v") @@ -1195,12 +1201,6 @@ __ubuntu_derivatives_translation() { # Mappings trisquel_6_ubuntu_base="12.04" linuxmint_13_ubuntu_base="12.04" - linuxmint_14_ubuntu_base="12.10" - #linuxmint_15_ubuntu_base="13.04" - # Bug preventing add-apt-repository from working on Mint 15: - # https://bugs.launchpad.net/linuxmint/+bug/1198751 - - linuxmint_16_ubuntu_base="13.10" linuxmint_17_ubuntu_base="14.04" linuxmint_18_ubuntu_base="16.04" linaro_12_ubuntu_base="12.04" @@ -1258,15 +1258,12 @@ __ubuntu_codename_translation() { "14") DISTRO_CODENAME="trusty" ;; - "15") - if [ -n "$_april" ]; then - DISTRO_CODENAME="vivid" - else - DISTRO_CODENAME="wily" - fi - ;; "16") - DISTRO_CODENAME="xenial" + if [ "$_april" ]; then + DISTRO_CODENAME="xenial" + else + DISTRO_CODENAME="yakkety" + fi ;; *) DISTRO_CODENAME="trusty" @@ -1453,6 +1450,14 @@ if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]);then exit 1 fi +# Starting from Ubuntu 16.10, gnupg-curl has been renamed to gnupg1-curl. +GNUPG_CURL="gnupg-curl" +if ([ "${DISTRO_NAME_L}" = "ubuntu" ] && [ "${DISTRO_VERSION}" = "16.10" ]); then + GNUPG_CURL="gnupg1-curl" +fi + + + #--- FUNCTION ------------------------------------------------------------------------------------------------------- # NAME: __function_defined # DESCRIPTION: Checks if a function is defined within this scripts scope @@ -1497,7 +1502,7 @@ __apt_get_upgrade_noinput() { __apt_key_fetch() { url=$1 - __apt_get_install_noinput gnupg-curl || return 1 + __apt_get_install_noinput ${GNUPG_CURL} || return 1 # shellcheck disable=SC2086 apt-key adv ${_GPG_ARGS} --fetch-keys "$url"; return $? @@ -1561,6 +1566,10 @@ __yum_install_noinput() { __git_clone_and_checkout() { echodebug "Installed git version: $(git --version | awk '{ print $3 }')" + # Turn off SSL verification if -I flag was set for insecure downloads + if [ "$_INSECURE_DL" -eq $BS_TRUE ]; then + export GIT_SSL_NO_VERIFY=1 + fi __SALT_GIT_CHECKOUT_PARENT_DIR=$(dirname "${_SALT_GIT_CHECKOUT_DIR}" 2>/dev/null) __SALT_GIT_CHECKOUT_PARENT_DIR="${__SALT_GIT_CHECKOUT_PARENT_DIR:-/tmp/git}" @@ -1689,7 +1698,12 @@ __check_end_of_life_versions() { # Ubuntu versions not supported # # < 12.04 - if [ "$DISTRO_MAJOR_VERSION" -lt 12 ]; then + # 13.x, 15.x + # 12.10, 14.10 + if [ "$DISTRO_MAJOR_VERSION" -lt 12 ] || \ + [ "$DISTRO_MAJOR_VERSION" -eq 13 ] || \ + [ "$DISTRO_MAJOR_VERSION" -eq 15 ] || \ + ([ "$DISTRO_MAJOR_VERSION" -lt 16 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]); then echoerror "End of life distributions are not supported." echoerror "Please consider upgrading to the next stable. See:" echoerror " https://wiki.ubuntu.com/Releases" @@ -1726,7 +1740,7 @@ __check_end_of_life_versions() { fedora) # Fedora lower than 18 are no longer supported - if [ "$DISTRO_MAJOR_VERSION" -lt 18 ]; then + if [ "$DISTRO_MAJOR_VERSION" -lt 23 ]; then echoerror "End of life distributions are not supported." echoerror "Please consider upgrading to the next stable. See:" echoerror " https://fedoraproject.org/wiki/Releases" @@ -2284,49 +2298,30 @@ __enable_universe_repository() { echodebug "Enabling the universe repository" - # Ubuntu versions higher than 12.04 do not live in the old repositories - if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then - add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 - elif [ "$DISTRO_MAJOR_VERSION" -lt 11 ] && [ "$DISTRO_MINOR_VERSION" -lt 10 ]; then - # Below Ubuntu 11.10, the -y flag to add-apt-repository is not supported - add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 - else - add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 - fi - - add-apt-repository -y "deb http://old-releases.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 + add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" || return 1 return 0 } install_ubuntu_deps() { - if [ "$DISTRO_MAJOR_VERSION" -gt 12 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]); then + if [ "$DISTRO_MAJOR_VERSION" -gt 12 ]; then # Above Ubuntu 12.04 add-apt-repository is in a different package __apt_get_install_noinput software-properties-common || return 1 else __apt_get_install_noinput python-software-properties || return 1 fi - if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then __enable_universe_repository || return 1 # Versions starting with 2015.5.6 and 2015.8.1 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|latest|archive\/)')" = "" ]; then + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|2016\.11|latest|archive\/)')" = "" ]; then if [ "$DISTRO_MAJOR_VERSION" -lt 14 ]; then echoinfo "Installing Python Requests/Chardet from Chris Lea's PPA repository" - if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then - # Above Ubuntu 11.04 add a -y flag - add-apt-repository -y "ppa:chris-lea/python-requests" || return 1 - add-apt-repository -y "ppa:chris-lea/python-chardet" || return 1 - add-apt-repository -y "ppa:chris-lea/python-urllib3" || return 1 - add-apt-repository -y "ppa:chris-lea/python-crypto" || return 1 - else - add-apt-repository "ppa:chris-lea/python-requests" || return 1 - add-apt-repository "ppa:chris-lea/python-chardet" || return 1 - add-apt-repository "ppa:chris-lea/python-urllib3" || return 1 - add-apt-repository "ppa:chris-lea/python-crypto" || return 1 - fi + add-apt-repository -y "ppa:chris-lea/python-requests" || return 1 + add-apt-repository -y "ppa:chris-lea/python-chardet" || return 1 + add-apt-repository -y "ppa:chris-lea/python-urllib3" || return 1 + add-apt-repository -y "ppa:chris-lea/python-crypto" || return 1 fi fi @@ -2337,7 +2332,7 @@ install_ubuntu_deps() { # Minimal systems might not have upstart installed, install it __PACKAGES="upstart" - if [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then + if [ "$DISTRO_MAJOR_VERSION" -ge 16 ]; then __PACKAGES="${__PACKAGES} python2.7" fi if [ "$_VIRTUALENV_DIR" != "null" ]; then @@ -2349,6 +2344,9 @@ install_ubuntu_deps() { # requests is still used by many salt modules __PACKAGES="${__PACKAGES} python-requests" + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" + # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES="${__PACKAGES} procps pciutils" @@ -2365,7 +2363,7 @@ install_ubuntu_deps() { } install_ubuntu_stable_deps() { - if ([ "${_SLEEP}" -eq "${__DEFAULT_SLEEP}" ] && [ "$DISTRO_MAJOR_VERSION" -lt 15 ]); then + if [ "${_SLEEP}" -eq "${__DEFAULT_SLEEP}" ] && [ "$DISTRO_MAJOR_VERSION" -lt 16 ]; then # The user did not pass a custom sleep value as an argument, let's increase the default value echodebug "On Ubuntu systems we increase the default sleep value to 10." echodebug "See https://github.com/saltstack/salt/issues/12248 for more info." @@ -2408,12 +2406,12 @@ install_ubuntu_stable_deps() { fi # Versions starting with 2015.5.6, 2015.8.1 and 2016.3.0 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|latest|archive\/)')" != "" ]; then + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|2016\.11|latest|archive\/)')" != "" ]; then # Workaround for latest non-LTS ubuntu - if [ "$DISTRO_MAJOR_VERSION" -eq 15 ]; then + if [ "$DISTRO_VERSION" = "16.10" ]; then echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems." - UBUNTU_VERSION=14.04 - UBUNTU_CODENAME=trusty + UBUNTU_VERSION=16.04 + UBUNTU_CODENAME=xenial else UBUNTU_VERSION=$DISTRO_VERSION UBUNTU_CODENAME=$DISTRO_CODENAME @@ -2439,12 +2437,7 @@ install_ubuntu_stable_deps() { STABLE_PPA="saltstack/salt" fi - if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then - # Above Ubuntu 11.04 add a -y flag - add-apt-repository -y "ppa:$STABLE_PPA" || return 1 - else - add-apt-repository "ppa:$STABLE_PPA" || return 1 - fi + add-apt-repository -y "ppa:$STABLE_PPA" || return 1 fi apt-get update @@ -2456,24 +2449,17 @@ install_ubuntu_stable_deps() { install_ubuntu_daily_deps() { install_ubuntu_stable_deps || return 1 - if [ "$DISTRO_MAJOR_VERSION" -ge 12 ]; then - # Above Ubuntu 11.10 add-apt-repository is in a different package + if [ "$DISTRO_MAJOR_VERSION" -gt 12 ]; then __apt_get_install_noinput software-properties-common || return 1 else + # Ubuntu 12.04 needs python-software-properties to get add-apt-repository binary __apt_get_install_noinput python-software-properties || return 1 fi if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then __enable_universe_repository || return 1 - # for anything up to and including 11.04 do not use the -y option - if [ "$DISTRO_MAJOR_VERSION" -gt 11 ] || ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$DISTRO_MINOR_VERSION" -gt 04 ]); then - # Above Ubuntu 11.04 add a -y flag - add-apt-repository -y ppa:saltstack/salt-daily || return 1 - else - add-apt-repository ppa:saltstack/salt-daily || return 1 - fi - + add-apt-repository -y ppa:saltstack/salt-daily || return 1 apt-get update fi @@ -2486,7 +2472,15 @@ install_ubuntu_daily_deps() { install_ubuntu_git_deps() { apt-get update - __apt_get_install_noinput git-core || return 1 + + if ! __check_command_exists git; then + __apt_get_install_noinput git-core || return 1 + fi + + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + __apt_get_install_noinput ca-certificates + fi + __git_clone_and_checkout || return 1 __PACKAGES="" @@ -2569,12 +2563,6 @@ install_ubuntu_git() { } install_ubuntu_stable_post() { - # Workaround for latest LTS packages on latest ubuntu. Normally packages on - # debian-based systems will automatically start the corresponding daemons - if [ "$DISTRO_MAJOR_VERSION" -lt 15 ]; then - return 0 - fi - 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 @@ -2607,7 +2595,7 @@ install_ubuntu_git_post() { [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then + if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 16 ]; then __copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/deb/salt-${fname}.service" "/lib/systemd/system/salt-${fname}.service" # Skip salt-api since the service should be opt-in and not necessarily started on boot @@ -2652,7 +2640,7 @@ install_ubuntu_restart_daemons() { [ $_START_DAEMONS -eq $BS_FALSE ] && return # Ensure upstart configs / systemd units are loaded - if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then + if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 16 ]; then systemctl daemon-reload elif [ -f /sbin/initctl ]; then /sbin/initctl reload-configuration @@ -2667,7 +2655,7 @@ install_ubuntu_restart_daemons() { [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then + if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 16 ]; then echodebug "There's systemd support while checking salt-$fname" systemctl stop salt-$fname > /dev/null 2>&1 systemctl start salt-$fname.service @@ -2711,7 +2699,7 @@ install_ubuntu_check_services() { [ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue - if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 15 ]; then + if [ -f /bin/systemctl ] && [ "$DISTRO_MAJOR_VERSION" -ge 16 ]; then __check_services_systemd salt-$fname || return 1 elif [ -f /sbin/initctl ] && [ -f /etc/init/salt-${fname}.conf ]; then __check_services_upstart salt-$fname || return 1 @@ -2755,6 +2743,9 @@ install_debian_deps() { __PACKAGES="procps pciutils" __PIP_PACKAGES="" + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -2817,7 +2808,7 @@ install_debian_7_deps() { fi # Versions starting with 2015.8.7 and 2016.3.0 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.8|2016\.3|latest|archive\/201[5-6]\.)')" != "" ]; then + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.8|2016\.3|2016\.11|latest|archive\/201[5-6]\.)')" != "" ]; then # amd64 is just a part of repository URI, 32-bit pkgs are hosted under the same location SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/${DISTRO_MAJOR_VERSION}/${__REPO_ARCH}/${STABLE_REV}" echo "deb $SALTSTACK_DEBIAN_URL wheezy main" > "/etc/apt/sources.list.d/saltstack.list" @@ -2841,6 +2832,9 @@ install_debian_7_deps() { # Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813 __PACKAGES='procps pciutils' + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" + # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 @@ -2896,7 +2890,7 @@ install_debian_8_deps() { fi # Versions starting with 2015.5.6, 2015.8.1 and 2016.3.0 are hosted at repo.saltstack.com - if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|latest|archive\/201[5-6]\.)')" != "" ]; then + if [ "$(echo "$STABLE_REV" | egrep '^(2015\.5|2015\.8|2016\.3|2016\.11|latest|archive\/201[5-6]\.)')" != "" ]; then SALTSTACK_DEBIAN_URL="${HTTP_VAL}://repo.saltstack.com/apt/debian/${DISTRO_MAJOR_VERSION}/${__REPO_ARCH}/${STABLE_REV}" echo "deb $SALTSTACK_DEBIAN_URL jessie main" > "/etc/apt/sources.list.d/saltstack.list" @@ -2920,9 +2914,8 @@ install_debian_8_deps() { # shellcheck disable=SC2086 __apt_get_install_noinput ${__PACKAGES} || return 1 - if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - __apt_get_upgrade_noinput || return 1 - fi + # YAML module is used for generating custom master/minion configs + __PACKAGES="${__PACKAGES} python-yaml" if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" @@ -2938,10 +2931,14 @@ install_debian_git_deps() { __apt_get_install_noinput git || return 1 fi + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + __apt_get_install_noinput ca-certificates + fi + __git_clone_and_checkout || return 1 __PACKAGES="libzmq3 libzmq3-dev lsb-release python-apt python-backports.ssl-match-hostname python-crypto" - __PACKAGES="${__PACKAGES} python-jinja2 python-msgpack python-requests python-tornado" + __PACKAGES="${__PACKAGES} python-jinja2 python-msgpack python-requests" __PACKAGES="${__PACKAGES} python-tornado python-yaml python-zmq" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then @@ -2975,9 +2972,14 @@ install_debian_8_git_deps() { __apt_get_install_noinput git || return 1 fi + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + __apt_get_install_noinput ca-certificates + fi + __git_clone_and_checkout || return 1 - __PACKAGES='libzmq3 libzmq3-dev lsb-release python-apt python-crypto python-jinja2 python-msgpack python-requests python-yaml python-zmq' + __PACKAGES="libzmq3 libzmq3-dev lsb-release python-apt python-crypto python-jinja2 python-msgpack" + __PACKAGES="${__PACKAGES} python-requests python-systemd python-yaml python-zmq" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then # Install python-libcloud if asked to @@ -3184,16 +3186,7 @@ install_debian_check_services() { # Fedora Install Functions # -FEDORA_PACKAGE_MANAGER="yum" - -__fedora_get_package_manager() { - if [ "$DISTRO_MAJOR_VERSION" -ge 22 ] || __check_command_exists dnf; then - FEDORA_PACKAGE_MANAGER="dnf" - fi -} - install_fedora_deps() { - __fedora_get_package_manager if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then if [ "$_ENABLE_EXTERNAL_ZMQ_REPOS" -eq $BS_TRUE ]; then @@ -3203,32 +3196,25 @@ install_fedora_deps() { __install_saltstack_copr_salt_repository || return 1 fi - __PACKAGES="yum-utils PyYAML libyaml python-crypto python-jinja2 python-zmq" - - if [ "$DISTRO_MAJOR_VERSION" -ge 23 ]; then - __PACKAGES="${__PACKAGES} python2-msgpack python2-requests" - else - __PACKAGES="${__PACKAGES} python-msgpack python-requests" - fi + __PACKAGES="yum-utils PyYAML libyaml python-crypto python-jinja2 python-zmq python2-msgpack python2-requests" # shellcheck disable=SC2086 - $FEDORA_PACKAGE_MANAGER install -y ${__PACKAGES} || return 1 + dnf install -y ${__PACKAGES} || return 1 if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then - $FEDORA_PACKAGE_MANAGER -y update || return 1 + dnf -y update || return 1 fi if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 - $FEDORA_PACKAGE_MANAGER install -y ${_EXTRA_PACKAGES} || return 1 + dnf install -y ${_EXTRA_PACKAGES} || return 1 fi return 0 } install_fedora_stable() { - __fedora_get_package_manager __PACKAGES="" if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then @@ -3245,7 +3231,7 @@ install_fedora_stable() { fi # shellcheck disable=SC2086 - $FEDORA_PACKAGE_MANAGER install -y ${__PACKAGES} || return 1 + dnf install -y ${__PACKAGES} || return 1 return 0 } @@ -3267,11 +3253,15 @@ install_fedora_stable_post() { } install_fedora_git_deps() { - __fedora_get_package_manager + + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + dnf install -y ca-certificates || return 1 + fi + install_fedora_deps || return 1 if ! __check_command_exists git; then - $FEDORA_PACKAGE_MANAGER install -y git || return 1 + dnf install -y git || return 1 fi __git_clone_and_checkout || return 1 @@ -3299,7 +3289,7 @@ install_fedora_git_deps() { fi # shellcheck disable=SC2086 - $FEDORA_PACKAGE_MANAGER install -y ${__PACKAGES} || return 1 + dnf install -y ${__PACKAGES} || return 1 if [ "${__PIP_PACKAGES}" != "" ]; then # shellcheck disable=SC2086,SC2090 @@ -3449,7 +3439,13 @@ __install_saltstack_rhel_repository() { repo_url="repo.saltstack.com" fi - base_url="${HTTP_VAL}://${repo_url}/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + # Cloud Linux $releasever = 7.x, which doesn't exist in repo.saltstack.com, we need this to be "7" + if [ "${DISTRO_NAME}" = "Cloud Linux" ] && [ "${DISTRO_MAJOR_VERSION}" = "7" ]; then + base_url="${HTTP_VAL}://${repo_url}/yum/redhat/${DISTRO_MAJOR_VERSION}/\$basearch/${repo_rev}/" + else + base_url="${HTTP_VAL}://${repo_url}/yum/redhat/\$releasever/\$basearch/${repo_rev}/" + fi + fetch_url="${HTTP_VAL}://${repo_url}/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" if [ "${DISTRO_MAJOR_VERSION}" -eq 5 ]; then @@ -3528,14 +3524,23 @@ install_centos_stable_deps() { __PACKAGES="yum-utils chkconfig" - if [ "${_EXTRA_PACKAGES}" != "" ]; then - echoinfo "Also installing the following extra packages as requested: ${_EXTRA_PACKAGES}" - __PACKAGES="${__PACKAGES} ${_EXTRA_PACKAGES}" + # YAML module is used for generating custom master/minion configs + if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then + __PACKAGES="${__PACKAGES} python26-PyYAML" + else + __PACKAGES="${__PACKAGES} PyYAML" fi # 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 } @@ -3574,7 +3579,7 @@ install_centos_stable_post() { [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue if [ -f /bin/systemctl ]; then - /usr/systemctl is-enabled salt-${fname}.service > /dev/null 2>&1 || ( + /bin/systemctl is-enabled salt-${fname}.service > /dev/null 2>&1 || ( /bin/systemctl preset salt-${fname}.service > /dev/null 2>&1 && /bin/systemctl enable salt-${fname}.service > /dev/null 2>&1 ) @@ -3593,6 +3598,14 @@ install_centos_stable_post() { } install_centos_git_deps() { + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + if [ "$DISTRO_MAJOR_VERSION" -gt 5 ]; then + __yum_install_noinput ca-certificates || return 1 + else + __yum_install_noinput "openssl.${CPU_ARCH_L}" || return 1 + fi + fi + install_centos_stable_deps || return 1 if ! __check_command_exists git; then @@ -3604,10 +3617,10 @@ install_centos_git_deps() { __PACKAGES="" if [ "$DISTRO_MAJOR_VERSION" -eq 5 ]; then - __PACKAGES="${__PACKAGES} python26-PyYAML python26 python26-requests" - __PACKAGES="${__PACKAGES} python26-crypto python26-jinja2 python26-msgpack python26-tornado python26-zmq" + __PACKAGES="${__PACKAGES} python26 python26-crypto python26-jinja2 python26-msgpack python26-requests" + __PACKAGES="${__PACKAGES} python26-tornado python26-zmq" else - __PACKAGES="${__PACKAGES} PyYAML python-crypto python-futures python-msgpack python-zmq python-jinja2" + __PACKAGES="${__PACKAGES} python-crypto python-futures python-msgpack python-zmq python-jinja2" __PACKAGES="${__PACKAGES} python-requests python-tornado" fi @@ -4082,6 +4095,69 @@ install_scientific_linux_check_services() { # ####################################################################################################################### +####################################################################################################################### +# +# CloudLinux Install Functions +# +install_cloud_linux_stable_deps() { + install_centos_stable_deps || return 1 + return 0 +} + +install_cloud_linux_git_deps() { + install_centos_git_deps || return 1 + return 0 +} + +install_cloud_linux_testing_deps() { + install_centos_testing_deps || return 1 + return 0 +} + +install_cloud_linux_stable() { + install_centos_stable || return 1 + return 0 +} + +install_cloud_linux_git() { + install_centos_git || return 1 + return 0 +} + +install_cloud_linux_testing() { + install_centos_testing || return 1 + return 0 +} + +install_cloud_linux_stable_post() { + install_centos_stable_post || return 1 + return 0 +} + +install_cloud_linux_git_post() { + install_centos_git_post || return 1 + return 0 +} + +install_cloud_linux_testing_post() { + install_centos_testing_post || return 1 + return 0 +} + +install_cloud_linux_restart_daemons() { + install_centos_restart_daemons || return 1 + return 0 +} + +install_cloud_linux_check_services() { + install_centos_check_services || return 1 + return 0 +} +# +# End of CloudLinux Install Functions +# +####################################################################################################################### + ####################################################################################################################### # # Amazon Linux AMI Install Functions @@ -4089,6 +4165,10 @@ install_scientific_linux_check_services() { install_amazon_linux_ami_deps() { + # We need to install yum-utils before doing anything else when installing on + # Amazon Linux ECS-optimized images. See issue #974. + yum -y install yum-utils + ENABLE_EPEL_CMD="" if [ $_DISABLE_REPOS -eq $BS_TRUE ]; then ENABLE_EPEL_CMD="--enablerepo=${_EPEL_REPO}" @@ -4133,6 +4213,10 @@ _eof } install_amazon_linux_ami_git_deps() { + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + yum -y install ca-certificates || return 1 + fi + install_amazon_linux_ami_deps || return 1 ENABLE_EPEL_CMD="" @@ -4238,6 +4322,9 @@ install_arch_linux_stable_deps() { pacman-db-upgrade || return 1 fi + # YAML module is used for generating custom master/minion configs + pacman -Sy --noconfirm --needed python2-yaml + if [ "$_UPGRADE_SYS" -eq $BS_TRUE ]; then pacman -Syyu --noconfirm --needed || return 1 fi @@ -4262,7 +4349,7 @@ install_arch_linux_git_deps() { fi pacman -R --noconfirm python2-distribute pacman -Sy --noconfirm --needed python2-crypto python2-setuptools python2-jinja \ - python2-markupsafe python2-msgpack python2-psutil python2-yaml \ + python2-markupsafe python2-msgpack python2-psutil \ python2-pyzmq zeromq python2-requests python2-systemd || return 1 __git_clone_and_checkout || return 1 @@ -4293,7 +4380,7 @@ install_arch_linux_stable() { pacman -S --noconfirm --needed bash || return 1 pacman -Su --noconfirm || return 1 # We can now resume regular salt update - pacman -Syu --noconfirm salt-zmq || return 1 + pacman -Syu --noconfirm salt || return 1 return 0 } @@ -4515,6 +4602,10 @@ install_freebsd_9_stable_deps() { # shellcheck disable=SC2086 /usr/local/sbin/pkg install ${FROM_FREEBSD} -y swig || return 1 + # YAML module is used for generating custom master/minion configs + # shellcheck disable=SC2086 + /usr/local/sbin/pkg install ${FROM_FREEBSD} -y py27-yaml || return 1 + if [ "${_EXTRA_PACKAGES}" != "" ]; then echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}" # shellcheck disable=SC2086 @@ -5027,8 +5118,7 @@ __ZYPPER_REQUIRES_REPLACE_FILES=-1 __set_suse_pkg_repo() { suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo" if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then - # FIXME: cleartext download over unsecure protocol (HTTP) - suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:saltstack" + suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:/saltstack" else suse_pkg_url_base="${HTTP_VAL}://repo.saltstack.com/opensuse" fi @@ -5127,6 +5217,10 @@ install_opensuse_stable_deps() { } install_opensuse_git_deps() { + if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then + __zypper_install ca-certificates || return 1 + fi + install_opensuse_stable_deps || return 1 if ! __check_command_exists git; then @@ -5917,7 +6011,7 @@ config_salt() { # Copy the minions configuration if found # Explicitly check for custom master config to avoid moving the minion config elif [ -f "$_TEMP_CONFIG_DIR/minion" ] && [ "$_CUSTOM_MASTER_CONFIG" = "null" ]; then - __movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" "$_CONFIG_ONLY" || return 1 + __movefile "$_TEMP_CONFIG_DIR/minion" "$_SALT_ETC_DIR" "$_FORCE_OVERWRITE" || return 1 CONFIGURED_ANYTHING=$BS_TRUE fi @@ -6008,9 +6102,6 @@ config_salt() { exit 0 fi - # Create default logs directory if not exists - mkdir -p /var/log/salt - return 0 } # @@ -6116,7 +6207,7 @@ for FUNC_NAME in $(__strip_duplicates "$DEP_FUNC_NAMES"); do done echodebug "DEPS_INSTALL_FUNC=${DEPS_INSTALL_FUNC}" -# Let's get the minion config function +# Let's get the Salt config function CONFIG_FUNC_NAMES="config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_salt" CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_salt" CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_salt" @@ -6265,6 +6356,16 @@ if [ "$_CUSTOM_MASTER_CONFIG" != "null" ] || [ "$_CUSTOM_MINION_CONFIG" != "null if [ "$_TEMP_CONFIG_DIR" = "null" ]; then _TEMP_CONFIG_DIR="$_SALT_ETC_DIR" fi + + if [ "$_CONFIG_ONLY" -eq $BS_TRUE ]; then + # Execute function to satisfy dependencies for configuration step + echoinfo "Running ${DEPS_INSTALL_FUNC}()" + $DEPS_INSTALL_FUNC + if [ $? -ne 0 ]; then + echoerror "Failed to run ${DEPS_INSTALL_FUNC}()!!!" + exit 1 + fi + fi fi # Configure Salt @@ -6277,7 +6378,21 @@ if [ "$CONFIG_SALT_FUNC" != "null" ] && [ "$_TEMP_CONFIG_DIR" != "null" ]; then fi fi -# Pre-Seed master keys +# Drop the master address if passed +if [ "$_SALT_MASTER_ADDRESS" != "null" ]; then + [ ! -d "$_SALT_ETC_DIR/minion.d" ] && mkdir -p "$_SALT_ETC_DIR/minion.d" + cat <<_eof > $_SALT_ETC_DIR/minion.d/99-master-address.conf +master: $_SALT_MASTER_ADDRESS +_eof +fi + +# Drop the minion id if passed +if [ "$_SALT_MINION_ID" != "null" ]; then + [ ! -d "$_SALT_ETC_DIR" ] && mkdir -p "$_SALT_ETC_DIR" + echo "$_SALT_MINION_ID" > "$_SALT_ETC_DIR/minion_id" +fi + +# Pre-seed master keys if [ "$PRESEED_MASTER_FUNC" != "null" ] && [ "$_TEMP_KEYS_DIR" != "null" ]; then echoinfo "Running ${PRESEED_MASTER_FUNC}()" $PRESEED_MASTER_FUNC @@ -6298,29 +6413,6 @@ if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then fi fi -# Ensure that the cachedir exists -# (Workaround for https://github.com/saltstack/salt/issues/6502) -if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then - if [ ! -d "${_SALT_CACHE_DIR}/minion/proc" ]; then - echodebug "Creating salt's cachedir" - mkdir -p "${_SALT_CACHE_DIR}/minion/proc" - fi -fi - -# Drop the master address if passed -if [ "$_SALT_MASTER_ADDRESS" != "null" ]; then - [ ! -d "$_SALT_ETC_DIR/minion.d" ] && mkdir -p "$_SALT_ETC_DIR/minion.d" - cat <<_eof > $_SALT_ETC_DIR/minion.d/99-master-address.conf -master: $_SALT_MASTER_ADDRESS -_eof -fi - -# Drop the minion id if passed -if [ "$_SALT_MINION_ID" != "null" ]; then - [ ! -d "$_SALT_ETC_DIR" ] && mkdir -p "$_SALT_ETC_DIR" - echo "$_SALT_MINION_ID" > "$_SALT_ETC_DIR/minion_id" -fi - # Run any post install function. Only execute function if not in config mode only if [ "$POST_INSTALL_FUNC" != "null" ] && [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then echoinfo "Running ${POST_INSTALL_FUNC}()"