Merge pull request #1422 from s0undt3ch/stable

Merge the develop branch for stable release
This commit is contained in:
Pedro Algarvio 2020-01-29 17:20:07 +00:00 committed by GitHub
commit cca21c02eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 4741 additions and 85 deletions

4094
.github/.workflows/main.yml vendored Normal file

File diff suppressed because it is too large Load diff

198
.github/.workflows/templates/generate.py vendored Executable file
View file

@ -0,0 +1,198 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import datetime
os.chdir(os.path.abspath(os.path.dirname(__file__)))
LINUX_DISTROS = [
# 'amazon-1',
'amazon-2',
'arch',
'centos-6',
'centos-7',
'centos-8',
'debian-10',
'debian-8',
'debian-9',
'fedora-30',
#'fedora-31',
'opensuse-15',
'ubuntu-1604',
'ubuntu-1804'
]
OSX = WINDOWS = []
STABLE_DISTROS = [
'amazon-1',
'amazon-2',
'centos-6',
'centos-7',
'centos-8',
'debian-10',
'debian-8',
'debian-9',
'fedora-30',
'fedora-31',
'ubuntu-1604',
'ubuntu-1804',
]
PY2_BLACKLIST = [
'centos-8',
'debian-10',
'fedora-31',
]
PY3_BLACKLIST = [
'amazon-1',
'centos-6',
'debian-8',
'opensuse-15'
]
BLACKLIST_2018 = [
'amazon-2',
'centos-8',
'debian-10',
]
SALT_BRANCHES = [
'2018-3',
'2019-2',
'3000',
'latest'
]
BRANCH_DISPLAY_NAMES = {
'2018-3': 'v2018.3',
'2019-2': 'v2019.2',
'3000': 'v3000',
'latest': 'Latest'
}
STABLE_BRANCH_BLACKLIST = [
'3000'
]
LATEST_PKG_BLACKLIST = [
'arch', # No packages are built
'centos-8', # Once Neon is out, this can be removed from here
'debian-10' # Once Neon is out, this can be removed from here
]
DISTRO_DISPLAY_NAMES = {
'amazon-1': 'Amazon 1',
'amazon-2': 'Amazon 2',
'arch': 'Arch',
'centos-6': 'CentOS 6',
'centos-7': 'CentOS 7',
'centos-8': 'CentOS 8',
'debian-10': 'Debian 10',
'debian-8': 'Debian 8',
'debian-9': 'Debian 9',
'fedora-30': 'Fedora 30',
'fedora-31': 'Fedora 31',
'opensuse-15': 'Opensuse 15',
'ubuntu-1604': 'Ubuntu 16.04',
'ubuntu-1804': 'Ubuntu 18.04'
}
def generate_test_jobs():
test_jobs = ''
for distro in LINUX_DISTROS + OSX + WINDOWS:
for branch in SALT_BRANCHES:
if branch == 'latest':
if distro in LATEST_PKG_BLACKLIST:
continue
if distro in LINUX_DISTROS:
template = 'linux.yml'
elif distro in OSX:
template = 'osx.yml'
elif distro in WINDOWS:
template = 'windows.yml'
else:
print("Don't know how to handle {}".format(distro))
with open(template) as rfh:
test_jobs += '\n{}\n'.format(
rfh.read().replace(
'{python_version}-{bootstrap_type}-{branch}-{distro}',
'{branch}-{distro}'
).format(
distro=distro,
branch=branch,
display_name='{} Latest packaged release'.format(
DISTRO_DISPLAY_NAMES[distro],
)
)
)
continue
for python_version in ('py2', 'py3'):
for bootstrap_type in ('stable', 'git'):
if bootstrap_type == 'stable' and distro not in STABLE_DISTROS:
continue
if bootstrap_type == 'stable' and branch in STABLE_BRANCH_BLACKLIST:
continue
if branch == '2018-3' and distro in BLACKLIST_2018:
continue
if python_version == 'py2' and distro in PY2_BLACKLIST:
continue
if python_version == 'py3' and distro in PY3_BLACKLIST:
continue
if distro in LINUX_DISTROS:
template = 'linux.yml'
elif distro in OSX:
template = 'osx.yml'
elif distro in WINDOWS:
template = 'windows.yml'
else:
print("Don't know how to handle {}".format(distro))
with open(template) as rfh:
test_jobs += '\n{}\n'.format(
rfh.read().format(
distro=distro,
branch=branch,
python_version=python_version,
bootstrap_type=bootstrap_type,
display_name='{} {} {} {}'.format(
DISTRO_DISPLAY_NAMES[distro],
BRANCH_DISPLAY_NAMES[branch],
python_version.capitalize(),
bootstrap_type.capitalize()
)
)
)
with open('lint.yml') as rfh:
lint_job = '\n{}\n'.format(rfh.read())
with open('pre-commit.yml') as rfh:
pre_commit_job = '\n{}\n'.format(rfh.read())
with open('../main.yml', 'w') as wfh:
with open('main.yml') as rfh:
wfh.write(
'{}\n'.format(
rfh.read().format(
jobs='{pre_commit}{lint}{test}'.format(
lint=lint_job,
test=test_jobs,
pre_commit=pre_commit_job,
)
).strip()
)
)
if __name__ == '__main__':
generate_test_jobs()

