Merge remote-tracking branch 'upstream/develop' into stable

This commit is contained in:
Pedro Algarvio 2019-05-20 11:02:01 +01:00
commit a92556163e
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF
13 changed files with 1367 additions and 180 deletions

View file

@ -1,22 +1,50 @@
local git_suites = [
{ name: 'Py2 2017.7(Git)', slug: 'py2-git-2017-7', depends: [] },
{ name: 'Py2 2018.3(Git)', slug: 'py2-git-2018-3', depends: ['Py2 2017.7(Git)'] },
{ name: 'Py2 2019.2(Git)', slug: 'py2-git-2019-2', depends: ['Py2 2018.3(Git)'] },
// {name: 'Py2 develop(Stable)', slug: 'py2-git-develop'}, // Don't test against Salt's develop branch. Stability is not assured.
];
local stable_suites = [
{ name: 'Py2 2017.7(Stable)', slug: 'py2-stable-2017-7', depends: ['Py2 2017.7(Git)'] },
{ 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)'] },
];
local distros = [ local distros = [
{ name: 'amazon', version: '1' }, { name: 'Arch', slug: 'arch', multiplier: 0, depends: [] },
{ name: 'amazon', version: '2' }, // { name: 'Amazon 1', slug: 'amazon-1', multiplier: 1, depends: [] },
// { name: 'centos', version: '6' }, // { name: 'Amazon 2', slug: 'amazon-2', multiplier: 2, depends: [] },
{ name: 'centos', version: '7' }, { name: 'CentOS 6', slug: 'centos-6', multiplier: 3, depends: [] },
{ name: 'debian', version: '8' }, { name: 'CentOS 7', slug: 'centos-7', multiplier: 4, depends: [] },
{ name: 'debian', version: '9' }, { name: 'Debian 8', slug: 'debian-8', multiplier: 5, depends: [] },
// { name: 'ubuntu', version: '1404' }, { name: 'Debian 9', slug: 'debian-9', multiplier: 6, depends: [] },
// { name: 'ubuntu', version: '1604' }, { name: 'Fedora 28', slug: 'fedora-28', multiplier: 6, depends: [] },
{ name: 'ubuntu', version: '1804' }, { name: 'Fedora 29', slug: 'fedora-29', multiplier: 5, depends: [] },
{ name: 'Opensuse 15.0', slug: 'opensuse-15', multiplier: 4, depends: [] },
{ name: 'Opensuse 42.3', slug: 'opensuse-42', multiplier: 3, 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',
'debian-8',
'debian-9',
'ubuntu-1604',
'ubuntu-1804',
]; ];
local Shellcheck() = { local Shellcheck() = {
kind: 'pipeline', kind: 'pipeline',
name: 'run-shellcheck', name: 'Lint',
steps: [ steps: [
{ {
name: 'build', name: 'shellcheck',
image: 'koalaman/shellcheck-alpine', image: 'koalaman/shellcheck-alpine',
commands: [ commands: [
'shellcheck -s sh -f checkstyle bootstrap-salt.sh', 'shellcheck -s sh -f checkstyle bootstrap-salt.sh',
@ -25,30 +53,84 @@ local Shellcheck() = {
], ],
}; };
local Build(os, os_version) = {
local Build(distro) = {
kind: 'pipeline', kind: 'pipeline',
name: std.format('build-%s-%s', [os, os_version]), name: distro.name,
node: {
project: 'open',
},
local suites = if std.count(stable_distros, distro.slug) > 0 then git_suites + stable_suites else git_suites,
steps: [ steps: [
{ {
name: 'build', name: 'throttle-build',
privileged: true, image: 'alpine',
image: 'saltstack/drone-plugin-kitchen', commands: [
settings: { std.format(
target: std.format('%s-%s', [os, os_version]), "sh -c 't=%(offset)s; echo Sleeping %(offset)s seconds; sleep %(offset)s'",
requirements: 'tests/requirements.txt', { offset: 5 * 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 10', // 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: [ depends_on: [
'run-shellcheck', 'Lint',
], ] + distro.depends,
}; };
[ [
Shellcheck(), Shellcheck(),
] + [ ] + [
Build(distro.name, distro.version) Build(distro)
for distro in distros for distro in distros
] ]

1079
.drone.yml

File diff suppressed because it is too large Load diff

View file

@ -4,11 +4,11 @@ driver:
use_sudo: false use_sudo: false
hostname: salt hostname: salt
privileged: true privileged: true
username: kitchen username: root
cap_add: cap_add:
- sys_admin - sys_admin
disable_upstart: false disable_upstart: false
use_internal_docker_network: true use_internal_docker_network: false
provisioner: provisioner:
name: salt_solo name: salt_solo
@ -17,29 +17,17 @@ provisioner:
salt_bootstrap_options: -MPfq git %s salt_bootstrap_options: -MPfq git %s
install_after_init_environment: true install_after_init_environment: true
log_level: info log_level: info
sudo: true sudo: false
require_chef: false require_chef: false
formula: tests formula: tests
state_top: run_salt_call: false
base: init_environment: |
'*': echo 'auto_accept: true' > /tmp/auto-accept-keys.conf
- tests.accept_key mkdir -p /etc/salt/master.d
mv /tmp/auto-accept-keys.conf /etc/salt/master.d/auto-accept-keys.conf
sh -c 't=$(shuf -i 1-15 -n 1); echo Sleeping $t seconds; sleep $t'
platforms: platforms:
- name: fedora
driver_config:
image: fedora:latest
run_command: /usr/lib/systemd/systemd
- name: centos-7
driver_config:
run_command: /usr/lib/systemd/systemd
- name: centos-6
driver_config:
run_command: /sbin/init
provision_command:
- yum install -y upstart
provisioner:
salt_bootstrap_options: -MPfq -y -x python2.7 git %s
- name: amazon-1 - name: amazon-1
driver_config: driver_config:
image: amazonlinux:1 image: amazonlinux:1
@ -52,18 +40,23 @@ platforms:
image: amazonlinux:2 image: amazonlinux:2
platform: rhel platform: rhel
run_command: /usr/lib/systemd/systemd run_command: /usr/lib/systemd/systemd
- name: ubuntu-18.04 - name: arch
driver_config: driver_config:
run_command: /lib/systemd/systemd image: archlinux/base
- name: ubuntu-16.04 run_command: /usr/lib/systemd/systemd
provision_command:
- pacman -Syu --noconfirm --needed systemd grep awk procps which
- systemctl enable sshd
- name: centos-7
driver_config: driver_config:
run_command: /lib/systemd/systemd run_command: /usr/lib/systemd/systemd
- name: ubuntu-14.04 - name: centos-6
driver_config: driver_config:
run_command: /sbin/init run_command: /sbin/init
provision_command: provision_command:
- rm -f /sbin/initctl - yum install -y upstart
- dpkg-divert --local --rename --remove /sbin/initctl provisioner:
salt_bootstrap_options: -MPfq -y -x python2.7 git %s
- name: debian-8 - name: debian-8
driver_config: driver_config:
run_command: /lib/systemd/systemd run_command: /lib/systemd/systemd
@ -72,49 +65,77 @@ platforms:
- name: debian-9 - name: debian-9
driver_config: driver_config:
run_command: /lib/systemd/systemd run_command: /lib/systemd/systemd
- name: arch - name: fedora-28
driver_config:
image: base/archlinux
run_command: /usr/lib/systemd/systemd
provision_command:
- pacman -Syu --noconfirm systemd
- systemctl enable sshd
- name: opensuse
driver_config: driver_config:
image: fedora:28
run_command: /usr/lib/systemd/systemd
- name: fedora-29
driver_config:
image: fedora:29
run_command: /usr/lib/systemd/systemd
- name: opensuse-15
driver_config:
image: opensuse/leap:15.0
run_command: /usr/lib/systemd/systemd run_command: /usr/lib/systemd/systemd
provision_command: provision_command:
- zypper --non-interactive install --auto-agree-with-licenses dbus-1
- systemctl enable sshd.service - systemctl enable sshd.service
provisioner:
salt_bootstrap_options: -MPfq -y -x python2 git %s
- name: opensuse-42
driver_config:
image: opensuse/leap:42.3
run_command: /usr/lib/systemd/systemd
provision_command:
- zypper --non-interactive install --auto-agree-with-licenses dbus-1
- systemctl enable sshd.service
- name: ubuntu-18.04
driver_config:
run_command: /lib/systemd/systemd
- name: ubuntu-16.04
driver_config:
run_command: /lib/systemd/systemd
suites: suites:
- name: py2-git-2017.7 - name: py2-git-2017-7
provisioner: provisioner:
salt_version: 2017.7 salt_version: 2017.7
excludes: - name: py2-git-2018-3
- arch
- name: py2-git-2018.3
provisioner: provisioner:
salt_version: 2018.3 salt_version: 2018.3
- name: py2-git-2019.2 - name: py2-git-2019-2
provisioner: provisioner:
salt_version: 2019.2 salt_version: 2019.2
- name: py2-git-develop - name: py2-stable-2017-7
provisioner:
salt_version: develop
- name: py2-stable-2017.7
provisioner: provisioner:
salt_version: 2017.7 salt_version: 2017.7
salt_bootstrap_options: -MP stable %s salt_bootstrap_options: -MP stable %s
excludes: excludes:
- arch - arch
- centos-6 - fedora-28
- fedora - fedora-29
- opensuse - opensuse-15
- name: py2-stable-2018.3 - opensuse-42
- name: py2-stable-2018-3
provisioner: provisioner:
salt_version: 2018.3 salt_version: 2018.3
salt_bootstrap_options: -MP stable salt_bootstrap_options: -MP stable %s
excludes: excludes:
- centos-6 - arch
- fedora-28
- fedora-29
- opensuse-15
- opensuse-42
- name: py2-stable-2019-2
provisioner:
salt_version: 2019.2
salt_bootstrap_options: -MP stable %s
excludes:
- arch
- fedora-28
- fedora-29
- opensuse-15
- opensuse-42
verifier: verifier:
name: shell name: shell

View file

@ -40,6 +40,7 @@ Chris Buechler cbuechler cmb@pfsense.org
Christer Edwards cedwards Christer Edwards cedwards
Christian McHugh mchugh19 Christian McHugh mchugh19
Clark Perkins iclarkperkins clark.perkins@digitalreasoning.com Clark Perkins iclarkperkins clark.perkins@digitalreasoning.com
Dafydd Jones dafyddj dafydd@techneg.it
Dag Viggo Lokøen dagvl dag.viggo@lokoen.org Dag Viggo Lokøen dagvl dag.viggo@lokoen.org
Dan Mick dmick dan.mick@inktank.com Dan Mick dmick dan.mick@inktank.com
Daniel Poelzleithner poelzi Daniel Poelzleithner poelzi
@ -62,6 +63,7 @@ EYJ eyj
fizmat fizmat fizmat fizmat
Forrest Alvarez gravyboat Forrest Alvarez gravyboat
Fred Reimer freimer freimer@freimer.org Fred Reimer freimer freimer@freimer.org
Gareth J. Greenaway garethgreenaway gareth@wiked.org
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
gdm85 gdm85 gdm85 gdm85
@ -85,6 +87,7 @@ Justin Anderson justinta justin.ta@outlook.com
Justin Findlay jfindlay jfindlay@gmail.com Justin Findlay jfindlay jfindlay@gmail.com
Karl Grzeszczak karlgrz Karl Grzeszczak karlgrz
Kenneth Wilke KennethWilke Kenneth Wilke KennethWilke
Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com
Ky-Anh Huynh icy Ky-Anh Huynh icy
lomeroe lomeroe lomeroe lomeroe
Liu Xiaohui oreh herolxh@gmail.com Liu Xiaohui oreh herolxh@gmail.com
@ -112,6 +115,7 @@ Mike Place cachedout mp@saltstack.com
N noelmcloughlin noel.maclochlainn@gmail.com N noelmcloughlin noel.maclochlainn@gmail.com
nasenbaer13 nasenbaer13 nasenbaer13 nasenbaer13
nevins-b nevins-b nevins-b nevins-b
Nicholas Henry nshenry03 nshenry03@gmail.com
Nicole Thomas rallytime nicole@saltstack.com Nicole Thomas rallytime nicole@saltstack.com
Niels Abspoel aboe76 aboe76@gmail.com Niels Abspoel aboe76 aboe76@gmail.com
Nitin Madhok nmadhok nmadhok@clemson.edu Nitin Madhok nmadhok nmadhok@clemson.edu
@ -126,6 +130,7 @@ Petr Michalec epcim
pjcreath pjcreath pjcreath pjcreath
Prayag Verma pra85 prayag.verma@gmail.com Prayag Verma pra85 prayag.verma@gmail.com
ptonelli ptonelli ptonelli ptonelli
Pulu Anau puluanau pulu.anau@dominodatalab.com
Randy Thompson beardedeagle randy@heroictek.com Randy Thompson beardedeagle randy@heroictek.com
Raymond Barbiero visualphoenix Raymond Barbiero visualphoenix
Rob Eden hedinfaok Rob Eden hedinfaok
@ -136,6 +141,7 @@ Roman Mohr rmohr rmohr@redhat.com
Ronald van Zantvoort The-Loeki ronald@pcextreme.nl Ronald van Zantvoort The-Loeki ronald@pcextreme.nl
RuriRyan RuriRyan ryan@btsoft.eu RuriRyan RuriRyan ryan@btsoft.eu
Ryan Walder ryanwalder ryanwalder@ucds.email Ryan Walder ryanwalder ryanwalder@ucds.email
Sam sticky-note sammy.smati@skazy.nc
Sebastian Wendel sourceindex Sebastian Wendel sourceindex
Sergey Paramonov serge-p serg.paramonov@s-vp.com Sergey Paramonov serge-p serg.paramonov@s-vp.com
Shane Lee twangboy slee@saltstack.com Shane Lee twangboy slee@saltstack.com
@ -143,6 +149,7 @@ Shawn Butts shawnbutts
Skyler Berg skylerberg skylertheberg@gmail.com Skyler Berg skylerberg skylertheberg@gmail.com
Stanislav B stanislavb Stanislav B stanislavb
Steve Groesz wolfpackmars2 wolfpackmars2@yahoo.com Steve Groesz wolfpackmars2 wolfpackmars2@yahoo.com
Sven R hackacad admin@hackacad.net
sybix sybix sybix sybix
Tate Eskew tateeskew Tate Eskew tateeskew
Thomas S. Hatch thatch45 thatch45@saltstack.com Thomas S. Hatch thatch45 thatch45@saltstack.com
@ -155,5 +162,6 @@ Whit Morriss whitmo whit@nocoast.us
Wolodja Wentland babilen w@babilen5.org Wolodja Wentland babilen w@babilen5.org
Wout wfhg Wout wfhg
Yann Masson ymasson Yann Masson ymasson
Yoan Blanc greut yoan@dosimple.ch
Yushi Nakai nyushi Yushi Nakai nyushi
========================== ===================== ============================ ========================== ===================== ============================

View file

@ -1,5 +1,21 @@
Version TBD (In Progress on the Develop Branch): Version TBD (In Progress on the Develop Branch):
Version 2019.05.20:
* Allow stable version selection for amazon linux (puluanau) #1328
* FreeBSD 12 support (sticky-note) #1329
* Apt wait for lock modification (ripesensor) #1335
* Opensuse 15 Git installation fixes (s0undt3ch) #1340 #1341
* Amazon Linux Image fixes (nshenry03) #1343
* apt_key_fetch fixes (greut) #1344
* CentOS Git and PIP installation m2crypto fixes (s0undt3ch) #1347
* CI process enhancements/fixes (s0undt3ch) #1347
Version 2019.02.27:
* Add support for bunsenlabs devian derivative (kevinquinnyo) #1300
* Add support for TurnKey devian derivative (dafyddj) #1313
* Fix BSD develop install (hackacad) #1316
* Ensure python-concurrent.futures is installed for Ubuntu (garethgreenaway) #1321
Version 2019.01.08: Version 2019.01.08:
* use official amazon linux 2 repo for amazon linux 2 (mchugh19) #1287 * use official amazon linux 2 repo for amazon linux 2 (mchugh19) #1287
* Add release info to applicable docs (rallytime) #1292 * Add release info to applicable docs (rallytime) #1292

19
Dockerfile.drone-builds Normal file
View file

@ -0,0 +1,19 @@
# 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

@ -1,4 +1,5 @@
source "https://rubygems.org" source "https://rubygems.org"
gem 'kitchen-salt', '~>0.2' gem 'test-kitchen', '>= 2.0.1'
gem 'kitchen-docker', :git => 'https://github.com/test-kitchen/kitchen-docker.git' gem 'kitchen-salt', '>= 0.5'
gem 'kitchen-docker', '>= 2.9.0'

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: The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
- 2019.02.27: ``23728e4b5e54f564062070e3be53c5602b55c24c9a76671968abbf3d609258cb``
- 2019.01.08: ``ab7f29b75711da4bb79aff98d46654f910d569ebe3e908753a3c5119017bb163`` - 2019.01.08: ``ab7f29b75711da4bb79aff98d46654f910d569ebe3e908753a3c5119017bb163``
- 2018.08.15: ``6d414a39439a7335af1b78203f9d37e11c972b3c49c519742c6405e2944c6c4b`` - 2018.08.15: ``6d414a39439a7335af1b78203f9d37e11c972b3c49c519742c6405e2944c6c4b``
- 2018.08.13: ``98284bdc2b5ebaeb619b22090374e42a68e8fdefe6bff1e73bd1760db4407ed0`` - 2018.08.13: ``98284bdc2b5ebaeb619b22090374e42a68e8fdefe6bff1e73bd1760db4407ed0``

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="2019.01.08" __ScriptVersion="2019.02.27"
__ScriptName="bootstrap-salt.sh" __ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0" __ScriptFullName="$0"
@ -499,6 +499,7 @@ exec 2>"$LOGPIPE"
# 14 SIGALRM # 14 SIGALRM
# 15 SIGTERM # 15 SIGTERM
#---------------------------------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------------------------------
APT_ERR=$(mktemp /tmp/apt_error.XXXX)
__exit_cleanup() { __exit_cleanup() {
EXIT_CODE=$? EXIT_CODE=$?
@ -521,6 +522,12 @@ __exit_cleanup() {
rm -f "$LOGPIPE" rm -f "$LOGPIPE"
fi fi
# Remove the temporary apt error file when the script exits
if [ -f "$APT_ERR" ]; then
echodebug "Removing the temporary apt error file $APT_ERR"
rm -f "$APT_ERR"
fi
# Kill tee when exiting, CentOS, at least requires this # Kill tee when exiting, CentOS, at least requires this
# shellcheck disable=SC2009 # shellcheck disable=SC2009
TEE_PID=$(ps ax | grep tee | grep "$LOGFILE" | awk '{print $1}') TEE_PID=$(ps ax | grep tee | grep "$LOGFILE" | awk '{print $1}')
@ -1818,25 +1825,23 @@ __wait_for_apt(){
WAIT_TIMEOUT=900 WAIT_TIMEOUT=900
# Run our passed in apt command # Run our passed in apt command
"${@}" "${@}" 2>"$APT_ERR"
APT_RETURN=$? APT_RETURN=$?
# If our exit code from apt is 100, then we're waiting on a lock # Make sure we're not waiting on a lock
while [ $APT_RETURN -eq 100 ]; do while [ $APT_RETURN -ne 0 ] && grep -q '^E: Could not get lock' "$APT_ERR"; do
echoinfo "Aware of the lock. Patiently waiting $WAIT_TIMEOUT more seconds..." echoinfo "Aware of the lock. Patiently waiting $WAIT_TIMEOUT more seconds..."
sleep 1 sleep 1
WAIT_TIMEOUT=$((WAIT_TIMEOUT - 1)) WAIT_TIMEOUT=$((WAIT_TIMEOUT - 1))
# If timeout reaches 0, abort. if [ "$WAIT_TIMEOUT" -eq 0 ]; then
if [ "$WAIT_TIMEOUT" -eq 0 ]; then echoerror "Apt, apt-get, aptitude, or dpkg process is taking too long."
echoerror "Apt, apt-get, aptitude, or dpkg process is taking too long." echoerror "Bootstrap script cannot proceed. Aborting."
echoerror "Bootstrap script cannot proceed. Aborting." return 1
return 1 else
else "${@}" 2>"$APT_ERR"
# Try running apt again until our return code != 100 APT_RETURN=$?
"${@}" fi
APT_RETURN=$?
fi
done done
return $APT_RETURN return $APT_RETURN
@ -1861,6 +1866,26 @@ __apt_get_upgrade_noinput() {
} # ---------- end of function __apt_get_upgrade_noinput ---------- } # ---------- end of function __apt_get_upgrade_noinput ----------
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __temp_gpg_pub
# DESCRIPTION: Create a temporary file for downloading a GPG public key.
#----------------------------------------------------------------------------------------------------------------------
__temp_gpg_pub() {
if __check_command_exists mktemp; then
tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)"
if [ -z "$tempfile" ]; then
echoerror "Failed to create temporary file in /tmp"
return 1
fi
else
tempfile="/tmp/salt-gpg-$$.pub"
fi
echo $tempfile
} # ----------- end of function __temp_gpg_pub -----------
#--- FUNCTION ------------------------------------------------------------------------------------------------------- #--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __apt_key_fetch # NAME: __apt_key_fetch
# DESCRIPTION: Download and import GPG public key for "apt-secure" # DESCRIPTION: Download and import GPG public key for "apt-secure"
@ -1869,8 +1894,13 @@ __apt_get_upgrade_noinput() {
__apt_key_fetch() { __apt_key_fetch() {
url=$1 url=$1
# shellcheck disable=SC2086 tempfile="$(__temp_gpg_pub)"
__wait_for_apt apt-key adv ${_GPG_ARGS} --fetch-keys "$url"; return $?
__fetch_url "$tempfile" "$url" || return 1
apt-key add "$tempfile" || return 1
rm -f "$tempfile"
return 0
} # ---------- end of function __apt_key_fetch ---------- } # ---------- end of function __apt_key_fetch ----------
@ -1882,16 +1912,7 @@ __apt_key_fetch() {
__rpm_import_gpg() { __rpm_import_gpg() {
url=$1 url=$1
if __check_command_exists mktemp; then tempfile="$(__temp_gpg_pub)"
tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)"
if [ -z "$tempfile" ]; then
echoerror "Failed to create temporary file in /tmp"
return 1
fi
else
tempfile="/tmp/salt-gpg-$$.pub"
fi
__fetch_url "$tempfile" "$url" || return 1 __fetch_url "$tempfile" "$url" || return 1
rpm --import "$tempfile" || return 1 rpm --import "$tempfile" || return 1
@ -3830,7 +3851,7 @@ install_centos_git_deps() {
if [ "${_PY_EXE}" != "" ] && [ "$_PIP_ALLOWED" -eq "$BS_TRUE" ]; then if [ "${_PY_EXE}" != "" ] && [ "$_PIP_ALLOWED" -eq "$BS_TRUE" ]; then
# If "-x" is defined, install dependencies with pip based on the Python version given. # If "-x" is defined, install dependencies with pip based on the Python version given.
_PIP_PACKAGES="m2crypto jinja2 msgpack-python pycrypto PyYAML tornado<5.0 zmq futures>=2.0" _PIP_PACKAGES="m2crypto!=0.33.0 jinja2 msgpack-python pycrypto PyYAML tornado<5.0 zmq futures>=2.0"
# install swig and openssl on cent6 # install swig and openssl on cent6
if [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then if [ "$DISTRO_MAJOR_VERSION" -eq 6 ]; then
@ -4789,8 +4810,7 @@ install_amazon_linux_ami_2_deps() {
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
__REPO_FILENAME="saltstack-repo.repo" __REPO_FILENAME="saltstack-repo.repo"
base_url="$HTTP_VAL://${_REPO_URL}/yum/redhat/7/\$basearch/$repo_rev/" base_url="$HTTP_VAL://${_REPO_URL}/yum/amazon/2/\$basearch/$repo_rev/"
base_url="$HTTP_VAL://${_REPO_URL}/yum/amazon/2/\$basearch/latest/"
gpg_key="${base_url}SALTSTACK-GPG-KEY.pub gpg_key="${base_url}SALTSTACK-GPG-KEY.pub
${base_url}base/RPM-GPG-KEY-CentOS-7" ${base_url}base/RPM-GPG-KEY-CentOS-7"
repo_name="SaltStack repo for Amazon Linux 2.0" repo_name="SaltStack repo for Amazon Linux 2.0"
@ -4814,7 +4834,7 @@ _eof
# Package python-ordereddict-1.1-2.el6.noarch is obsoleted by python26-2.6.9-2.88.amzn1.x86_64 # Package python-ordereddict-1.1-2.el6.noarch is obsoleted by python26-2.6.9-2.88.amzn1.x86_64
# which is already installed # which is already installed
__PACKAGES="m2crypto ${pkg_append}-crypto ${pkg_append}-jinja2 PyYAML" __PACKAGES="m2crypto ${pkg_append}-crypto ${pkg_append}-jinja2 PyYAML procps-ng"
__PACKAGES="${__PACKAGES} ${pkg_append}-msgpack ${pkg_append}-requests ${pkg_append}-zmq" __PACKAGES="${__PACKAGES} ${pkg_append}-msgpack ${pkg_append}-requests ${pkg_append}-zmq"
__PACKAGES="${__PACKAGES} ${pkg_append}-futures" __PACKAGES="${__PACKAGES} ${pkg_append}-futures"
@ -5162,17 +5182,21 @@ __configure_freebsd_pkg_details() {
fi fi
FROM_FREEBSD="-r FreeBSD" FROM_FREEBSD="-r FreeBSD"
## add saltstack freebsd repo ##### Workaround : Waiting for SaltStack Repository to be available for FreeBSD 12 ####
salt_conf_file=/usr/local/etc/pkg/repos/saltstack.conf if [ "${DISTRO_MAJOR_VERSION}" -ne 12 ]; then
{ ## add saltstack freebsd repo
echo "SaltStack:{" salt_conf_file=/usr/local/etc/pkg/repos/saltstack.conf
echo " url: \"${SALTPKGCONFURL}\"," {
echo " mirror_type: \"http\"," echo "SaltStack:{"
echo " enabled: true" echo " url: \"${SALTPKGCONFURL}\","
echo " priority: 10" echo " mirror_type: \"http\","
echo "}" echo " enabled: true"
} > $salt_conf_file echo " priority: 10"
FROM_SALTSTACK="-r SaltStack" echo "}"
} > $salt_conf_file
FROM_SALTSTACK="-r SaltStack"
fi
##### End Workaround : Waiting for SaltStack Repository to be available for FreeBSD 12 ####
## ensure future ports builds use pkgng ## ensure future ports builds use pkgng
echo "WITH_PKGNG= yes" >> /etc/make.conf echo "WITH_PKGNG= yes" >> /etc/make.conf
@ -5230,6 +5254,10 @@ install_freebsd_11_stable_deps() {
install_freebsd_9_stable_deps install_freebsd_9_stable_deps
} }
install_freebsd_12_stable_deps() {
install_freebsd_9_stable_deps
}
install_freebsd_git_deps() { install_freebsd_git_deps() {
install_freebsd_9_stable_deps || return 1 install_freebsd_9_stable_deps || return 1
@ -5316,6 +5344,16 @@ install_freebsd_11_stable() {
return 0 return 0
} }
install_freebsd_12_stable() {
#
# installing latest version of salt from FreeBSD CURRENT ports repo
#
# shellcheck disable=SC2086
/usr/local/sbin/pkg install ${FROM_FREEBSD} -y sysutils/py-salt || return 1
return 0
}
install_freebsd_git() { install_freebsd_git() {
# /usr/local/bin/python2 in FreeBSD is a symlink to /usr/local/bin/python2.7 # /usr/local/bin/python2 in FreeBSD is a symlink to /usr/local/bin/python2.7
@ -5382,6 +5420,10 @@ install_freebsd_11_stable_post() {
install_freebsd_9_stable_post install_freebsd_9_stable_post
} }
install_freebsd_12_stable_post() {
install_freebsd_9_stable_post
}
install_freebsd_git_post() { install_freebsd_git_post() {
if [ -f $salt_conf_file ]; then if [ -f $salt_conf_file ]; then
rm -f $salt_conf_file rm -f $salt_conf_file
@ -6049,7 +6091,7 @@ install_opensuse_15_git_deps() {
PY_PKG_VER=2 PY_PKG_VER=2
# This is required by some of the python2 packages below # This is required by some of the python2 packages below
__PACKAGES="libpython2_7-1_0" __PACKAGES="libpython2_7-1_0 python2-futures python-ipaddress"
else else
PY_PKG_VER=3 PY_PKG_VER=3
__PACKAGES="" __PACKAGES=""
@ -6057,6 +6099,7 @@ install_opensuse_15_git_deps() {
__PACKAGES="${__PACKAGES} libzmq5 python${PY_PKG_VER}-Jinja2 python${PY_PKG_VER}-msgpack" __PACKAGES="${__PACKAGES} libzmq5 python${PY_PKG_VER}-Jinja2 python${PY_PKG_VER}-msgpack"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-pycrypto python${PY_PKG_VER}-pyzmq" __PACKAGES="${__PACKAGES} python${PY_PKG_VER}-pycrypto python${PY_PKG_VER}-pyzmq"
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-xml"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then 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 develop branch, install whichever tornado is on the requirements file
@ -7109,3 +7152,5 @@ else
fi fi
exit 0 exit 0
# vim: set sts=4 ts=4 et

View file

@ -1,4 +1,12 @@
delay:
module.run:
- name: test.sleep
- kargs:
length: 5
accept_minion_key: accept_minion_key:
salt.wheel: salt.wheel:
- name: key.accept - name: key.accept
- match: salt - match: salt
- require:
- delay

View file

@ -1,19 +1,16 @@
import functools
import os import os
import pytest import pytest
import subprocess
import testinfra import testinfra
if os.environ.get('KITCHEN_USERNAME') == 'vagrant':
if 'windows' in os.environ.get('KITCHEN_INSTANCE'):
test_host = testinfra.get_host('winrm://{KITCHEN_USERNAME}:{KITCHEN_PASSWORD}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ), no_ssl=True)
else:
test_host = testinfra.get_host('paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
else:
test_host = testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))
@pytest.fixture(scope='session')
@pytest.fixture
def host(): def host():
return test_host if os.environ.get('KITCHEN_USERNAME') == 'vagrant':
if 'windows' in os.environ.get('KITCHEN_INSTANCE'):
return testinfra.get_host(
'winrm://{KITCHEN_USERNAME}:{KITCHEN_PASSWORD}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
no_ssl=True)
return testinfra.get_host(
'paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
return testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))

View file

@ -4,4 +4,4 @@ import pytest
def test_ping(host): def test_ping(host):
with host.sudo(): with host.sudo():
assert host.salt('test.ping') assert host.salt('test.ping', '--timeout=120')

View file

@ -1,4 +1,4 @@
testinfra testinfra
paramiko paramiko
pywinrm pywinrm; sys.platform == 'win32'
six>=1.10.0 six>=1.10.0