mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 01:30:21 +00:00
Merge pull request #1348 from s0undt3ch/stable
[Stable] Merge forward from develop
This commit is contained in:
commit
13b8215645
13 changed files with 1367 additions and 180 deletions
126
.drone.jsonnet
126
.drone.jsonnet
|
@ -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 = [
|
||||
{ name: 'amazon', version: '1' },
|
||||
{ name: 'amazon', version: '2' },
|
||||
// { name: 'centos', version: '6' },
|
||||
{ name: 'centos', version: '7' },
|
||||
{ name: 'debian', version: '8' },
|
||||
{ name: 'debian', version: '9' },
|
||||
// { name: 'ubuntu', version: '1404' },
|
||||
// { name: 'ubuntu', version: '1604' },
|
||||
{ name: 'ubuntu', version: '1804' },
|
||||
{ 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: 'Debian 8', slug: 'debian-8', multiplier: 5, depends: [] },
|
||||
{ name: 'Debian 9', slug: 'debian-9', multiplier: 6, depends: [] },
|
||||
{ name: 'Fedora 28', slug: 'fedora-28', multiplier: 6, depends: [] },
|
||||
{ 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() = {
|
||||
kind: 'pipeline',
|
||||
name: 'run-shellcheck',
|
||||
name: 'Lint',
|
||||
|
||||
steps: [
|
||||
{
|
||||
name: 'build',
|
||||
name: 'shellcheck',
|
||||
image: 'koalaman/shellcheck-alpine',
|
||||
commands: [
|
||||
'shellcheck -s sh -f checkstyle bootstrap-salt.sh',
|
||||
|
@ -25,30 +53,84 @@ local Shellcheck() = {
|
|||
],
|
||||
};
|
||||
|
||||
local Build(os, os_version) = {
|
||||
|
||||
local Build(distro) = {
|
||||
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: [
|
||||
{
|
||||
name: 'build',
|
||||
privileged: true,
|
||||
image: 'saltstack/drone-plugin-kitchen',
|
||||
settings: {
|
||||
target: std.format('%s-%s', [os, os_version]),
|
||||
requirements: 'tests/requirements.txt',
|
||||
name: 'throttle-build',
|
||||
image: 'alpine',
|
||||
commands: [
|
||||
std.format(
|
||||
"sh -c 't=%(offset)s; echo Sleeping %(offset)s seconds; sleep %(offset)s'",
|
||||
{ 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: [
|
||||
'run-shellcheck',
|
||||
],
|
||||
'Lint',
|
||||
] + distro.depends,
|
||||
};
|
||||
|
||||
|
||||
[
|
||||
Shellcheck(),
|
||||
] + [
|
||||
Build(distro.name, distro.version)
|
||||
Build(distro)
|
||||
for distro in distros
|
||||
]
|
||||
|
|
1079
.drone.yml
1079
.drone.yml
File diff suppressed because it is too large
Load diff
123
.kitchen.yml
123
.kitchen.yml
|
@ -4,11 +4,11 @@ driver:
|
|||
use_sudo: false
|
||||
hostname: salt
|
||||
privileged: true
|
||||
username: kitchen
|
||||
username: root
|
||||
cap_add:
|
||||
- sys_admin
|
||||
disable_upstart: false
|
||||
use_internal_docker_network: true
|
||||
use_internal_docker_network: false
|
||||
|
||||
provisioner:
|
||||
name: salt_solo
|
||||
|
@ -17,29 +17,17 @@ provisioner:
|
|||
salt_bootstrap_options: -MPfq git %s
|
||||
install_after_init_environment: true
|
||||
log_level: info
|
||||
sudo: true
|
||||
sudo: false
|
||||
require_chef: false
|
||||
formula: tests
|
||||
state_top:
|
||||
base:
|
||||
'*':
|
||||
- tests.accept_key
|
||||
run_salt_call: false
|
||||
init_environment: |
|
||||
echo 'auto_accept: true' > /tmp/auto-accept-keys.conf
|
||||
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:
|
||||
- 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
|
||||
driver_config:
|
||||
image: amazonlinux:1
|
||||
|
@ -52,18 +40,23 @@ platforms:
|
|||
image: amazonlinux:2
|
||||
platform: rhel
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
- name: ubuntu-18.04
|
||||
- name: arch
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-16.04
|
||||
image: archlinux/base
|
||||
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:
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: ubuntu-14.04
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
- name: centos-6
|
||||
driver_config:
|
||||
run_command: /sbin/init
|
||||
provision_command:
|
||||
- rm -f /sbin/initctl
|
||||
- dpkg-divert --local --rename --remove /sbin/initctl
|
||||
- yum install -y upstart
|
||||
provisioner:
|
||||
salt_bootstrap_options: -MPfq -y -x python2.7 git %s
|
||||
- name: debian-8
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
|
@ -72,49 +65,77 @@ platforms:
|
|||
- name: debian-9
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
- name: arch
|
||||
driver_config:
|
||||
image: base/archlinux
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
provision_command:
|
||||
- pacman -Syu --noconfirm systemd
|
||||
- systemctl enable sshd
|
||||
- name: opensuse
|
||||
- name: fedora-28
|
||||
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
|
||||
provision_command:
|
||||
- zypper --non-interactive install --auto-agree-with-licenses dbus-1
|
||||
- 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:
|
||||
- name: py2-git-2017.7
|
||||
- name: py2-git-2017-7
|
||||
provisioner:
|
||||
salt_version: 2017.7
|
||||
excludes:
|
||||
- arch
|
||||
- name: py2-git-2018.3
|
||||
- name: py2-git-2018-3
|
||||
provisioner:
|
||||
salt_version: 2018.3
|
||||
- name: py2-git-2019.2
|
||||
- name: py2-git-2019-2
|
||||
provisioner:
|
||||
salt_version: 2019.2
|
||||
- name: py2-git-develop
|
||||
provisioner:
|
||||
salt_version: develop
|
||||
- name: py2-stable-2017.7
|
||||
- name: py2-stable-2017-7
|
||||
provisioner:
|
||||
salt_version: 2017.7
|
||||
salt_bootstrap_options: -MP stable %s
|
||||
excludes:
|
||||
- arch
|
||||
- centos-6
|
||||
- fedora
|
||||
- opensuse
|
||||
- name: py2-stable-2018.3
|
||||
- fedora-28
|
||||
- fedora-29
|
||||
- opensuse-15
|
||||
- opensuse-42
|
||||
- name: py2-stable-2018-3
|
||||
provisioner:
|
||||
salt_version: 2018.3
|
||||
salt_bootstrap_options: -MP stable
|
||||
salt_bootstrap_options: -MP stable %s
|
||||
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:
|
||||
name: shell
|
||||
|
|
|
@ -40,6 +40,7 @@ Chris Buechler cbuechler cmb@pfsense.org
|
|||
Christer Edwards cedwards
|
||||
Christian McHugh mchugh19
|
||||
Clark Perkins iclarkperkins clark.perkins@digitalreasoning.com
|
||||
Dafydd Jones dafyddj dafydd@techneg.it
|
||||
Dag Viggo Lokøen dagvl dag.viggo@lokoen.org
|
||||
Dan Mick dmick dan.mick@inktank.com
|
||||
Daniel Poelzleithner poelzi
|
||||
|
@ -62,6 +63,7 @@ EYJ eyj
|
|||
fizmat fizmat
|
||||
Forrest Alvarez gravyboat
|
||||
Fred Reimer freimer freimer@freimer.org
|
||||
Gareth J. Greenaway garethgreenaway gareth@wiked.org
|
||||
Geoff Garside geoffgarside geoff@geoffgarside.co.uk
|
||||
George aflat gstock.public@gmail.com
|
||||
gdm85 gdm85
|
||||
|
@ -85,6 +87,7 @@ Justin Anderson justinta justin.ta@outlook.com
|
|||
Justin Findlay jfindlay jfindlay@gmail.com
|
||||
Karl Grzeszczak karlgrz
|
||||
Kenneth Wilke KennethWilke
|
||||
Kevin Quinn kevinquinnyo kevin.quinn@totalserversolutions.com
|
||||
Ky-Anh Huynh icy
|
||||
lomeroe lomeroe
|
||||
Liu Xiaohui oreh herolxh@gmail.com
|
||||
|
@ -112,6 +115,7 @@ Mike Place cachedout mp@saltstack.com
|
|||
N noelmcloughlin noel.maclochlainn@gmail.com
|
||||
nasenbaer13 nasenbaer13
|
||||
nevins-b nevins-b
|
||||
Nicholas Henry nshenry03 nshenry03@gmail.com
|
||||
Nicole Thomas rallytime nicole@saltstack.com
|
||||
Niels Abspoel aboe76 aboe76@gmail.com
|
||||
Nitin Madhok nmadhok nmadhok@clemson.edu
|
||||
|
@ -126,6 +130,7 @@ Petr Michalec epcim
|
|||
pjcreath pjcreath
|
||||
Prayag Verma pra85 prayag.verma@gmail.com
|
||||
ptonelli ptonelli
|
||||
Pulu Anau puluanau pulu.anau@dominodatalab.com
|
||||
Randy Thompson beardedeagle randy@heroictek.com
|
||||
Raymond Barbiero visualphoenix
|
||||
Rob Eden hedinfaok
|
||||
|
@ -136,6 +141,7 @@ Roman Mohr rmohr rmohr@redhat.com
|
|||
Ronald van Zantvoort The-Loeki ronald@pcextreme.nl
|
||||
RuriRyan RuriRyan ryan@btsoft.eu
|
||||
Ryan Walder ryanwalder ryanwalder@ucds.email
|
||||
Sam sticky-note sammy.smati@skazy.nc
|
||||
Sebastian Wendel sourceindex
|
||||
Sergey Paramonov serge-p serg.paramonov@s-vp.com
|
||||
Shane Lee twangboy slee@saltstack.com
|
||||
|
@ -143,6 +149,7 @@ Shawn Butts shawnbutts
|
|||
Skyler Berg skylerberg skylertheberg@gmail.com
|
||||
Stanislav B stanislavb
|
||||
Steve Groesz wolfpackmars2 wolfpackmars2@yahoo.com
|
||||
Sven R hackacad admin@hackacad.net
|
||||
sybix sybix
|
||||
Tate Eskew tateeskew
|
||||
Thomas S. Hatch thatch45 thatch45@saltstack.com
|
||||
|
@ -155,5 +162,6 @@ Whit Morriss whitmo whit@nocoast.us
|
|||
Wolodja Wentland babilen w@babilen5.org
|
||||
Wout wfhg
|
||||
Yann Masson ymasson
|
||||
Yoan Blanc greut yoan@dosimple.ch
|
||||
Yushi Nakai nyushi
|
||||
========================== ===================== ============================
|
||||
|
|
16
ChangeLog
16
ChangeLog
|
@ -1,5 +1,21 @@
|
|||
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:
|
||||
* use official amazon linux 2 repo for amazon linux 2 (mchugh19) #1287
|
||||
* Add release info to applicable docs (rallytime) #1292
|
||||
|
|
19
Dockerfile.drone-builds
Normal file
19
Dockerfile.drone-builds
Normal 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 []
|
5
Gemfile
5
Gemfile
|
@ -1,4 +1,5 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
gem 'kitchen-salt', '~>0.2'
|
||||
gem 'kitchen-docker', :git => 'https://github.com/test-kitchen/kitchen-docker.git'
|
||||
gem 'test-kitchen', '>= 2.0.1'
|
||||
gem 'kitchen-salt', '>= 0.5'
|
||||
gem 'kitchen-docker', '>= 2.9.0'
|
||||
|
|
|
@ -28,6 +28,7 @@ sum** of the downloaded ``bootstrap-salt.sh`` file.
|
|||
|
||||
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
|
||||
|
||||
- 2019.02.27: ``23728e4b5e54f564062070e3be53c5602b55c24c9a76671968abbf3d609258cb``
|
||||
- 2019.01.08: ``ab7f29b75711da4bb79aff98d46654f910d569ebe3e908753a3c5119017bb163``
|
||||
- 2018.08.15: ``6d414a39439a7335af1b78203f9d37e11c972b3c49c519742c6405e2944c6c4b``
|
||||
- 2018.08.13: ``98284bdc2b5ebaeb619b22090374e42a68e8fdefe6bff1e73bd1760db4407ed0``
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#======================================================================================================================
|
||||
set -o nounset # Treat unset variables as an error
|
||||
|
||||
__ScriptVersion="2019.01.08"
|
||||
__ScriptVersion="2019.05.20"
|
||||
__ScriptName="bootstrap-salt.sh"
|
||||
|
||||
__ScriptFullName="$0"
|
||||
|
@ -499,6 +499,7 @@ exec 2>"$LOGPIPE"
|
|||
# 14 SIGALRM
|
||||
# 15 SIGTERM
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
APT_ERR=$(mktemp /tmp/apt_error.XXXX)
|
||||
__exit_cleanup() {
|
||||
EXIT_CODE=$?
|
||||
|
||||
|
@ -521,6 +522,12 @@ __exit_cleanup() {
|
|||
rm -f "$LOGPIPE"
|
||||
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
|
||||
# shellcheck disable=SC2009
|
||||
TEE_PID=$(ps ax | grep tee | grep "$LOGFILE" | awk '{print $1}')
|
||||
|
@ -1818,25 +1825,23 @@ __wait_for_apt(){
|
|||
WAIT_TIMEOUT=900
|
||||
|
||||
# Run our passed in apt command
|
||||
"${@}"
|
||||
"${@}" 2>"$APT_ERR"
|
||||
APT_RETURN=$?
|
||||
|
||||
# If our exit code from apt is 100, then we're waiting on a lock
|
||||
while [ $APT_RETURN -eq 100 ]; do
|
||||
echoinfo "Aware of the lock. Patiently waiting $WAIT_TIMEOUT more seconds..."
|
||||
sleep 1
|
||||
WAIT_TIMEOUT=$((WAIT_TIMEOUT - 1))
|
||||
# Make sure we're not waiting on a lock
|
||||
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..."
|
||||
sleep 1
|
||||
WAIT_TIMEOUT=$((WAIT_TIMEOUT - 1))
|
||||
|
||||
# If timeout reaches 0, abort.
|
||||
if [ "$WAIT_TIMEOUT" -eq 0 ]; then
|
||||
echoerror "Apt, apt-get, aptitude, or dpkg process is taking too long."
|
||||
echoerror "Bootstrap script cannot proceed. Aborting."
|
||||
return 1
|
||||
else
|
||||
# Try running apt again until our return code != 100
|
||||
"${@}"
|
||||
APT_RETURN=$?
|
||||
fi
|
||||
if [ "$WAIT_TIMEOUT" -eq 0 ]; then
|
||||
echoerror "Apt, apt-get, aptitude, or dpkg process is taking too long."
|
||||
echoerror "Bootstrap script cannot proceed. Aborting."
|
||||
return 1
|
||||
else
|
||||
"${@}" 2>"$APT_ERR"
|
||||
APT_RETURN=$?
|
||||
fi
|
||||
done
|
||||
|
||||
return $APT_RETURN
|
||||
|
@ -1861,6 +1866,26 @@ __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 -------------------------------------------------------------------------------------------------------
|
||||
# NAME: __apt_key_fetch
|
||||
# DESCRIPTION: Download and import GPG public key for "apt-secure"
|
||||
|
@ -1869,8 +1894,13 @@ __apt_get_upgrade_noinput() {
|
|||
__apt_key_fetch() {
|
||||
url=$1
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__wait_for_apt apt-key adv ${_GPG_ARGS} --fetch-keys "$url"; return $?
|
||||
tempfile="$(__temp_gpg_pub)"
|
||||
|
||||
__fetch_url "$tempfile" "$url" || return 1
|
||||
apt-key add "$tempfile" || return 1
|
||||
rm -f "$tempfile"
|
||||
|
||||
return 0
|
||||
} # ---------- end of function __apt_key_fetch ----------
|
||||
|
||||
|
||||
|
@ -1882,16 +1912,7 @@ __apt_key_fetch() {
|
|||
__rpm_import_gpg() {
|
||||
url=$1
|
||||
|
||||
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
|
||||
tempfile="$(__temp_gpg_pub)"
|
||||
|
||||
__fetch_url "$tempfile" "$url" || 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 "-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
|
||||
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
|
||||
__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/latest/"
|
||||
base_url="$HTTP_VAL://${_REPO_URL}/yum/amazon/2/\$basearch/$repo_rev/"
|
||||
gpg_key="${base_url}SALTSTACK-GPG-KEY.pub
|
||||
${base_url}base/RPM-GPG-KEY-CentOS-7"
|
||||
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
|
||||
# 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}-futures"
|
||||
|
||||
|
@ -5162,17 +5182,21 @@ __configure_freebsd_pkg_details() {
|
|||
fi
|
||||
FROM_FREEBSD="-r FreeBSD"
|
||||
|
||||
## add saltstack freebsd repo
|
||||
salt_conf_file=/usr/local/etc/pkg/repos/saltstack.conf
|
||||
{
|
||||
echo "SaltStack:{"
|
||||
echo " url: \"${SALTPKGCONFURL}\","
|
||||
echo " mirror_type: \"http\","
|
||||
echo " enabled: true"
|
||||
echo " priority: 10"
|
||||
echo "}"
|
||||
} > $salt_conf_file
|
||||
FROM_SALTSTACK="-r SaltStack"
|
||||
##### Workaround : Waiting for SaltStack Repository to be available for FreeBSD 12 ####
|
||||
if [ "${DISTRO_MAJOR_VERSION}" -ne 12 ]; then
|
||||
## add saltstack freebsd repo
|
||||
salt_conf_file=/usr/local/etc/pkg/repos/saltstack.conf
|
||||
{
|
||||
echo "SaltStack:{"
|
||||
echo " url: \"${SALTPKGCONFURL}\","
|
||||
echo " mirror_type: \"http\","
|
||||
echo " enabled: true"
|
||||
echo " priority: 10"
|
||||
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
|
||||
echo "WITH_PKGNG= yes" >> /etc/make.conf
|
||||
|
@ -5230,6 +5254,10 @@ install_freebsd_11_stable_deps() {
|
|||
install_freebsd_9_stable_deps
|
||||
}
|
||||
|
||||
install_freebsd_12_stable_deps() {
|
||||
install_freebsd_9_stable_deps
|
||||
}
|
||||
|
||||
install_freebsd_git_deps() {
|
||||
install_freebsd_9_stable_deps || return 1
|
||||
|
||||
|
@ -5316,6 +5344,16 @@ install_freebsd_11_stable() {
|
|||
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() {
|
||||
|
||||
# /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_12_stable_post() {
|
||||
install_freebsd_9_stable_post
|
||||
}
|
||||
|
||||
install_freebsd_git_post() {
|
||||
if [ -f $salt_conf_file ]; then
|
||||
rm -f $salt_conf_file
|
||||
|
@ -6049,7 +6091,7 @@ install_opensuse_15_git_deps() {
|
|||
PY_PKG_VER=2
|
||||
|
||||
# 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
|
||||
PY_PKG_VER=3
|
||||
__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} 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
|
||||
# We're on the develop branch, install whichever tornado is on the requirements file
|
||||
|
@ -7109,3 +7152,5 @@ else
|
|||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# vim: set sts=4 ts=4 et
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
delay:
|
||||
module.run:
|
||||
- name: test.sleep
|
||||
- kargs:
|
||||
length: 5
|
||||
|
||||
accept_minion_key:
|
||||
salt.wheel:
|
||||
- name: key.accept
|
||||
- match: salt
|
||||
- require:
|
||||
- delay
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
import functools
|
||||
import os
|
||||
import pytest
|
||||
import subprocess
|
||||
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
|
||||
@pytest.fixture(scope='session')
|
||||
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))
|
||||
|
|
|
@ -4,4 +4,4 @@ import pytest
|
|||
|
||||
def test_ping(host):
|
||||
with host.sudo():
|
||||
assert host.salt('test.ping')
|
||||
assert host.salt('test.ping', '--timeout=120')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
testinfra
|
||||
paramiko
|
||||
pywinrm
|
||||
pywinrm; sys.platform == 'win32'
|
||||
six>=1.10.0
|
||||
|
|
Loading…
Add table
Reference in a new issue