12
.github/.workflows/templates/lint.yml vendored Normal file
View file

@ -0,0 +1,12 @@
lint:
name: Lint
runs-on: ubuntu-latest
needs: generate-actions-workflow
container: koalaman/shellcheck-alpine:v0.6.0
steps:
- uses: actions/checkout@v1
- name: ShellCheck
run: |
shellcheck -s sh -f checkstyle bootstrap-salt.sh

43
.github/.workflows/templates/linux.yml vendored Normal file
View file

@ -0,0 +1,43 @@
{python_version}-{bootstrap_type}-{branch}-{distro}:
name: {display_name}
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v1
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install Bundler
run: |
gem install bundler
- name: Setup Bundle
run: |
bundle install --with docker --without opennebula ec2 windows vagrant
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python Dependencies
run: |
pip install -U pip
pip install -r tests/requirements.txt
- name: Create Test Container
run: |
bundle exec kitchen create {python_version}-{bootstrap_type}-{branch}-{distro} || bundle exec kitchen create {python_version}-{bootstrap_type}-{branch}-{distro}
- name: Test Bootstrap In Test Container
run: |
bundle exec kitchen verify {python_version}-{bootstrap_type}-{branch}-{distro}
- name: Destroy Test Container
if: always()
run: |
bundle exec kitchen destroy {python_version}-{bootstrap_type}-{branch}-{distro}

10
.github/.workflows/templates/main.yml vendored Normal file
View file

@ -0,0 +1,10 @@
# DO NOT EDIT THIS FILE DIRECTLY!
#
# This file was generated by .github/workflows/templates/generate.py
name: Testing
on: [push, pull_request]
jobs:
{jobs}

View file

@ -0,0 +1,20 @@
generate-actions-workflow:
name: Generate The Actions Workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Pre-Commit
run: |
pip install -U pip
pip install pre-commit
pre-commit install
- name: Generate Workflow Actions
run: |
pre-commit run -av generate-actions-workflow

View file

@ -7,4 +7,3 @@ Remove this section if not relevant
### New Behavior
Remove this section if not relevant

1
.github/stale.yml vendored
View file

@ -30,4 +30,3 @@ closeComment: false
# Limit to only `issues` or `pulls`
only: issues

View file

@ -105,6 +105,9 @@ suites:
- name: py2-git-2019-2
provisioner:
salt_version: 2019.2
- name: py2-git-3000
provisioner:
salt_version: 3000
- name: py2-git-master
provisioner:
salt_version: master
@ -122,6 +125,7 @@ suites:
excludes:
- arch
- opensuse-15
- name: py3-git-2018-3
provisioner:
salt_version: 2018.3
@ -132,6 +136,15 @@ suites:
- debian-8
- opensuse-15
- amazon-2
- name: py3-git-3000
provisioner:
salt_version: 3000
salt_bootstrap_options: -x python3 -MPfq git %s
excludes:
- amazon-1
- centos-6
- debian-8
- opensuse-15
- name: py3-git-2019-2
provisioner:
salt_version: 2019.2
@ -162,6 +175,13 @@ suites:
- opensuse-15
- arch
- name: latest
provisioner:
salt_version: latest
salt_bootstrap_options: -MP stable %s
excludes:
- arch
verifier:
name: shell
remote_exec: false

