Merge pull request #1505 from s0undt3ch/stable

Release 2020.10.19
This commit is contained in:
Pedro Algarvio 2020-10-19 17:38:35 +01:00 committed by GitHub
commit b3786e5ad7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1708 additions and 95 deletions

49
.github/workflows/checksums.yml vendored Normal file
View file

@ -0,0 +1,49 @@
name: Checksums
on:
push:
tags:
- '*'
jobs:
checksums:
name: Update Release Checksums
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: stable
- name: Get bootstrap-salt.sh sha256sum
run: |
echo "SH=$(sha256sum bootstrap-salt.sh | awk '{ print $1 }')" >> $GITHUB_ENV
echo "PS1=$(sha256sum bootstrap-salt.ps1 | awk '{ print $1 }')" >> $GITHUB_ENV
echo "BS_VERSION=$(sh bootstrap-salt.sh -v | awk '{ print $4 }')" >> $GITHUB_ENV
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Update Checksums
run: |
echo ${{ env.SH }} > bootstrap-salt.sh.sha256
echo ${{ env.PS1 }} > bootstrap-salt.ps1.sha256
git config --global user.name 'SaltStack GH Automation'
git config --global user.email 'actions@github.com'
git add *.sha256
git commit -am "Update sha256 checksums"
git push
- uses: actions/checkout@v2
with:
ref: develop
- name: Update Latest Release on README
run: |
python3 .github/workflows/scripts/update-release-shasum.py ${{ env.BS_VERSION }} ${{ env.SH }}
git config --global user.name 'SaltStack GH Automation'
git config --global user.email 'actions@github.com'
git commit -am "Update README.rst with latest release sha256sum"
git push

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
#!/usr/bin/env python
import sys
import pathlib
THIS_FILE = pathlib.Path(__file__).resolve()
CODE_ROOT = THIS_FILE.parent.parent.parent.parent
README_PATH = CODE_ROOT / "README.rst"
def main(version, sha256sum):
in_contents = README_PATH.read_text()
out_contents = ""
found_anchor = False
updated_version = False
if version not in in_contents:
for line in in_contents.splitlines(True):
if updated_version:
out_contents += line
continue
if found_anchor:
if not line.startswith("-"):
out_contents += line
continue
out_contents += "- {}: ``{}``\n".format(version, sha256sum)
out_contents += line
updated_version = True
continue
out_contents += line
if line.startswith(".. _sha256sums:"):
found_anchor = True
if in_contents != out_contents:
README_PATH.write_text(out_contents)
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2])

View file

