Merge pull request #1472 from s0undt3ch/stable

Merge Develop For Stable Release
This commit is contained in:
Pedro Algarvio 2020-05-28 20:51:05 +01:00 committed by GitHub
commit d3c771f48c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 372 additions and 3647 deletions

View file

@ -1,208 +0,0 @@
local git_suites = [
{ name: 'Py2 2018.3(Git)', slug: 'py2-git-2018-3', depends: [] },
{ name: 'Py2 2019.2(Git)', slug: 'py2-git-2019-2', depends: ['Py2 2018.3(Git)'] },
{ name: 'Py2 3000(Git)', slug: 'py2-git-3000', depends: ['Py2 2019.2(Git)'] },
// {name: 'Py2 develop(Stable)', slug: 'py2-git-develop'}, // Don't test against Salt's develop branch. Stability is not assured.
];
local git_py3_suites = [
{ name: 'Py3 2018.3(Git)', slug: 'py3-git-2018-3', depends: [] },
{ name: 'Py3 2019.2(Git)', slug: 'py3-git-2019-2', depends: ['Py3 2018.3(Git)'] },
{ name: 'Py3 3000(Git)', slug: 'py3-git-3000', depends: ['Py3 2019.2(Git)'] },
];
local stable_suites = [
{ name: 'Py2 2018.3(Stable)', slug: 'py2-stable-2018-3', depends: ['Py2 2018.3(Git)'] },
{ name: 'Py2 2019.2(Stable)', slug: 'py2-stable-2019-2', depends: ['Py2 2019.2(Git)'] },
{ name: 'Py2 3000(Stable)', slug: 'py2-stable-3000', depends: ['Py2 3000(Git)'] },
];
local stable_py3_suites = [
{ name: 'Py3 2018.3(Stable)', slug: 'py3-stable-2018-3', depends: ['Py3 2018.3(Git)'] },
{ name: 'Py3 2019.2(Stable)', slug: 'py3-stable-2019-2', depends: ['Py3 2019.2(Git)'] },
{ name: 'Py3 3000(Stable)', slug: 'py3-stable-3000', depends: ['Py3 3000(Git)'] },
];
local distros = [
{ name: 'Arch', slug: 'arch', multiplier: 0, depends: [] },
// { name: 'Amazon 1', slug: 'amazon-1', multiplier: 1, depends: [] },
{ name: 'Amazon 2', slug: 'amazon-2', multiplier: 2, depends: [] },
{ name: 'CentOS 6', slug: 'centos-6', multiplier: 3, depends: [] },
{ name: 'CentOS 7', slug: 'centos-7', multiplier: 4, depends: [] },
{ name: 'CentOS 8', slug: 'centos-8', multiplier: 5, depends: [] },
{ name: 'Debian 8', slug: 'debian-8', multiplier: 6, depends: [] },
{ name: 'Debian 9', slug: 'debian-9', multiplier: 7, depends: [] },
{ name: 'Debian 10', slug: 'debian-10', multiplier: 5, depends: [] },
{ name: 'Fedora 30', slug: 'fedora-30', multiplier: 4, depends: [] },
{ name: 'Fedora 31', slug: 'fedora-31', multiplier: 3, depends: [] },
{ name: 'Opensuse 15.1', slug: 'opensuse-15', multiplier: 2, depends: [] },
{ name: 'Ubuntu 16.04', slug: 'ubuntu-1604', multiplier: 1, depends: [] },
{ name: 'Ubuntu 18.04', slug: 'ubuntu-1804', multiplier: 0, depends: [] },
];
local stable_distros = [
'amazon-1',
'amazon-2',
'centos-6',
'centos-7',
'centos-8',
'debian-8',
'debian-9',
'debian-10',
'fedora-30',
'ubuntu-1604',
'ubuntu-1804',
];
local py3_distros = [
'amazon-2',
// 'arch',
'centos-7',
'centos-8',
'debian-9',
'debian-10',
'ubuntu-1604',
'ubuntu-1804',
'fedora-30',
'fedora-31',
];
local py2_blacklist = [
'centos-8',
'debian-10',
'fedora-30',
'fedora-31',
];
local blacklist_2018 = [
'centos-8',
'debian-10',
'amazon-2',
];
local Shellcheck() = {
kind: 'pipeline',
name: 'Lint',
steps: [
{
name: 'shellcheck',
image: 'koalaman/shellcheck-alpine:v0.6.0',
commands: [
'shellcheck -s sh -f checkstyle bootstrap-salt.sh',
],
},
],
};
local Build(distro) = {
kind: 'pipeline',
name: distro.name,
node: {
project: 'open',
},
local temp_git_suites = if std.count(py2_blacklist, distro.slug) > 0 then
[]
else
git_suites,
local temp_stable_suites = if std.count(py2_blacklist, distro.slug) > 0 then
[]
else if std.count(stable_distros, distro.slug) > 0 then
stable_suites
else
[],
local temp_git_py3_suites = if std.count(py3_distros, distro.slug) < 1 then
[]
else if std.count(blacklist_2018, distro.slug) > 0 then
git_py3_suites[1:]
else if std.count(py3_distros, distro.slug) > 0 then
git_py3_suites
else
[],
local temp_stable_py3_suites = if std.count(stable_distros, distro.slug) < 1 then
[]
else if std.count(blacklist_2018, distro.slug) > 0 then
stable_py3_suites[1:]
else if std.count(py3_distros, distro.slug) > 0 then
stable_py3_suites
else
[],
local suites = temp_git_suites + temp_stable_suites + temp_git_py3_suites + temp_stable_py3_suites,
steps: [
{
name: 'throttle-build',
image: 'alpine',
commands: [
std.format(
"sh -c 't=%(offset)s; echo Sleeping %(offset)s seconds; sleep %(offset)s'",
{ offset: 6 * std.length(suites) * distro.multiplier }
),
],
},
{
name: 'create',
image: 'saltstack/drone-salt-bootstrap-testing',
environment: {
DOCKER_HOST: 'tcp://docker:2375',
},
depends_on: [
'throttle-build',
],
commands: [
'bundle install --with docker --without opennebula ec2 windows vagrant',
"echo 'Waiting for docker to start'",
'sleep 20', // give docker enough time to start
'docker ps -a',
std.format('bundle exec kitchen create %s', [distro.slug]),
],
},
] + [
{
name: suite.name,
image: 'saltstack/drone-salt-bootstrap-testing',
environment: {
DOCKER_HOST: 'tcp://docker:2375',
},
depends_on: [
'throttle-build',
'create',
],
commands: [
'pip install -U pip',
'pip install -r tests/requirements.txt',
'bundle install --with docker --without opennebula ec2 windows vagrant',
std.format('bundle exec kitchen test %s-%s', [suite.slug, distro.slug]),
],
}
for suite in suites
],
services: [
{
name: 'docker',
image: 'saltstack/drone-salt-bootstrap-testing',
privileged: true,
environment: {},
command: [
'--storage-driver=overlay2',
],
},
],
depends_on: [
'Lint',
] + distro.depends,
};
[
Shellcheck(),
] + [
Build(distro)
for distro in distros
]

