Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Salt install/configure Vagrant 1.8 compatible #180

Merged
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -32,10 +32,10 @@ matrix:
dist: trusty

before_install:
- .travis/install_salt "${TRAVIS_OS_NAME}"
- .travis/install_salt -F -c .travis -- "${TRAVIS_OS_NAME}"

install:
- .travis/configure_salt
- .travis/setup_salt_roots

# For debugging, check the grains reported by the Travis builder
- sudo salt-call --id="${SALT_NODE_ID}" grains.items

This file was deleted.

@@ -1,15 +1,9 @@
#!/usr/bin/env sh

install_salt () {
set -o errexit
set -o nounset

if [ "$#" -lt 1 ]; then
printf >&2 "usage: $0 os_name\n"
exit 1
fi
OS_NAME="$1"
set -o errexit
set -o nounset

install_salt () {
# Ensure that pinned versions match as closely as possible
if [ "${OS_NAME}" = "linux" ]; then
printf "$0: installing salt for Linux\n"
@@ -28,4 +22,46 @@ install_salt () {
fi
}

install_salt "$@"
configure_salt () {
printf "$0: copying Salt minion configuration from ${TEMPORARY_CONFIG_DIR}\n"
sudo mkdir -p /etc/salt
sudo cp "${FORCE_FLAG}" -- "${TEMPORARY_CONFIG_DIR}/minion" /etc/salt/minion
}

OPTIONS=$(getopt 'c:F' "$@")

eval set -- "${OPTIONS}"

TEMPORARY_CONFIG_DIR=""
FORCE_FLAG=""
OS_NAME=""

while true; do
case "$1" in
-c)
shift
TEMPORARY_CONFIG_DIR="$1"
shift
;;
-F)
FORCE_FLAG="-f"
shift
;;
--)
shift
break
;;
esac
done

if [ "$#" -lt 1 ]; then
printf >&2 "usage: $0 [-c <config_dir> [-F]] [--] os_name\n"
exit 1
fi

OS_NAME="$1"
install_salt

if [ -n "${TEMPORARY_CONFIG_DIR}" ]; then
configure_salt
fi
@@ -0,0 +1,12 @@
#!/usr/bin/env sh

set -o errexit
set -o nounset

setup_salt_roots () {
sudo mkdir -p /srv/salt
sudo cp -r . /srv/salt/states
sudo cp -r .travis/test_pillars /srv/salt/pillars
}

setup_salt_roots "$@"
@@ -44,7 +44,7 @@ Vagrant.configure(2) do |config|
machine.vm.synced_folder File.join(dir, ".travis/test_pillars"), pillar_root
machine.vm.provision :salt do |salt|
salt.bootstrap_script = '.travis/install_salt'
salt.install_command = node[:os] # Pass OS type to install_salt script
salt.install_args = node[:os] # Pass OS type to install_salt script
salt.masterless = true
salt.minion_config = '.travis/minion'
# hack to provide additional options to salt-call
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.