@ -18,6 +18,8 @@ LINUX_DISTROS = [
'fedora-30',
'fedora-31',
'fedora-32',
'gentoo',
'gentoo-systemd',
'opensuse-15',
'ubuntu-1604',
'ubuntu-1804',
@ -37,6 +39,8 @@ STABLE_DISTROS = [
'fedora-30',
'fedora-31',
'fedora-32',
'gentoo',
'gentoo-systemd',
'ubuntu-1604',
'ubuntu-1804',
'ubuntu-2004',
@ -48,6 +52,8 @@ PY2_BLACKLIST = [
'fedora-30',
'fedora-31',
'fedora-32',
'gentoo',
'gentoo-systemd',
'opensuse-15',
'ubuntu-2004',
]
@ -70,6 +76,7 @@ SALT_BRANCHES = [
'2019-2',
'3000',
'3001',
'3001-0',
'master',
'latest'
]
@ -84,6 +91,7 @@ BRANCH_DISPLAY_NAMES = {
'2019-2': 'v2019.2',
'3000': 'v3000',
'3001': 'v3001',
'3001-0': 'v3001.0',
'master': 'Master',
'latest': 'Latest'
}
@ -108,17 +116,26 @@ DISTRO_DISPLAY_NAMES = {
'fedora-30': 'Fedora 30',
'fedora-31': 'Fedora 31',
'fedora-32': 'Fedora 32',
'gentoo': 'Gentoo',
'gentoo-systemd': 'Gentoo (systemd)',
'opensuse-15': 'Opensuse 15',
'ubuntu-1604': 'Ubuntu 16.04',
'ubuntu-1804': 'Ubuntu 18.04',
'ubuntu-2004': 'Ubuntu 20.04',
}
TIMEOUT_DEFAULT = 20
TIMEOUT_OVERRIDES = {
'gentoo': 45,
'gentoo-systemd': 45,
}
def generate_test_jobs():
test_jobs = ''
for distro in LINUX_DISTROS + OSX + WINDOWS:
timeout_minutes = TIMEOUT_OVERRIDES[distro] if distro in TIMEOUT_OVERRIDES else TIMEOUT_DEFAULT
for branch in SALT_BRANCHES:
if branch == 'master' and distro in SALT_POST_3000_BLACKLIST:
@ -151,7 +168,8 @@ def generate_test_jobs():
branch=branch,
display_name='{} Latest packaged release'.format(
DISTRO_DISPLAY_NAMES[distro],
)
),
timeout_minutes=timeout_minutes
)
)
continue
@ -163,7 +181,7 @@ def generate_test_jobs():
continue
try:
if int(branch) >= 3000 and python_version == 'py2':
if int(branch.split('-')[0]) >= 3000 and python_version == 'py2':
# Salt's 300X versions no longer supports Python 2
continue
except ValueError:
@ -185,6 +203,10 @@ def generate_test_jobs():
continue
if bootstrap_type == "git":
# .0 versions are a virtual version for pinning to the first point release of a major release, such as 3001, there is no git version.
if branch.endswith('-0'):
continue
if python_version == "py3":
if distro in ("arch", "fedora-32"):
allowed_branches = ["master"]
@ -230,7 +252,8 @@ def generate_test_jobs():
BRANCH_DISPLAY_NAMES[branch],
python_version.capitalize(),
bootstrap_type.capitalize()
)
),
timeout_minutes=timeout_minutes
)
)

View file

@ -1,7 +1,7 @@
{python_version}-{bootstrap_type}-{branch}-{distro}:
name: {display_name}
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: {timeout_minutes}
needs: lint

View file

@ -93,6 +93,18 @@ platforms:
run_command: /usr/lib/systemd/systemd
provision_command:
- dnf -y install procps-ng
- name: gentoo
driver_config:
image: gentoo/stage3:latest
run_command: /sbin/init
provision_command:
- rc-update add sshd default
- name: gentoo-systemd
driver_config:
image: gentoo/stage3:systemd
run_command: /lib/systemd/systemd
provision_command:
- systemctl enable sshd.service
- name: opensuse-15
driver_config:
image: opensuse/leap:15.1
@ -117,12 +129,21 @@ suites:
- name: py2-git-2019-2
provisioner:
salt_version: 2019.2
excludes:
- gentoo
- gentoo-systemd
- name: py2-git-3000
provisioner:
salt_version: 3000
excludes:
- gentoo
- gentoo-systemd
- name: py2-git-master
provisioner:
salt_version: master
excludes:
- gentoo
- gentoo-systemd
- name: py2-stable-2019-2
provisioner:
salt_version: 2019.2
@ -133,6 +154,8 @@ suites:
- fedora-30
- fedora-31
- fedora-32
- gentoo
- gentoo-systemd
- ubuntu-2004
- name: py2-stable-3000
provisioner:
@ -144,6 +167,8 @@ suites:
- fedora-30
- fedora-31
- fedora-32
- gentoo
- gentoo-systemd
- ubuntu-2004
- name: py3-git-3000
@ -194,6 +219,19 @@ suites:
- opensuse-15
- arch
- ubuntu-2004
- name: py3-stable-3001-0
provisioner:
salt_version: 3001
salt_bootstrap_options: -x python3 -MP stable 3001.0
excludes:
- amazon-1
- centos-6
- debian-8
- opensuse-15
- fedora-30
- fedora-31
- fedora-32
- arch
- name: py3-stable-3001
provisioner:
salt_version: 3001

View file