1748
.drone.yml

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -44,15 +44,14 @@ PY2_BLACKLIST = [
'debian-10', 'debian-10',
'fedora-30', 'fedora-30',
'fedora-31', 'fedora-31',
'fedora-32' 'fedora-32',
'opensuse-15'
] ]
PY3_BLACKLIST = [ PY3_BLACKLIST = [
'arch', # Defaults to Py3.8
'amazon-1', 'amazon-1',
'centos-6', 'centos-6',
'debian-8', 'debian-8',
'fedora-32' # Defaults to Py3.8
] ]
BLACKLIST_2018 = [ BLACKLIST_2018 = [
@ -69,6 +68,12 @@ SALT_BRANCHES = [
'latest' 'latest'
] ]
SALT_POST_3000_BLACKLIST = [
'centos-6',
'debian-8',
'fedora-30',
]
BRANCH_DISPLAY_NAMES = { BRANCH_DISPLAY_NAMES = {
'2018-3': 'v2018.3', '2018-3': 'v2018.3',
'2019-2': 'v2019.2', '2019-2': 'v2019.2',
@ -82,8 +87,6 @@ STABLE_BRANCH_BLACKLIST = [
LATEST_PKG_BLACKLIST = [ LATEST_PKG_BLACKLIST = [
'arch', # No packages are built '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 = { DISTRO_DISPLAY_NAMES = {
@ -110,6 +113,15 @@ def generate_test_jobs():
for distro in LINUX_DISTROS + OSX + WINDOWS: for distro in LINUX_DISTROS + OSX + WINDOWS:
for branch in SALT_BRANCHES: for branch in SALT_BRANCHES:
if branch == 'master' and distro in SALT_POST_3000_BLACKLIST:
continue
try:
if int(branch) >= 3000 and distro in SALT_POST_3000_BLACKLIST:
continue
except ValueError:
pass
if branch == 'latest': if branch == 'latest':
if distro in LATEST_PKG_BLACKLIST: if distro in LATEST_PKG_BLACKLIST:
continue continue
@ -138,15 +150,46 @@ def generate_test_jobs():
continue continue
for python_version in ('py2', 'py3'): for python_version in ('py2', 'py3'):
if branch == 'master' and python_version == 'py2':
# Salt's master branch no longer supports Python 2
continue
try:
if int(branch) >= 3000 and python_version == 'py2':
# Salt's 300X versions no longer supports Python 2
continue
except ValueError:
pass
for bootstrap_type in ('stable', 'git'): for bootstrap_type in ('stable', 'git'):
if bootstrap_type == 'stable' and branch == 'master': if bootstrap_type == 'stable':
continue if branch == 'master':
if bootstrap_type == 'stable' and distro not in STABLE_DISTROS: # For the master branch there's no stable build
continue continue
if distro not in STABLE_DISTROS:
continue
if bootstrap_type == 'stable' and branch in STABLE_BRANCH_BLACKLIST: if branch in STABLE_BRANCH_BLACKLIST:
continue continue
if distro.startswith("fedora") and branch != "latest":
# Fedora does not keep old builds around
continue
if bootstrap_type == "git":
if python_version == "py3":
if distro in ("arch", "fedora-32"):
allowed_branches = ["master"]
try:
int_branch = int(branch)
if int_branch > 3000:
allowed_branches.append(branch)
except ValueError:
pass
if branch not in allowed_branches:
# Arch and Fedora default to py3.8
continue
if branch == '2018-3' and distro in BLACKLIST_2018: if branch == '2018-3' and distro in BLACKLIST_2018:
continue continue

View file

@ -168,7 +168,6 @@ suites:
salt_version: 3000 salt_version: 3000
salt_bootstrap_options: -x python3 -MPfq git %s salt_bootstrap_options: -x python3 -MPfq git %s
excludes: excludes:
- arch
- amazon-1 - amazon-1
- centos-6 - centos-6
- debian-8 - debian-8
@ -215,12 +214,9 @@ suites:
salt_version: master salt_version: master
salt_bootstrap_options: -x python3 -MPfq -D git %s salt_bootstrap_options: -x python3 -MPfq -D git %s
excludes: excludes:
- arch
- amazon-1 - amazon-1
- centos-6 - centos-6
- debian-8 - debian-8
- fedora-32
- opensuse-15
- name: latest - name: latest
provisioner: provisioner:
@ -232,4 +228,4 @@ suites:
verifier: verifier:
name: shell name: shell
remote_exec: false remote_exec: false
command: pytest --cache-clear -v tests/integration/ command: pytest --cache-clear -v -s -ra --log-cli-level=info tests/integration/

View file

@ -50,6 +50,7 @@ denmat denmat
Denys Havrysh vutny denys.gavrysh@gmail.com Denys Havrysh vutny denys.gavrysh@gmail.com
deployboy deployboy deployboy deployboy
Diego Woitasen diegows diego@flugel.it Diego Woitasen diegows diego@flugel.it
Dmitry Kuzmenko DmitryKuzmenko dmitry.kuzmenko@dsr-corporation.com
EHJ-52n EHJ-52n EHJ-52n@users.noreply.github.com EHJ-52n EHJ-52n EHJ-52n@users.noreply.github.com
ek9 ek9 ek9 ek9
Elias Probst eliasp Elias Probst eliasp
@ -68,6 +69,7 @@ gdm85 gdm85
Geoff Garside geoffgarside geoff@geoffgarside.co.uk Geoff Garside geoffgarside geoff@geoffgarside.co.uk
George aflat gstock.public@gmail.com George aflat gstock.public@gmail.com
ggillies ggillies ggillies ggillies
Gilles Debunne gdebunne
Giuseppe Iannello giannello giuseppe.iannello@brokenloop.net Giuseppe Iannello giannello giuseppe.iannello@brokenloop.net
Gregory Meno GregMeno gregory.meno@inktank.com Gregory Meno GregMeno gregory.meno@inktank.com
Guillaume Derval GuillaumeDerval guillaume@guillaumederval.be Guillaume Derval GuillaumeDerval guillaume@guillaumederval.be
@ -79,15 +81,18 @@ Jan Heidbrink jheidbrink
Jared Bristow jars99 Jared Bristow jars99
Jared E Stroud jaredestroud jaredestroud@gmail.com Jared E Stroud jaredestroud jaredestroud@gmail.com
Jasper Lievisse Adriaanse jasperla jasper@humppa.nl Jasper Lievisse Adriaanse jasperla jasper@humppa.nl
Jaydeep jay1648
JD decomposite JD decomposite
Jeff Hui jeffh jeff@jeffhui.net Jeff Hui jeffh jeff@jeffhui.net
Jeff Strunk jstrunk Jeff Strunk jstrunk
John Hubbard ender8282 ender8282@gmail.com
Jorge Schrauwen sjorge sjorge@blackdot.be Jorge Schrauwen sjorge sjorge@blackdot.be
Juan A. Moyano wincus wincus.public@gmail.com Juan A. Moyano wincus wincus.public@gmail.com
Justin Anderson justinta justin.ta@outlook.com Justin Anderson justinta justin.ta@outlook.com
Justin Findlay jfindlay jfindlay@gmail.com Justin Findlay jfindlay jfindlay@gmail.com
kgbsd kgbsd
Karl Grzeszczak karlgrz Karl Grzeszczak karlgrz
Ken Crowell oeuftete kcrowell@saltstack.com
Kenneth Wilke KennethWilke Kenneth Wilke KennethWilke
Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com
kiemlicz kiemlicz kiemlicz kiemlicz

View file

@ -28,7 +28,7 @@ Please read the following guidelines before you
``` ```
curl -o bootstrap-salt.sh -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.sh curl -o bootstrap-salt.sh -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.sh
sudo sh bootstrap-salt.sh git develop sudo sh bootstrap-salt.sh git master
``` ```
3. **Isolate the demonstrable problem** -- make sure that the 3. **Isolate the demonstrable problem** -- make sure that the

View file

@ -1,5 +1,21 @@
Version TBD (In Progress on the Develop Branch): Version TBD (In Progress on the Develop Branch):
Version 2020.05.28:
* Fix Opensuse Tumbleweed (noelmcloughlin) #1441
* Remove Debian 8 from Python 3 supported list (jay1648) #1448
* Fixed deps parsing for FreeBSD git installs (cedwards) #1462
* Added support for the upcoming Sodium release (s0undt3ch) #1466
* Fixed KDE Neon detection (ender8282) #1466
* Updated README python 2 and 3 installations (gdebunne) #1466
* Updated README and CONTRIBUTING to prefer Salt's master branch (DmitryKuzmenko) #1466
* Fixed IUS repo addresses (oeuftete) #1469
* Updated tests to assert target Python and Salt versions (s0undt3ch) #1470
* Fixed Amazon 2 -x support (s0undt3ch) #1470
* Fix Fedora stable installs for older releases (s0undt3ch) #1470
* Fix CentOS 8 installations (s0undt3ch) #1470
* Default Debian 10 to Py3 (s0undt3ch) #1470
* Fix Arch Linux installs (s0undt3ch) #1470
Version 2020.02.24: Version 2020.02.24:
* Fix SLES 15 install (max298) #1431 * Fix SLES 15 install (max298) #1431
* Fix 3000(Neon) stable install (sblaisot) #1433 * Fix 3000(Neon) stable install (sblaisot) #1433

View file

@ -1,19 +0,0 @@
# docker build --rm -t saltstack/drone-salt-bootstrap-testing -f Dockerfile.drone-builds .
FROM docker:edge-dind
COPY Gemfile /Gemfile
COPY tests/requirements.txt /requirements.txt
RUN apk --update add \
wget python python-dev py-pip git ruby-bundler ruby-rdoc ruby-dev gcc make libc-dev openssl-dev libffi-dev && \
gem install bundler && \
bundle install --gemfile=/Gemfile --with docker --without opennebula ec2 windows vagrant && \
pip install -U pip && \
pip install -r /requirements.txt && \
rm -rf /requirements.txt /Gemfile /root/.cache
VOLUME /var/lib/docker
EXPOSE 2375
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"]
CMD []

View file

@ -30,6 +30,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file.
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is: The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
- 2020.02.24: ``efc46700aca78b8e51d7af9b06293f52ad495f3a8179c6bfb21a8c97ee41f1b7``
- 2020.02.04: ``ce877651b4938e3480f76b1629f582437f6ca8b73d7199fdb9e905e86fe85b34`` - 2020.02.04: ``ce877651b4938e3480f76b1629f582437f6ca8b73d7199fdb9e905e86fe85b34``
- 2020.01.29: ``e9afdfa877998c1c7f0e141a6728b33d0d24348e197aab2b9bde4fe6bc6db1b2`` - 2020.01.29: ``e9afdfa877998c1c7f0e141a6728b33d0d24348e197aab2b9bde4fe6bc6db1b2``
- 2020.01.21: ``53299aa0dfbf7ab381f3856bb7babfc04a1d6525be11db0b9466277b1e4d0c1a`` - 2020.01.21: ``53299aa0dfbf7ab381f3856bb7babfc04a1d6525be11db0b9466277b1e4d0c1a``
@ -79,7 +80,7 @@ Using ``curl`` to install latest development version from GitHub:
.. code:: console .. code:: console
curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
sudo sh bootstrap-salt.sh git develop sudo sh bootstrap-salt.sh git master
If you want to install a specific release version (based on the Git tags): If you want to install a specific release version (based on the Git tags):
@ -100,7 +101,7 @@ If all you want is to install a ``salt-master`` using latest Git:
.. code:: console .. code:: console
curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
sudo sh bootstrap-salt.sh -M -N git develop sudo sh bootstrap-salt.sh -M -N git master
If your host has Internet access only via HTTP proxy: If your host has Internet access only via HTTP proxy:
@ -142,15 +143,21 @@ If you already have Python installed, ``python 2.7``, then it's as easy as:
.. code:: console .. code:: console
python -m urllib "https://bootstrap.saltstack.com" > bootstrap-salt.sh python -m urllib "https://bootstrap.saltstack.com" > bootstrap-salt.sh
sudo sh bootstrap-salt.sh git develop sudo sh bootstrap-salt.sh git master
All Python versions should support the following in-line code: With python version 2, the following in-line code should always work:
.. code:: console .. code:: console
python -c 'import urllib; print urllib.urlopen("https://bootstrap.saltstack.com").read()' > bootstrap-salt.sh python -c 'import urllib; print urllib.urlopen("https://bootstrap.saltstack.com").read()' > bootstrap-salt.sh
sudo sh bootstrap-salt.sh git develop sudo sh bootstrap-salt.sh git master
With python version 3:
.. code:: console
python3 -c 'import urllib.request; print(urllib.request.urlopen("https://bootstrap.saltstack.com").read().decode("ascii"))' > bootstrap-salt.sh
sudo sh bootstrap-salt.sh git develop
Install using fetch Install using fetch
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
@ -207,11 +214,11 @@ Using ``wget`` to install your distribution's stable packages:
wget -O - https://bootstrap.saltstack.com | sudo sh wget -O - https://bootstrap.saltstack.com | sudo sh
Installing the latest develop branch of Salt: Installing the latest master branch of Salt:
.. code:: console .. code:: console
curl -L https://bootstrap.saltstack.com | sudo sh -s -- git develop curl -L https://bootstrap.saltstack.com | sudo sh -s -- git master
Supported Operating Systems Supported Operating Systems
@ -235,7 +242,7 @@ You also may need to disable repository configuration and allow ``pip`` installa
.. code:: console .. code:: console
sudo sh bootstrap-salt.sh -r -P git develop sudo sh bootstrap-salt.sh -r -P git master
**NOTE** **NOTE**
@ -300,7 +307,7 @@ in combination with the ``git`` installation method.
Ubuntu and derivatives Ubuntu and derivatives
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
- KDE neon (based on Ubuntu 16.04) - KDE neon (based on Ubuntu 18.04)
- Linux Mint 17/18 - Linux Mint 17/18
- Ubuntu 14.04/16.04/18.04 and subsequent non-LTS releases (see below) - Ubuntu 14.04/16.04/18.04 and subsequent non-LTS releases (see below)
@ -361,7 +368,6 @@ this offering, while limited, is as follows:
- CentOS 7 - CentOS 7
- Centos 8 - Centos 8
- Debian 8
- Debian 9 - Debian 9
- Debian 10 - Debian 10
- Fedora (only git installations) - Fedora (only git installations)
@ -383,8 +389,8 @@ The earliest release of Salt that supports Python3 is `2018.3.4`.
Tornado 5/6 Workaround Tornado 5/6 Workaround
---------------------- ----------------------
Salt does not support tornado>=5.0 currently. This support will not be added until the neon Salt does not support tornado>=5.0 currently. This support will be included in an upcoming release.
release. In order to work around this requirement on OSs that no longer have the tornado 4 package In order to work around this requirement on OSs that no longer have the tornado 4 package
available in their repositories we are pip installing tornado<5.0 in the bootstrap script. This available in their repositories we are pip installing tornado<5.0 in the bootstrap script. This
requires the user to pass -P to the bootstrap script if installing via git to ensure tornado is pip requires the user to pass -P to the bootstrap script if installing via git to ensure tornado is pip
installed. If a user does not pass this argument they will be warned that it is required for the installed. If a user does not pass this argument they will be warned that it is required for the

View file

@ -1,32 +0,0 @@
platform: Any CPU
environment:
matrix:
- bootstrap_args:
test_args: -master salt -runservice
- bootstrap_args: -runservice false
test_args: -master salt -noservice
- bootstrap_args: -minion a-minion
test_args: -minion a-minion -master salt -runservice
- bootstrap_args: -minion a-minion -master a-master
test_args: -minion a-minion -master a-master -runservice
build_script:
- ps: |
$Path = (Get-Location).Path | Join-Path -ChildPath bootstrap-salt.ps1
Invoke-Expression "$Path -verbose $env:bootstrap_args"
before_test:
- SET PATH=%PATH%;C:\salt
- salt-call --version
test_script:
- ps: |
$Path = (Get-Location).Path | Join-Path -ChildPath tests\runtests.ps1
Invoke-Expression "$Path -verbose $env:test_args"
matrix:
fast_finish: true

125
bootstrap-salt.sh Executable file → Normal file
View file

@ -23,7 +23,7 @@
#====================================================================================================================== #======================================================================================================================
set -o nounset # Treat unset variables as an error set -o nounset # Treat unset variables as an error
__ScriptVersion="2020.02.24" __ScriptVersion="2020.05.28"
__ScriptName="bootstrap-salt.sh" __ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0" __ScriptFullName="$0"
@ -603,7 +603,7 @@ elif [ "$ITYPE" = "stable" ]; then
if [ "$#" -eq 0 ];then if [ "$#" -eq 0 ];then
STABLE_REV="latest" STABLE_REV="latest"
else else
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)$')" != "" ]; 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" STABLE_REV="$1"
shift shift
elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}*(\.[0-9]*)?)$')" != "" ]; then elif [ "$(echo "$1" | grep -E '^(2[0-9]*\.[0-9]*\.[0-9]*|[3-9][0-9]{3}*(\.[0-9]*)?)$')" != "" ]; then
@ -614,7 +614,7 @@ elif [ "$ITYPE" = "stable" ]; then
fi fi
shift shift
else else
echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, 2016.3, 2016.11, 2017.7, 2018.3, 2019.2, 3000, latest, \$MAJOR.\$MINOR.\$PATCH until 2019.2, \$MAJOR or \$MAJOR.\$PATCH starting from 3000)" echo "Unknown stable version: $1 (valid: 1.6, 1.7, 2014.1, 2014.7, 2015.5, 2015.8, 2016.3, 2016.11, 2017.7, 2018.3, 2019.2, 3000, 3001, latest, \$MAJOR.\$MINOR.\$PATCH until 2019.2, \$MAJOR or \$MAJOR.\$PATCH starting from 3000)"
exit 1 exit 1
fi fi
fi fi
@ -693,6 +693,7 @@ if [ -n "$_PY_EXE" ]; then
echoinfo "Detected -x option. Using $_PY_EXE to install Salt." echoinfo "Detected -x option. Using $_PY_EXE to install Salt."
else else
_PY_PKG_VER="" _PY_PKG_VER=""
_PY_MAJOR_VERSION=""
fi fi
# If the configuration directory or archive does not exist, error out # If the configuration directory or archive does not exist, error out
@ -785,7 +786,6 @@ if [ -d "${_VIRTUALENV_DIR}" ]; then
exit 1 exit 1
fi fi
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __fetch_url # NAME: __fetch_url
# DESCRIPTION: Retrieves a URL and writes it to a given path # DESCRIPTION: Retrieves a URL and writes it to a given path
@ -996,7 +996,8 @@ __gather_linux_system_info() {
# Skip setting DISTRO_NAME this time, splitting CamelCase has failed. # Skip setting DISTRO_NAME this time, splitting CamelCase has failed.
# See https://github.com/saltstack/salt-bootstrap/issues/918 # See https://github.com/saltstack/salt-bootstrap/issues/918
[ "$n" = "$DISTRO_NAME" ] && DISTRO_NAME="" || DISTRO_NAME="$n" [ "$n" = "$DISTRO_NAME" ] && DISTRO_NAME="" || DISTRO_NAME="$n"
elif [ "${DISTRO_NAME}" = "openSUSE project" ]; then elif [ "$( echo "${DISTRO_NAME}" | grep openSUSE )" != "" ]; then
# lsb_release -si returns "openSUSE Tumbleweed" on openSUSE tumbleweed
# lsb_release -si returns "openSUSE project" on openSUSE 12.3 # lsb_release -si returns "openSUSE project" on openSUSE 12.3
# lsb_release -si returns "openSUSE" on openSUSE 15.n # lsb_release -si returns "openSUSE" on openSUSE 15.n
DISTRO_NAME="opensuse" DISTRO_NAME="opensuse"
@ -1117,7 +1118,7 @@ __gather_linux_system_info() {
n="SUSE" n="SUSE"
v="${rv}" v="${rv}"
;; ;;
opensuse-leap ) opensuse-* )
n="opensuse" n="opensuse"
v="${rv}" v="${rv}"
;; ;;
@ -1153,7 +1154,7 @@ __install_python() {
echoinfo "$DISTRO_NAME_L" echoinfo "$DISTRO_NAME_L"
case "$DISTRO_NAME_L" in case "$DISTRO_NAME_L" in
"red_hat"|"centos") "red_hat"|"centos")
__PYTHON_REPO_URL="https://centos${DISTRO_MAJOR_VERSION}.iuscommunity.org/ius-release.rpm" __PYTHON_REPO_URL="https://repo.ius.io/ius-release-el${DISTRO_MAJOR_VERSION}.rpm"
;; ;;
*) *)
echoerror "Installing a repo to provide a python package is only supported on Redhat/CentOS. echoerror "Installing a repo to provide a python package is only supported on Redhat/CentOS.
@ -1311,6 +1312,8 @@ __ubuntu_derivatives_translation() {
linaro_12_ubuntu_base="12.04" linaro_12_ubuntu_base="12.04"
elementary_os_02_ubuntu_base="12.04" elementary_os_02_ubuntu_base="12.04"
neon_16_ubuntu_base="16.04" neon_16_ubuntu_base="16.04"
neon_18_ubuntu_base="18.04"
neon_20_ubuntu_base="20.04"
# Translate Ubuntu derivatives to their base Ubuntu version # Translate Ubuntu derivatives to their base Ubuntu version
match=$(echo "$DISTRO_NAME_L" | grep -E ${UBUNTU_DERIVATIVES}) match=$(echo "$DISTRO_NAME_L" | grep -E ${UBUNTU_DERIVATIVES})
@ -1722,7 +1725,7 @@ echoinfo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}"
echo echo
# Simplify distro name naming on functions # Simplify distro name naming on functions
DISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -Ee 's/([[:space:]])+/_/g') DISTRO_NAME_L=$(echo "$DISTRO_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -Ee 's/([[:space:]])+/_/g' | sed -Ee 's/tumbleweed//' )
# Simplify version naming on functions # Simplify version naming on functions
if [ "$DISTRO_VERSION" = "" ] || [ ${_SIMPLIFY_VERSION} -eq $BS_FALSE ]; then if [ "$DISTRO_VERSION" = "" ] || [ ${_SIMPLIFY_VERSION} -eq $BS_FALSE ]; then
@ -2000,6 +2003,12 @@ __rpm_import_gpg() {
tempfile="$(__temp_gpg_pub)" tempfile="$(__temp_gpg_pub)"
__fetch_url "$tempfile" "$url" || return 1 __fetch_url "$tempfile" "$url" || return 1
# At least on CentOS 8, a missing newline at the end causes:
# error: /tmp/salt-gpg-n1gKUb1u.pub: key 1 not an armored public key.
# shellcheck disable=SC1003,SC2086
sed -i -e '$a\' $tempfile
rpm --import "$tempfile" || return 1 rpm --import "$tempfile" || return 1
rm -f "$tempfile" rm -f "$tempfile"
@ -2780,6 +2789,18 @@ EOM
} # ---------- end of function __install_salt_from_repo_post_neon ---------- } # ---------- end of function __install_salt_from_repo_post_neon ----------
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
if [ "x${_PY_MAJOR_VERSION}" = "x" ]; then
# Default to python 2 for pre Neon installs
_PY_MAJOR_VERSION=2
fi
else
if [ "x${_PY_MAJOR_VERSION}" = "x" ]; then
# Default to python 3 for post Neon install
_PY_MAJOR_VERSION=3
fi
fi
####################################################################################################################### #######################################################################################################################
# #
# Distribution install functions # Distribution install functions
@ -3358,6 +3379,15 @@ install_debian_deps() {
__apt_get_upgrade_noinput || return 1 __apt_get_upgrade_noinput || return 1
fi fi
if [ "$DISTRO_MAJOR_VERSION" -ge 10 ]; then
# Default Debian 10 to Py3
if [ "x${_PY_EXE}" = "x" ]; then
_PY_EXE=python3
_PY_MAJOR_VERSION=3
PY_PKG_VER=3
fi
fi
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
PY_PKG_VER=3 PY_PKG_VER=3
else else
@ -3798,19 +3828,30 @@ install_fedora_deps() {
} }
install_fedora_stable() { install_fedora_stable() {
if [ "$STABLE_REV" = "latest" ]; then
__SALT_VERSION=""
else
__SALT_VERSION="$(dnf list --showduplicates salt | grep "$STABLE_REV" | head -n 1 | awk '{print $2}')"
if [ "x${__SALT_VERSION}" = "x" ]; then
echoerror "Could not find a stable install for Salt ${STABLE_REV}"
exit 1
fi
echoinfo "Installing Stable Package Version ${__SALT_VERSION}"
__SALT_VERSION="-${__SALT_VERSION}"
fi
__PACKAGES="" __PACKAGES=""
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ];then
__PACKAGES="${__PACKAGES} salt-cloud" __PACKAGES="${__PACKAGES} salt-cloud${__SALT_VERSION}"
fi fi
if [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then if [ "$_INSTALL_MASTER" -eq $BS_TRUE ]; then
__PACKAGES="${__PACKAGES} salt-master" __PACKAGES="${__PACKAGES} salt-master${__SALT_VERSION}"
fi fi
if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then if [ "$_INSTALL_MINION" -eq $BS_TRUE ]; then
__PACKAGES="${__PACKAGES} salt-minion" __PACKAGES="${__PACKAGES} salt-minion${__SALT_VERSION}"
fi fi
if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then if [ "$_INSTALL_SYNDIC" -eq $BS_TRUE ]; then
__PACKAGES="${__PACKAGES} salt-syndic" __PACKAGES="${__PACKAGES} salt-syndic${__SALT_VERSION}"
fi fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086
@ -4083,6 +4124,14 @@ install_centos_stable_deps() {
yum -y update || return 1 yum -y update || return 1
fi fi
if [ "$DISTRO_MAJOR_VERSION" -ge 8 ]; then
# CentOS/RHEL 8 Default to Py3
if [ "x${_PY_EXE}" = "x" ]; then
_PY_EXE=python3
_PY_MAJOR_VERSION=3
fi
fi
if [ "$_DISABLE_REPOS" -eq "$BS_TRUE" ] && [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then if [ "$_DISABLE_REPOS" -eq "$BS_TRUE" ] && [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
echoerror "Detected -r or -R option while installing Salt packages for Python 3." echoerror "Detected -r or -R option while installing Salt packages for Python 3."
echoerror "Python 3 packages for Salt require the EPEL repository to be installed." echoerror "Python 3 packages for Salt require the EPEL repository to be installed."
@ -5191,23 +5240,19 @@ install_amazon_linux_ami_2_git_deps() {
fi fi
install_amazon_linux_ami_2_deps || return 1 install_amazon_linux_ami_2_deps || return 1
if __check_command_exists python3; then
if ! __check_command_exists pip3; then if [ "$_PY_MAJOR_VERSION" -eq 2 ]; then
__yum_install_noinput python3-pip PY_PKG_VER=2
fi PIP_EXE='/bin/pip'
PIP_EXE='/bin/pip3'
_PY_EXE='python3'
PY_PKG_VER=3
else else
PIP_EXE='pip' PY_PKG_VER=3
if __check_command_exists python2.7; then PIP_EXE='/bin/pip3'
if ! __check_command_exists pip2.7; then fi
__yum_install_noinput python2-pip __PACKAGES="python${PY_PKG_VER}-pip"
fi
PIP_EXE='/bin/pip' if ! __check_command_exists "${PIP_EXE}"; then
_PY_EXE='python2.7' # shellcheck disable=SC2086
PY_PKG_VER=2 __yum_install_noinput ${__PACKAGES} || return 1
fi
fi fi
if ! __check_command_exists git; then if ! __check_command_exists git; then
@ -5241,7 +5286,6 @@ install_amazon_linux_ami_2_git_deps() {
__REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")" __REQUIRED_TORNADO="$(grep tornado "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt")"
if [ "${__REQUIRED_TORNADO}" != "" ]; then if [ "${__REQUIRED_TORNADO}" != "" ]; then
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq "3" ]; then if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq "3" ]; then
__PACKAGES="${__PACKAGES} python3-pip"
__PIP_PACKAGES="${__PIP_PACKAGES} tornado<$_TORNADO_MAX_PY3_VERSION" __PIP_PACKAGES="${__PIP_PACKAGES} tornado<$_TORNADO_MAX_PY3_VERSION"
else else
__PACKAGES="${__PACKAGES} ${pkg_append}${PY_PKG_VER}-tornado" __PACKAGES="${__PACKAGES} ${pkg_append}${PY_PKG_VER}-tornado"
@ -5249,6 +5293,11 @@ install_amazon_linux_ami_2_git_deps() {
fi fi
fi fi
if [ "${__PIP_PACKAGES}" != "" ]; then
__check_pip_allowed "You need to allow pip based installations (-P) in order to install ${__PIP_PACKAGES}"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-pip"
fi
if [ "${__PACKAGES}" != "" ]; then if [ "${__PACKAGES}" != "" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
__yum_install_noinput ${__PACKAGES} || return 1 __yum_install_noinput ${__PACKAGES} || return 1
@ -5309,7 +5358,6 @@ install_amazon_linux_ami_2_deps() {
__REPO_FILENAME="saltstack-repo.repo" __REPO_FILENAME="saltstack-repo.repo"
__PY_VERSION_REPO="yum" __PY_VERSION_REPO="yum"
PY_PKG_VER="" PY_PKG_VER=""
_PY_MAJOR_VERSION=$(echo "$_PY_PKG_VER" | cut -c 7)
repo_label="saltstack-repo" repo_label="saltstack-repo"
repo_name="SaltStack repo for Amazon Linux 2" repo_name="SaltStack repo for Amazon Linux 2"
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 3 ]; then
@ -5467,11 +5515,19 @@ install_arch_linux_stable_deps() {
pacman-db-upgrade || return 1 pacman-db-upgrade || return 1
fi fi
if [ -n "$_PY_EXE" ] && [ "$_PY_MAJOR_VERSION" -eq 2 ]; then
PY_PKG_VER=2
else
PY_PKG_VER=""
fi
# YAML module is used for generating custom master/minion configs # YAML module is used for generating custom master/minion configs
pacman -Su --noconfirm --needed python2-yaml # shellcheck disable=SC2086
pacman -Su --noconfirm --needed python${PY_PKG_VER}-yaml
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
pacman -Su --noconfirm --needed python2-apache-libcloud || return 1 # shellcheck disable=SC2086
pacman -Su --noconfirm --needed python${PY_PKG_VER}-apache-libcloud || return 1
fi fi
if [ "${_EXTRA_PACKAGES}" != "" ]; then if [ "${_EXTRA_PACKAGES}" != "" ]; then
@ -5697,8 +5753,7 @@ install_freebsd_git_deps() {
if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then if [ "${_POST_NEON_INSTALL}" -eq $BS_FALSE ]; then
SALT_DEPENDENCIES=$(/usr/local/sbin/pkg search -R -d py37-salt | grep 'origin:' \ SALT_DEPENDENCIES=$(/usr/local/sbin/pkg rquery %dn py37-salt)
| tail -n +2 | awk -F\" '{print $2}')
# shellcheck disable=SC2086 # shellcheck disable=SC2086
/usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} python || return 1 /usr/local/sbin/pkg install -y ${SALT_DEPENDENCIES} python || return 1
@ -6374,7 +6429,7 @@ install_opensuse_stable_post() {
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue [ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue [ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /bin/systemctl ]; then if [ -f /bin/systemctl ] || [ -f /usr/bin/systemctl ]; then
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service) systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
sleep 1 sleep 1
systemctl daemon-reload systemctl daemon-reload

View file

@ -1,6 +1,10 @@
import os import os
import pprint
import pytest import pytest
import testinfra import testinfra
import logging
log = logging.getLogger(__name__)
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
@ -14,3 +18,19 @@ def host():
'paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ), 'paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY')) ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
return testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ)) return testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))
@pytest.fixture(scope='session')
def target_python_version():
target_python = os.environ["KITCHEN_SUITE"].split("-", 1)[0]
if target_python == "latest":
pytest.skip("Unable to get target python from {}".format(os.environ["KITCHEN_SUITE"]))
return int(target_python.replace("py", ""))
@pytest.fixture(scope='session')
def target_salt_version():
target_salt = os.environ["KITCHEN_SUITE"].split("-", 2)[-1].replace("-", ".")
if target_salt in ("latest", "master"):
pytest.skip("Don't have a specific salt version to test against")
return target_salt

View file

@ -1,7 +0,0 @@
# -*- coding: utf-8 -*-
import pytest
def test_ping(host):
with host.sudo():
assert host.salt('test.ping', '--timeout=120')

View file

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
import json
import pytest
import logging
import pprint
log = logging.getLogger(__name__)
def test_ping(host):
with host.sudo():
assert host.salt('test.ping', '--timeout=120')
def test_target_python_version(host, target_python_version):
with host.sudo():
ret = host.salt('grains.item', 'pythonversion', '--timeout=120')
assert ret["pythonversion"][0] == target_python_version
def test_target_salt_version(host, target_salt_version):
with host.sudo():
ret = host.salt('grains.item', 'saltversion', '--timeout=120')
assert ret["saltversion"].startswith(target_salt_version)