27
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,27 @@
---
minimum_pre_commit_version: 1.15.2
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
args: [--markdown-linebreak-ext=md]
- id: mixed-line-ending # Replaces or checks mixed line ending.
args: [--fix=lf]
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline.
- repo: local
hooks:
- id: generate-actions-workflow
name: Generate Github Actions Workflow
entry: .github/workflows/templates/generate.py
pass_filenames: false
files: '.github/workflows/templates/.*'
language: script
- id: shellcheck
name: Run ShellCheck against bootstrap-salt.sh
entry: koalaman/shellcheck-alpine:v0.6.0 shellcheck -s sh -f tty
files: 'bootstrap-salt\.sh'
language: docker_image

View file

@ -15,7 +15,7 @@ The Salt Bootstrap issue tracker is used for feature requests and bug reports.
A bug is a *demonstrable problem* that is caused by the code in the repository.
Please read the following guidelines before you
Please read the following guidelines before you
[file an issue](https://github.com/saltstack/salt-bootstrap/issues/new).
1. **Use the GitHub issue search** -- check if the issue has
@ -25,7 +25,7 @@ Please read the following guidelines before you
please try to bootstrap using the bootstrap scirpt from the develop branch. The
issue you are having might have already been fixed and it's just not yet included
in the stable release.
```
curl -o bootstrap-salt.sh -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.sh
sudo sh bootstrap-salt.sh git develop
@ -73,7 +73,7 @@ easily solved another way, which is a great reason to ask first.
Fixes for issues are very welcome!
Once you've fixed the issue you have in hand, create a
Once you've fixed the issue you have in hand, create a
[pull request](https://help.github.com/articles/creating-a-pull-request/).
Salt Bootstrap maintainers will review your fix. If everything is OK and all
@ -102,7 +102,7 @@ repo from the PR, etc.
#### Lint Check
The pull request test that matters the most, and the contributor is directly
The pull request test that matters the most, and the contributor is directly
responsible for fixing, is the Lint check. This check *must* be passing before
the contribution can be merged into the codebase.
@ -149,7 +149,7 @@ Typically, SaltStack's release team determines when it would be good to release
a new stable version.
Timing the release usually involves an analysis of the following:
- Updates for major feature releases in [Salt](https://github.com/saltstack/salt)
- Support for new versions of major operating systems
- Types of fixes submitted to `develop` since the last release

View file

@ -1,14 +1,18 @@
Version TBD (In Progress on the Develop Branch):
Version 2020.01.29:
* FreeBSD fixes (cedwards) #1413
* Support the upcoming Neon release (s0undt3ch) #1420
Version 2020.01.21:
* FreeBSD fixes (kgbsd) #1376
* Fix macOS support (s0undt3ch) #1397
* FreeBSD fixes (kgbsd) #1376
* Fix macOS support (s0undt3ch) #1397
Version 2019.11.04:
* Fix busybox mktemp compatibility (stanzgy) #1369
* Install debian 10 packages on debian 10 instead of 9 (kiemlicz) #1375
* move centos to python36, use python specified by -x (Ch3LL,bryceml) #1380
* Add debian 10 git install support (Ch3LL) #1378
* Fix busybox mktemp compatibility (stanzgy) #1369
* Install debian 10 packages on debian 10 instead of 9 (kiemlicz) #1375
* move centos to python36, use python specified by -x (Ch3LL,bryceml) #1380
* Add debian 10 git install support (Ch3LL) #1378
Version 2019.10.03:
* Fix possible typo with `gnupg-curl` vs `gnupg curl` (zahiar)

View file

@ -28,6 +28,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file.
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
- 2020.01.21: ``53299aa0dfbf7ab381f3856bb7babfc04a1d6525be11db0b9466277b1e4d0c1a``
- 2019.11.04: ``905924fccd4ebf168d19ba598bf10af53efe02302b792aeb15433e73fd3ad1d2``
- 2019.10.03: ``34f196f06d586ce9e1b9907660ea6e67caf57abcecfea66e0343697e3fd0d17d``
- 2019.05.20: ``46fb5e4b7815efafd69fd703f033fe86e7b584b6770f7e0b936995bcae1cedd8``
@ -328,7 +329,7 @@ UNIX systems
**BSD**:
- OpenBSD (``pip`` installation)
- FreeBSD 9/10/11
- FreeBSD 11/12
**SunOS**:

View file

@ -23,7 +23,7 @@
#======================================================================================================================
set -o nounset # Treat unset variables as an error
__ScriptVersion="2020.01.21"
__ScriptVersion="2020.01.29"
__ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0"
@ -271,6 +271,7 @@ _REPO_URL="repo.saltstack.com"
_PY_EXE=""
_INSTALL_PY="$BS_FALSE"
_TORNADO_MAX_PY3_VERSION="5.0"
_POST_NEON_INSTALL=$BS_FALSE
# Defaults for install arguments
ITYPE="stable"
@ -293,7 +294,7 @@ __usage() {
- stable [version] Install a specific version. Only supported for
packages available at repo.saltstack.com
- testing RHEL-family specific: configure EPEL testing repo
- git Install from the head of the develop branch
- git Install from the head of the master branch
- git [ref] Install from any git ref (such as a branch, tag, or
commit)
@ -584,7 +585,7 @@ fi
# If doing a git install, check what branch/tag/sha will be checked out
if [ "$ITYPE" = "git" ]; then
if [ "$#" -eq 0 ];then
GIT_REV="develop"
GIT_REV="master"
else
GIT_REV="$1"
shift
@ -1687,10 +1688,9 @@ __check_end_of_life_versions() {
;;
freebsd)
# FreeBSD versions lower than 9.1 are not supported.
if { [ "$DISTRO_MAJOR_VERSION" -eq 9 ] && [ "$DISTRO_MINOR_VERSION" -lt 01 ]; } || \
[ "$DISTRO_MAJOR_VERSION" -lt 9 ]; then
echoerror "Versions lower than FreeBSD 9.1 are not supported."
# FreeBSD versions lower than 11 are EOL
if [ "$DISTRO_MAJOR_VERSION" -lt 11 ]; then
echoerror "Versions lower than FreeBSD 11 are EOL and no longer supported."
exit 1
fi
;;
@ -1817,6 +1817,61 @@ if [ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]; then
exit 1
fi
if [ "$ITYPE" = "git" ]; then
if [ "${GIT_REV}" = "master" ]; then
_POST_NEON_INSTALL=$BS_TRUE
__TAG_REGEX_MATCH="MATCH"
else
case ${OS_NAME_L} in
openbsd|freebsd|netbsd|darwin )
__NEW_VS_TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed -E 's/^(v?3[0-9]{3}(\.[0-9]{1,2})?).*$/MATCH/')
if [ "$__NEW_VS_TAG_REGEX_MATCH" = "MATCH" ]; then
_POST_NEON_INSTALL=$BS_TRUE
__TAG_REGEX_MATCH="${__NEW_VS_TAG_REGEX_MATCH}"
if [ "$(echo "${GIT_REV}" | cut -c -1)" != "v" ]; then
# We do this to properly clone tags
GIT_REV="v${GIT_REV}"
fi
echodebug "Post Neon Tag Regex Match On: ${GIT_REV}"
else
__TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed -E 's/^(v?[0-9]{1,4}\.[0-9]{1,2})(\.[0-9]{1,2})?.*$/MATCH/')
echodebug "Pre Neon Tag Regex Match On: ${GIT_REV}"
fi
;;
* )
__NEW_VS_TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed 's/^.*\(v\?3[[:digit:]]\{3\}\(\.[[:digit:]]\{1,2\}\)\?\).*$/MATCH/')
if [ "$__NEW_VS_TAG_REGEX_MATCH" = "MATCH" ]; then
_POST_NEON_INSTALL=$BS_TRUE
__TAG_REGEX_MATCH="${__NEW_VS_TAG_REGEX_MATCH}"
if [ "$(echo "${GIT_REV}" | cut -c -1)" != "v" ]; then
# We do this to properly clone tags
GIT_REV="v${GIT_REV}"
fi
echodebug "Post Neon Tag Regex Match On: ${GIT_REV}"
else
__TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed 's/^.*\(v\?[[:digit:]]\{1,4\}\.[[:digit:]]\{1,2\}\)\(\.[[:digit:]]\{1,2\}\)\?.*$/MATCH/')
echodebug "Pre Neon Tag Regex Match On: ${GIT_REV}"
fi
;;
esac
fi
if [ "$_POST_NEON_INSTALL" -eq $BS_TRUE ]; then
echo
echowarn "Post Neon git based installations will always install salt and it's dependencies using pip"
echowarn "You have 10 seconds to cancel and stop the bootstrap process"
echo
sleep 10
_PIP_ALLOWED=$BS_TRUE
# 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
fi
fi
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __function_defined
@ -1981,15 +2036,6 @@ __git_clone_and_checkout() {
export GIT_SSL_NO_VERIFY=1
fi
case ${OS_NAME_L} in
openbsd|freebsd|netbsd|darwin )
__TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed -E 's/^(v?[0-9]{1,4}\.[0-9]{1,2})(\.[0-9]{1,2})?.*$/MATCH/')
;;
* )
__TAG_REGEX_MATCH=$(echo "${GIT_REV}" | sed 's/^.*\(v\?[[:digit:]]\{1,4\}\.[[:digit:]]\{1,2\}\)\(\.[[:digit:]]\{1,2\}\)\?.*$/MATCH/')
;;
esac
__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}"
__SALT_CHECKOUT_REPONAME="$(basename "${_SALT_GIT_CHECKOUT_DIR}" 2>/dev/null)"
@ -2583,6 +2629,48 @@ __install_pip_deps() {
pip install -U -r ${requirements_file} ${__PIP_PACKAGES}
} # ---------- end of function __install_pip_deps ----------
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __install_salt_from_repo_post_neon
# DESCRIPTION: Return 0 or 1 if successfully able to install. Can provide a different python version to
# install pip packages with. If $py_exe is not specified it will use the default python version.
# PARAMETERS: py_exe
#----------------------------------------------------------------------------------------------------------------------
__install_salt_from_repo_post_neon() {
_py_exe="$1"
if [ "${_py_exe}" = "" ]; then
_py_exe='python'
fi
echodebug "__install_salt_from_repo_post_neon py_exe=$_py_exe"
_py_pkg=$(echo "$_py_exe" | sed -E "s/\\.//g")
_pip_cmd="${_py_exe} -m pip"
__check_pip_allowed
# Install pip and pip dependencies
if ! __check_command_exists "${_pip_cmd} --version"; then
__PACKAGES="${_py_pkg}-pip gcc"
# shellcheck disable=SC2086
if [ "$DISTRO_NAME_L" = "debian" ];then
__PACKAGES="${__PACKAGES} ${_py_pkg}-dev"
__apt_get_install_noinput ${__PACKAGES} || return 1
else
__PACKAGES="${__PACKAGES} ${_py_pkg}-devel"
__yum_install_noinput ${__PACKAGES} || return 1
fi
fi
${_pip_cmd} install -U pip
echoinfo "Installing salt using ${_py_exe}"
cd "${_SALT_GIT_CHECKOUT_DIR}" || return 1
${_pip_cmd} install . || return 1
} # ---------- end of function __install_salt_from_repo_post_neon ----------
#######################################################################################################################
#
@ -2824,6 +2912,10 @@ install_ubuntu_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES=""
# See how we are installing packages
@ -2911,6 +3003,11 @@ install_ubuntu_git() {
_PYEXE=python2.7
fi
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then
# shellcheck disable=SC2086
"${_PYEXE}" setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1
@ -3193,6 +3290,10 @@ install_debian_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES="libzmq3 libzmq3-dev lsb-release python-apt python-backports.ssl-match-hostname"
__PACKAGES="${__PACKAGES} python-crypto python-jinja2 python-msgpack python-m2crypto"
__PACKAGES="${__PACKAGES} python-requests python-tornado python-yaml python-zmq"
@ -3234,6 +3335,10 @@ install_debian_8_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES="libzmq3 libzmq3-dev lsb-release python-apt python-crypto python-jinja2"
__PACKAGES="${__PACKAGES} python-m2crypto python-msgpack python-requests python-systemd"
__PACKAGES="${__PACKAGES} python-yaml python-zmq python-concurrent.futures"
@ -3298,6 +3403,10 @@ install_debian_9_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES="libzmq5 lsb-release"
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
@ -3333,6 +3442,10 @@ install_debian_9_git_deps() {
install_debian_10_git_deps() {
install_debian_git_pre || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
_py=${_PY_EXE}
PY_PKG_VER=3
@ -3397,6 +3510,11 @@ install_debian_git() {
_PYEXE=python
fi
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then
# shellcheck disable=SC2086
"${_PYEXE}" setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install --install-layout=deb || return 1
@ -3601,12 +3719,21 @@ install_fedora_git_deps() {
fi
__PACKAGES="${__PACKAGES:=}"
if [ "$_INSECURE_DL" -eq $BS_FALSE ] && [ "${_SALT_REPO_URL%%://*}" = "https" ]; then
__PACKAGES="${__PACKAGES} ca-certificates"
fi
if ! __check_command_exists git; then
__PACKAGES="${__PACKAGES} git"
fi
install_fedora_deps || return 1
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES="${__PACKAGES:=}"
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
@ -3620,8 +3747,6 @@ install_fedora_git_deps() {
install_fedora_deps || return 1
__git_clone_and_checkout || return 1
# Fedora 28+ needs tornado <5.0 from pip
# https://github.com/saltstack/salt-bootstrap/issues/1220
if [ "${PY_PKG_VER}" -eq 3 ] && [ "$DISTRO_MAJOR_VERSION" -ge 28 ]; then
@ -3649,6 +3774,11 @@ install_fedora_git() {
_PYEXE='python2'
fi
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
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
@ -3809,26 +3939,28 @@ install_centos_stable_deps() {
__PACKAGES="yum-utils chkconfig"
fi
if [ "$DISTRO_MAJOR_VERSION" -ge 8 ]; then
# YAML module is used for generating custom master/minion configs
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PACKAGES="${__PACKAGES} python3-pyyaml"
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
if [ "$DISTRO_MAJOR_VERSION" -ge 8 ]; then
# YAML module is used for generating custom master/minion configs
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PACKAGES="${__PACKAGES} python3-pyyaml"
else
__PACKAGES="${__PACKAGES} python2-pyyaml"
fi
elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then
# YAML module is used for generating custom master/minion configs
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PACKAGES="${__PACKAGES} python36-PyYAML"
else
__PACKAGES="${__PACKAGES} PyYAML"
fi
else
__PACKAGES="${__PACKAGES} python2-pyyaml"
fi
elif [ "$DISTRO_MAJOR_VERSION" -eq 7 ]; then
# YAML module is used for generating custom master/minion configs
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PACKAGES="${__PACKAGES} python36-PyYAML"
else
__PACKAGES="${__PACKAGES} PyYAML"
fi
else
# YAML module is used for generating custom master/minion configs
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PACKAGES="${__PACKAGES} python34-PyYAML"
else
__PACKAGES="${__PACKAGES} PyYAML"
# YAML module is used for generating custom master/minion configs
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PACKAGES="${__PACKAGES} python34-PyYAML"
else
__PACKAGES="${__PACKAGES} PyYAML"
fi
fi
fi
@ -3911,6 +4043,9 @@ install_centos_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES=""
_install_m2crypto_req=false
@ -4009,6 +4144,12 @@ install_centos_git() {
_PYEXE='python2'
fi
echodebug "_PY_EXE: $_PY_EXE"
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
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
@ -4539,18 +4680,24 @@ install_alpine_linux_stable_deps() {
install_alpine_linux_git_deps() {
install_alpine_linux_stable_deps || return 1
apk -U add python2 py-virtualenv py2-crypto py2-m2crypto py2-setuptools \
py2-jinja2 py2-yaml py2-markupsafe py2-msgpack py2-psutil \
py2-zmq zeromq py2-requests || return 1
if ! __check_command_exists git; then
apk -U add git || return 1
fi
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
apk -U add python2 py2-pip || return 1
_PY_EXE=python2
return 0
fi
apk -U add python2 py-virtualenv py2-crypto py2-m2crypto py2-setuptools \
py2-jinja2 py2-yaml py2-markupsafe py2-msgpack py2-psutil \
py2-zmq zeromq py2-requests || return 1
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
apk -U add py2-tornado || return 1
@ -4586,6 +4733,12 @@ install_alpine_linux_stable() {
}
install_alpine_linux_git() {
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then
python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1
else
@ -4603,7 +4756,7 @@ install_alpine_linux_post() {
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /sbin/rc-update ]; then
script_url="${_SALTSTACK_REPO_URL%.git}/raw/develop/pkg/alpine/salt-$fname"
script_url="${_SALTSTACK_REPO_URL%.git}/raw/master/pkg/alpine/salt-$fname"
[ -f "/etc/init.d/salt-$fname" ] || __fetch_url "/etc/init.d/salt-$fname" "$script_url"
# shellcheck disable=SC2181
@ -4794,6 +4947,10 @@ install_amazon_linux_ami_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES=""
__PIP_PACKAGES=""
@ -4804,7 +4961,7 @@ install_amazon_linux_ami_git_deps() {
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
__PACKAGES="${__PACKAGES} ${pkg_append}-tornado"
@ -4859,6 +5016,10 @@ install_amazon_linux_ami_2_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PACKAGES=""
__PIP_PACKAGES=""
@ -4878,7 +5039,7 @@ install_amazon_linux_ami_2_git_deps() {
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
__PACKAGES="${__PACKAGES} ${pkg_append}${PY_PKG_VER}-tornado"
@ -5117,15 +5278,20 @@ install_arch_linux_git_deps() {
if ! __check_command_exists git; then
pacman -Sy --noconfirm --needed git || return 1
fi
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
pacman -R --noconfirm python2-distribute
pacman -Su --noconfirm --needed python2-crypto python2-setuptools python2-jinja \
python2-m2crypto python2-futures python2-markupsafe python2-msgpack python2-psutil \
python2-pyzmq zeromq python2-requests python2-systemd || return 1
__git_clone_and_checkout || return 1
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
pacman -Su --noconfirm --needed python2-tornado
@ -5159,6 +5325,12 @@ install_arch_linux_stable() {
}
install_arch_linux_git() {
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/salt/syspaths.py" ]; then
python2 setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1
else
@ -5296,21 +5468,24 @@ install_freebsd_deps() {
}
install_freebsd_git_deps() {
install_freebsd_stable_deps || return 1
install_freebsd_deps || return 1
SALT_DEPENDENCIES=$(/usr/local/sbin/pkg search -R -d py36-salt | grep 'origin:' \
| tail -n +2 | awk -F\" '{print $2}' | sed 's#.*/py-#py36-#g')
SALT_DEPENDENCIES=$(/usr/local/sbin/pkg search -R -d py37-salt | grep 'origin:' \
| tail -n +2 | awk -F\" '{print $2}')
# shellcheck disable=SC2086
/usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} || return 1
/usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} python || return 1
if ! __check_command_exists git; then
/usr/local/sbin/pkg install -y git || return 1
fi
/usr/local/sbin/pkg install -y py36-requests || return 1
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
/usr/local/sbin/pkg install -y py37-requests || return 1
echodebug "Adapting paths to FreeBSD"
# The list of files was taken from Salt's BSD port Makefile
for file in doc/man/salt-key.1 doc/man/salt-cp.1 doc/man/salt-minion.1 \
@ -5354,17 +5529,22 @@ install_freebsd_stable() {
# installing latest version of salt from FreeBSD CURRENT ports repo
#
# shellcheck disable=SC2086
/usr/local/sbin/pkg install -y py36-salt || return 1
/usr/local/sbin/pkg install -y py37-salt || return 1
return 0
}
install_freebsd_git() {
# /usr/local/bin/python2 in FreeBSD is a symlink to /usr/local/bin/python2.7
__PYTHON_PATH=$(readlink -f "$(command -v python2)")
# /usr/local/bin/python3 in FreeBSD is a symlink to /usr/local/bin/python3.7
__PYTHON_PATH=$(readlink -f "$(command -v python3)")
__ESCAPED_PYTHON_PATH=$(echo "${__PYTHON_PATH}" | sed 's/\//\\\//g')
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${__PYTHON_PATH}" || return 1
return 0
fi
# Install from git
if [ ! -f salt/syspaths.py ]; then
# We still can't provide the system paths, salt 0.16.x
@ -5470,6 +5650,11 @@ install_openbsd_git_deps() {
_TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/"
CONFIG_SALT_FUNC="config_salt"
fi
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
return 0
}
@ -5477,6 +5662,11 @@ install_openbsd_git() {
#
# Install from git
#
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
if [ ! -f salt/syspaths.py ]; then
# We still can't provide the system paths, salt 0.16.x
/usr/local/bin/python2.7 setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1
@ -5566,12 +5756,12 @@ install_smartos_deps() {
if [ ! -f "$_SALT_ETC_DIR/minion" ] && [ ! -f "$_TEMP_CONFIG_DIR/minion" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/minion" -L \
https://raw.githubusercontent.com/saltstack/salt/develop/conf/minion || return 1
https://raw.githubusercontent.com/saltstack/salt/master/conf/minion || return 1
fi
if [ ! -f "$_SALT_ETC_DIR/master" ] && [ ! -f $_TEMP_CONFIG_DIR/master ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/master" -L \
https://raw.githubusercontent.com/saltstack/salt/develop/conf/master || return 1
https://raw.githubusercontent.com/saltstack/salt/master/conf/master || return 1
fi
fi
@ -5595,6 +5785,12 @@ install_smartos_git_deps() {
pkgin -y install git || return 1
fi
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# Install whichever tornado is in the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
@ -5619,7 +5815,6 @@ install_smartos_git_deps() {
fi
fi
__git_clone_and_checkout || return 1
# Let's trigger config_salt()
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
_TEMP_CONFIG_DIR="${_SALT_GIT_CHECKOUT_DIR}/conf/"
@ -5635,6 +5830,12 @@ install_smartos_stable() {
}
install_smartos_git() {
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
# Use setuptools in order to also install dependencies
# lets force our config path on the setup for now, since salt/syspaths.py only got fixed in 2015.5.0
USE_SETUPTOOLS=1 /opt/local/bin/python setup.py --salt-config-dir="$_SALT_ETC_DIR" --salt-cache-dir="${_SALT_CACHE_DIR}" ${SETUP_PY_INSTALL_ARGS} install || return 1
@ -5658,7 +5859,7 @@ install_smartos_post() {
if [ ! -f "$_TEMP_CONFIG_DIR/salt-$fname.xml" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/salt-$fname.xml" -L \
"https://raw.githubusercontent.com/saltstack/salt/develop/pkg/smartos/salt-$fname.xml"
"https://raw.githubusercontent.com/saltstack/salt/master/pkg/smartos/salt-$fname.xml"
fi
svccfg import "$_TEMP_CONFIG_DIR/salt-$fname.xml"
if [ "${VIRTUAL_TYPE}" = "global" ]; then
@ -5862,14 +6063,18 @@ install_opensuse_git_deps() {
__zypper_install git || return 1
fi
__zypper_install patch || return 1
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__zypper_install patch || return 1
__PACKAGES="libzmq5 python-Jinja2 python-m2crypto python-msgpack-python python-pycrypto python-pyzmq python-xml python-futures"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
__PACKAGES="${__PACKAGES} python-tornado"
@ -5915,6 +6120,12 @@ install_opensuse_stable() {
}
install_opensuse_git() {
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
python setup.py ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1
return 0
}
@ -6071,6 +6282,10 @@ install_opensuse_15_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
# Py3 is the default bootstrap install for Leap 15
# However, git installs might specify "-x python2"
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 2 ]; then
@ -6088,7 +6303,7 @@ install_opensuse_15_git_deps() {
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-xml"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-tornado"
@ -6120,6 +6335,11 @@ install_opensuse_15_git() {
_PYEXE=python3
fi
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
${_PYEXE} setup.py ${SETUP_PY_INSTALL_ARGS} install --prefix=/usr || return 1
return 0
}
@ -6178,7 +6398,7 @@ install_suse_12_git_deps() {
__PACKAGES="${__PACKAGES} python-pyzmq python-xml"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
__PACKAGES="${__PACKAGES} python-tornado"
@ -6274,7 +6494,7 @@ install_suse_11_git_deps() {
__PACKAGES="${__PACKAGES} python-pyzmq python-xml python-zypp"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
# We're on the master branch, install whichever tornado is on the requirements file
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then
__PACKAGES="${__PACKAGES} python-tornado"
@ -6646,6 +6866,10 @@ install_macosx_git_deps() {
__git_clone_and_checkout || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
return 0
fi
__PIP_REQUIREMENTS="dev_python27.txt"
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
__PIP_REQUIREMENTS="dev_python34.txt"
@ -6675,6 +6899,11 @@ install_macosx_git() {
_PYEXE=python2.7
fi
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
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=/opt/salt || return 1
else