@ -77,6 +77,7 @@ Guillaume Derval GuillaumeDerval guillaume@guillaumederval.be
gweis gweis
Henrik Holmboe holmboe
Howard Mei HowardMei howardleomei@gmail.com
Ivo Jánský ijansky
James Booth absolutejam vvalentine1337@gmail.com
Jamie Alessio jalessio jamie@stoic.net
Jan Heidbrink jheidbrink
@ -98,6 +99,7 @@ Ken Crowell oeuftete kcrowell@saltstack.com
Kenneth Wilke KennethWilke
Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com
kiemlicz kiemlicz
Kirill Ponomarev krionbsd krion@freebsd.org
Ky-Anh Huynh icy
Liu Xiaohui oreh herolxh@gmail.com
lomeroe lomeroe
@ -116,6 +118,7 @@ Matthew Mead-Briggs mattmb
Matthew Richardson mrichar1
Matthew Willson ixela
Matthieu Guegan mguegan
Max Arnold max-arnold
Megan Wilhite Ch3LL megan.wilhite@gmail.com
mfapouw mfapouw
Michael A. Smith kojiromike michaels@syapse.com
@ -129,6 +132,7 @@ nevins-b nevins-b
Nicholas Henry nshenry03 nshenry03@gmail.com
Nicole Thomas rallytime nicole@saltstack.com
Niels Abspoel aboe76 aboe76@gmail.com
Nikita mbochenk
Nitin Madhok nmadhok nmadhok@clemson.edu
panticz panticz
Paul Brian lifeisstillgood paul@mikadosoftware.com
@ -164,6 +168,7 @@ stanzgy stanzgy stanzgy@gmail.com
Steve Groesz wolfpackmars2 wolfpackmars2@yahoo.com
Sven R hackacad admin@hackacad.net
sybix sybix
Tai Groot taigrr tai@taigrr.com
Tate Eskew tateeskew
Thomas S. Hatch thatch45 thatch45@saltstack.com
Tobias Jungel toanju Tobias.Jungel@gmail.com

View file

@ -1,5 +1,14 @@
Version TBD (In Progress on the Develop Branch):
Version 2020.10.19:
* Fix v3000+ with git install on FreeBSD (krionbsd) #1487
* Update README giving ONE example of WINDOWS bootstrapping. Default to python3 instead of
python2. (noelmcloughlin) #1496
* Support git and stable salt-bootstrap on Gentoo. (ijansky) #1500
* Add support for Linux Mint 20. (taigrr) #1502
* Adding missing functions for Red Hat 8. (mbochenk) #1489
* Allow pinning minor 3xxx versions. (max-arnold) #1491
Version 2020.06.23:
* Fix for Cumulus Linux 4.1 (darylturner) #1474
* Fix file download exit code, improve error message on failed download (bryceml) #1478
@ -38,8 +47,8 @@ Version 2020.02.04:
* Drop support for Debian < 8 (s0undt3ch) #1424
Version 2020.01.29:
* FreeBSD fixes (cedwards) #1413
* Support the upcoming Neon release (s0undt3ch) #1420
* FreeBSD fixes (cedwards) #1413
* Support the upcoming Neon release (s0undt3ch) #1420
Version 2020.01.21:
* FreeBSD fixes (kgbsd) #1376

View file

@ -2,4 +2,4 @@ source "https://rubygems.org"
gem 'test-kitchen', '>= 2.0.1'
gem 'kitchen-salt', '>= 0.5'
gem 'kitchen-docker', '>= 2.9.0'
gem 'kitchen-docker', github: 'test-kitchen/kitchen-docker'

View file

@ -28,8 +28,11 @@ Bootstrap
In every two-step installation example, you would be well-served to **verify against the SHA256
sum** of the downloaded ``bootstrap-salt.sh`` file.
.. _sha256sums:
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
- 2020.06.23: ``1d07db867c195c864d0ae70664524f2099cc9a46872953293c67c3f239d4f4f5``
- 2020.05.28: ``6b3ea15c78f01060ab12fc01c0bb18480eaf36858c7ba188b200c0fb11aac173``
- 2020.02.24: ``efc46700aca78b8e51d7af9b06293f52ad495f3a8179c6bfb21a8c97ee41f1b7``
- 2020.02.04: ``ce877651b4938e3480f76b1629f582437f6ca8b73d7199fdb9e905e86fe85b34``
@ -226,6 +229,27 @@ Installing the latest master branch of Salt:
curl -L https://bootstrap.saltstack.com | sudo sh -s -- git master
Install on Windows
~~~~~~~~~~~~~~~~~~
Using ``PowerShell`` to install latest stable version:
.. code:: console
Invoke-WebRequest -Uri https://winbootstrap.saltstack.com -OutFile C:\Temp\bootstrap-salt.ps1
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
C:\Temp\bootstrap-salt.ps1
Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser
Using ``cygwin`` to install latest stable version:
.. code:: console
curl -o bootstrap-salt.ps1 -L https://winbootstrap.saltstack.com
"/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ./bootstrap-salt.ps1"
Supported Operating Systems
---------------------------
@ -476,8 +500,8 @@ Make edits to .drone.jsonnet and then save them into the .drone.yml by doing the
.. _Vagrant: http://www.vagrantup.com
.. _hardening salt: https://docs.saltstack.com/en/latest/topics/hardening.html
.. |build| image:: https://drone.saltstack.com/api/badges/saltstack/salt-bootstrap/status.svg
:target: https://drone.saltstack.com/saltstack/salt-bootstrap
:alt: Build status on Linux
.. |build| image:: https://github.com/saltstack/salt-bootstrap/workflows/Testing/badge.svg?branch=develop
:target: https://github.com/saltstack/salt-bootstrap/actions?query=branch%3Adevelop
:alt: Build Status
.. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et

View file

@ -85,7 +85,7 @@ Param(
[Parameter(Mandatory=$false,ValueFromPipeline=$true)]
# Doesn't support Python versions prior to "2017.7.0"
[ValidateSet("2","3")]
[string]$pythonVersion = "2",
[string]$pythonVersion = "3",
[Parameter(Mandatory=$false,ValueFromPipeline=$true)]
[ValidateSet("true","false")]

View file

@ -1 +1 @@
4be5028f29e36ae02b10a1d1a5af15af20db2fccc6000cb3d8c567d5ff5d1700
1819f33bc96b90762a4e955f05563c402fe03f139a8011a223172861d5158e59

View file

@ -23,7 +23,7 @@
#======================================================================================================================
set -o nounset # Treat unset variables as an error
__ScriptVersion="2020.06.23"
__ScriptVersion="2020.10.19"
__ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0"
@ -296,6 +296,7 @@ __usage() {
for packages available at repo.saltstack.com
- stable [version] Install a specific version. Only supported for
packages available at repo.saltstack.com
To pin a 3xxx minor version, specify it as 3xxx.0
- testing RHEL-family specific: configure EPEL testing repo
- git Install from the head of the master branch
- git [ref] Install from any git ref (such as a branch, tag, or
@ -606,11 +607,11 @@ elif [ "$ITYPE" = "stable" ]; then
if [ "$(echo "$1" | grep -E '^(latest|1\.6|1\.7|2014\.1|2014\.7|2015\.5|2015\.8|2016\.3|2016\.11|2017\.7|2018\.3|2019\.2|3000|3001)$')" != "" ]; then
STABLE_REV="$1"
shift
elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}*(\.[0-9]*)?)$')" != "" ]; then
if [ "$(uname)" = "Darwin" ]; then
STABLE_REV="$1"
else
STABLE_REV="archive/$1"
elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}(\.[0-9]*)?)$')" != "" ]; then
# Handle the 3xxx.0 version as 3xxx archive (pin to minor) and strip the fake ".0" suffix
STABLE_REV=$(echo "$1" | sed -E 's/^([3-9][0-9]{3})\.0$/\1/')
if [ "$(uname)" != "Darwin" ]; then
STABLE_REV="archive/$STABLE_REV"
fi
shift
else
@ -1310,6 +1311,7 @@ __ubuntu_derivatives_translation() {
linuxmint_17_ubuntu_base="14.04"
linuxmint_18_ubuntu_base="16.04"
linuxmint_19_ubuntu_base="18.04"
linuxmint_20_ubuntu_base="20.04"
linaro_12_ubuntu_base="12.04"
elementary_os_02_ubuntu_base="12.04"
neon_16_ubuntu_base="16.04"
@ -1805,7 +1807,7 @@ elif [ "${DISTRO_NAME_L}" = "debian" ]; then
__debian_codename_translation
fi
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle|scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|gentoo|red_hat|oracle|scientific|amazon|fedora|macosx)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then
echoerror "${DISTRO_NAME} does not have major version pegged packages support"
exit 1
fi
@ -2511,11 +2513,11 @@ __check_services_openbsd() {
} # ---------- end of function __check_services_openbsd ----------
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __check_services_alpine
# NAME: __check_services_openrc
# DESCRIPTION: Return 0 or 1 in case the service is enabled or not
# PARAMETERS: servicename
#----------------------------------------------------------------------------------------------------------------------
__check_services_alpine() {
__check_services_openrc() {
if [ $# -eq 0 ]; then
echoerror "You need to pass a service name to check!"
exit 1
@ -2534,7 +2536,7 @@ __check_services_alpine() {
echodebug "Service ${servicename} is NOT enabled"
return 1
fi
} # ---------- end of function __check_services_openbsd ----------
} # ---------- end of function __check_services_openrc ----------
#--- FUNCTION -------------------------------------------------------------------------------------------------------
@ -4541,6 +4543,16 @@ install_red_hat_linux_git_deps() {
return 0
}
install_red_hat_enterprise_stable_deps() {
install_red_hat_linux_stable_deps || return 1
return 0
}
install_red_hat_enterprise_git_deps() {
install_red_hat_linux_git_deps || return 1
return 0
}
install_red_hat_enterprise_linux_stable_deps() {
install_red_hat_linux_stable_deps || return 1
return 0
@ -4581,6 +4593,16 @@ install_red_hat_linux_git() {
return 0
}
install_red_hat_enterprise_stable() {
install_red_hat_linux_stable || return 1
return 0
}
install_red_hat_enterprise_git() {
install_red_hat_linux_git || return 1
return 0
}
install_red_hat_enterprise_linux_stable() {
install_red_hat_linux_stable || return 1
return 0
@ -4626,6 +4648,21 @@ install_red_hat_linux_git_post() {
return 0
}
install_red_hat_enterprise_stable_post() {
install_red_hat_linux_stable_post || return 1
return 0
}
install_red_hat_enterprise_restart_daemons() {
install_red_hat_linux_restart_daemons || return 1
return 0
}
install_red_hat_enterprise_git_post() {
install_red_hat_linux_git_post || return 1
return 0
}
install_red_hat_enterprise_linux_stable_post() {
install_red_hat_linux_stable_post || return 1
return 0
@ -4686,6 +4723,21 @@ install_red_hat_linux_testing_post() {
return 0
}
install_red_hat_enterprise_testing_deps() {
install_centos_testing_deps || return 1
return 0
}
install_red_hat_enterprise_testing() {
install_centos_testing || return 1
return 0
}
install_red_hat_enterprise_testing_post() {
install_centos_testing_post || return 1
return 0
}
install_red_hat_enterprise_server_testing_deps() {
install_centos_testing_deps || return 1
return 0
@ -5057,7 +5109,7 @@ install_alpine_linux_check_services() {
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
__check_services_alpine salt-$fname || return 1
__check_services_openrc salt-$fname || return 1
done
return 0
@ -5746,6 +5798,7 @@ install_arch_check_services() {
# Using a separate conf step to head for idempotent install...
__configure_freebsd_pkg_details() {
_SALT_ETC_DIR="/usr/local/etc/salt"
_POST_NEON_PIP_INSTALL_ARGS="--prefix=/usr/local"
}
install_freebsd_deps() {
@ -5769,7 +5822,7 @@ install_freebsd_git_deps() {
/usr/local/sbin/pkg install -y py37-requests || return 1
else
/usr/local/sbin/pkg install -y python python-pip python-setuptools || return 1
/usr/local/sbin/pkg install -y python py37-pip py37-setuptools libzmq4 libunwind || return 1
fi
echodebug "Adapting paths to FreeBSD"
@ -5828,6 +5881,13 @@ install_freebsd_git() {
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${__PYTHON_PATH}" || return 1
for script in salt_api salt_master salt_minion salt_proxy salt_syndic; do
__fetch_url "/usr/local/etc/rc.d/${script}" "https://raw.githubusercontent.com/freebsd/freebsd-ports/master/sysutils/py-salt/files/${script}.in" || return 1
sed -i '' 's/%%PREFIX%%/\/usr\/local/g' /usr/local/etc/rc.d/${script}
sed -i '' "s/%%PYTHON_CMD%%/${__ESCAPED_PYTHON_PATH}/g" /usr/local/etc/rc.d/${script}
chmod +x /usr/local/etc/rc.d/${script} || return 1
done
return 0
fi
@ -6945,26 +7005,37 @@ install_suse_check_services() {
# Gentoo Install Functions.
#
__autounmask() {
emerge --autounmask-write --autounmask-only "${@}"; return $?
}
__emerge() {
if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then
emerge --getbinpkg "${@}"; return $?
fi
emerge "${@}"; return $?
}
__gentoo_config_protection() {
# usually it's a good thing to have config files protected by portage, but
# Unmask package(s) and accept changes
#
# Usually it's a good thing to have config files protected by portage, but
# in this case this would require to interrupt the bootstrapping script at
# this point, manually merge the changes using etc-update/dispatch-conf/
# cfg-update and then restart the bootstrapping script, so instead we allow
# at this point to modify certain config files directly
export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-} /etc/portage/package.accept_keywords /etc/portage/package.keywords /etc/portage/package.license /etc/portage/package.unmask /etc/portage/package.use"
export CONFIG_PROTECT_MASK="${CONFIG_PROTECT_MASK:-}
/etc/portage/package.accept_keywords
/etc/portage/package.keywords
/etc/portage/package.license
/etc/portage/package.unmask
/etc/portage/package.use"
emerge --autounmask --autounmask-continue --autounmask-only --autounmask-write "${@}"; return $?
}
# emerge currently won't write to files that aren't there, so we need to ensure their presence
touch /etc/portage/package.accept_keywords /etc/portage/package.keywords /etc/portage/package.license /etc/portage/package.unmask /etc/portage/package.use
__emerge() {
EMERGE_FLAGS='-q'
if [ "$_ECHO_DEBUG" -eq $BS_TRUE ]; then
EMERGE_FLAGS='-v'
fi
# Do not re-emerge packages that are already installed
EMERGE_FLAGS="${EMERGE_FLAGS} --noreplace"
if [ "$_GENTOO_USE_BINHOST" -eq $BS_TRUE ]; then
EMERGE_FLAGS="${EMERGE_FLAGS} --getbinpkg"
fi
# shellcheck disable=SC2086
emerge ${EMERGE_FLAGS} "${@}"; return $?
}
__gentoo_pre_dep() {
@ -6984,52 +7055,142 @@ __gentoo_pre_dep() {
if [ ! -d /etc/portage ]; then
mkdir /etc/portage
fi
# Enable python 3.6 if installing pre Neon Salt release
if echo "${STABLE_REV}" | grep -q "2019" || [ "${ITYPE}" = "git" ] && [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
if ! emerge --info | sed 's/.*\(PYTHON_TARGETS="[^"]*"\).*/\1/' | grep -q 'python3_6' ; then
echo "PYTHON_TARGETS=\"\${PYTHON_TARGETS} python3_6\"" >> /etc/portage/make.conf
fi
fi
}
__gentoo_post_dep() {
# ensures dev-lib/crypto++ compiles happily
__emerge --oneshot 'sys-devel/libtool'
# the -o option asks it to emerge the deps but not the package.
__gentoo_config_protection
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
__autounmask 'dev-python/libcloud'
__emerge -v 'dev-python/libcloud'
fi
__autounmask 'dev-python/requests'
__autounmask 'app-admin/salt'
__emerge -vo 'dev-python/requests'
__emerge -vo 'app-admin/salt'
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
# shellcheck disable=SC2086
__autounmask ${_EXTRA_PACKAGES} || return 1
# shellcheck disable=SC2086
__emerge -v ${_EXTRA_PACKAGES} || return 1
__emerge ${_EXTRA_PACKAGES} || return 1
fi
return 0
}
install_gentoo_deps() {
__gentoo_pre_dep || return 1
# Make sure that the 'libcloud' use flag is set when Salt Cloud support is requested
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
SALT_USE_FILE='/etc/portage/package.use'
if [ -d '/etc/portage/package.use' ]; then
SALT_USE_FILE='/etc/portage/package.use/salt'
fi
SALT_USE_FLAGS="$(grep -E '^[<>=~]*app-admin/salt.*' ${SALT_USE_FILE} 2>/dev/null)"
SALT_USE_FLAG_LIBCLOUD="$(echo "${SALT_USE_FLAGS}" | grep ' libcloud' 2>/dev/null)"
# Set the libcloud use flag, if it is not set yet
if [ -z "${SALT_USE_FLAGS}" ]; then
echo "app-admin/salt libcloud" >> ${SALT_USE_FILE}
elif [ -z "${SALT_USE_FLAG_LIBCLOUD}" ]; then
sed 's#^\([<>=~]*app-admin/salt[^ ]*\)\(.*\)#\1 libcloud\2#g' -i ${SALT_USE_FILE}
fi
fi
__gentoo_post_dep || return 1
}
install_gentoo_git_deps() {
__gentoo_pre_dep || return 1
GENTOO_GIT_PACKAGES=""
# Install pip if it does not exist
if ! __check_command_exists pip ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-python/pip"
fi
# Install GIT if it does not exist
if ! __check_command_exists git ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-vcs/git"
fi
# Salt <3000 does not automatically install dependencies. It has to be done manually.
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
# Install Python 3.6 if it does not exist
if ! __check_command_exists python3.6 ; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-lang/python:3.6"
fi
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES}
sys-apps/pciutils
dev-python/pyyaml
dev-python/pyzmq
dev-python/libnacl
dev-python/pycryptodome
dev-python/py
dev-python/requests
dev-python/msgpack
dev-python/jinja
dev-python/pyasn1
dev-python/markupsafe
dev-python/cython
dev-python/six
dev-python/idna
dev-python/pycurl
<www-servers/tornado-5.0"
fi
# Install libcloud when Salt Cloud support was requested
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
GENTOO_GIT_PACKAGES="${GENTOO_GIT_PACKAGES} dev-python/libcloud"
fi
if [ -n "${GENTOO_GIT_PACKAGES}" ]; then
# shellcheck disable=SC2086
__autounmask ${GENTOO_GIT_PACKAGES} || return 1
# shellcheck disable=SC2086
__emerge ${GENTOO_GIT_PACKAGES} || return 1
fi
__git_clone_and_checkout || return 1
__gentoo_post_dep || return 1
}
install_gentoo_stable() {
__gentoo_config_protection
__emerge -v 'app-admin/salt' || return 1
GENTOO_SALT_PACKAGE="app-admin/salt"
STABLE_REV_WITHOUT_PREFIX=$(echo "${STABLE_REV}" | sed 's#archive/##')
if [ "${STABLE_REV_WITHOUT_PREFIX}" != "latest" ]; then
GENTOO_SALT_PACKAGE="=app-admin/salt-${STABLE_REV_WITHOUT_PREFIX}*"
fi
# shellcheck disable=SC2086
__autounmask ${GENTOO_SALT_PACKAGE} || return 1
# shellcheck disable=SC2086
__emerge ${GENTOO_SALT_PACKAGE} || return 1
}
install_gentoo_git() {
__gentoo_config_protection
__emerge -v '=app-admin/salt-9999' || return 1
if [ "${_POST_NEON_INSTALL}" -eq $BS_TRUE ]; then
__install_salt_from_repo_post_neon "${_PY_EXE}" || return 1
return 0
fi
# Tornado 4.3 ebuild supports only Python 3.6, use Python 3.6 as the default Python 3 interpreter
if [ "$_PY_EXE" = "python3" ] || [ -z "$_PY_EXE" ]; then
_PYEXE=python3.6
else
_PYEXE=${_PY_EXE}
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 || return 1
else
"${_PYEXE}" setup.py ${SETUP_PY_INSTALL_ARGS} install || return 1
fi
return 0
}
install_gentoo_post() {
@ -7042,47 +7203,84 @@ install_gentoo_post() {
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -d "/run/systemd/system" ]; then
systemctl enable salt-$fname.service
systemctl start salt-$fname.service
if __check_command_exists systemctl ; then
systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
systemctl preset salt-$fname.service > /dev/null 2>&1 &&
systemctl enable salt-$fname.service > /dev/null 2>&1
)
else
rc-update add salt-$fname default
/etc/init.d/salt-$fname start
# Salt minion cannot start in a docker container because the "net" service is not available
if [ $fname = "minion" ] && [ -f /.dockerenv ]; then
sed '/need net/d' -i /etc/init.d/salt-$fname
fi
rc-update add "salt-$fname" > /dev/null 2>&1 || return 1
fi
done
}
install_gentoo_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
if __check_command_exists systemctl ; then
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/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
[ $fname = "api" ] && continue
systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
systemctl preset salt-$fname.service > /dev/null 2>&1 &&
systemctl enable salt-$fname.service > /dev/null 2>&1
)
else
cat <<_eof > "/etc/init.d/salt-${fname}"
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-${fname}"
command_args="\${SALT_OPTS}"
command_background="1"
pidfile="/var/run/salt-${fname}.pid"
name="SALT ${fname} daemon"
retry="20"
depend() {
use net logger
}
_eof
chmod +x /etc/init.d/salt-$fname
cat <<_eof > "/etc/conf.d/salt-${fname}"
# /etc/conf.d/salt-${fname}: config file for /etc/init.d/salt-master
# see man pages for salt-${fname} or run 'salt-${fname} --help'
# for valid cmdline options
SALT_OPTS="--log-level=warning"
_eof
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
rc-update add "salt-$fname" > /dev/null 2>&1 || return 1
fi
done
return 0
}
install_gentoo_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 = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -d "/run/systemd/system" ]; then
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
else
/etc/init.d/salt-$fname stop > /dev/null 2>&1
/etc/init.d/salt-$fname start
fi
done
}
install_gentoo_check_services() {
if [ ! -d "/run/systemd/system" ]; then
# Not running systemd!? Don't check!
return 0
# Ensure upstart configs / systemd units are loaded
if __check_command_exists systemctl ; then
systemctl daemon-reload
fi
for fname in api master minion syndic; do
@ -7094,7 +7292,39 @@ install_gentoo_check_services() {
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
__check_services_systemd salt-$fname || return 1
if __check_command_exists systemctl ; then
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
else
# Disable stdin to fix shell session hang on killing tee pipe
rc-service salt-$fname stop < /dev/null > /dev/null 2>&1
rc-service salt-$fname start < /dev/null || return 1
fi
done
return 0
}
install_gentoo_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 = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if __check_command_exists systemctl ; then
__check_services_systemd salt-$fname || return 1
else
__check_services_openrc salt-$fname || return 1
fi
done
return 0

View file

@ -1 +1 @@
1d07db867c195c864d0ae70664524f2099cc9a46872953293c67c3f239d4f4f5
f6c3e2c52f98d115809044b09062219369957caf30228b594033f0543e202c52

View file

@ -31,6 +31,8 @@ def target_python_version():
@pytest.fixture(scope='session')
def target_salt_version():
target_salt = os.environ["KITCHEN_SUITE"].split("-", 2)[-1].replace("-", ".")
if target_salt.endswith(".0") and float(target_salt) >= 3000:
target_salt = ".".join(target_salt.split(".")[:-1])
if target_salt in ("latest", "master"):
pytest.skip("Don't have a specific salt version to test against")
return target_salt