mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Allow RedHat based distributions to choose epel-testing
to bootstrap. Fixes #190.
This commit is contained in:
parent
3f181db63f
commit
b2bc75dfff
3 changed files with 60 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
Version 1.5.7:
|
||||
* For RedHat based distributions which rely on `epel`, the user can now pass `testing` to the
|
||||
script and `epel-testing` shall be used to bootstrap salt and it's dependencies.
|
||||
|
||||
|
||||
Version 1.5.6:
|
||||
* If there's a `grains` file on the provided temporary configuration directory, move it to the
|
||||
proper place while moving the minion configuration file.
|
||||
|
|
|
@ -231,6 +231,7 @@ SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/etc/salt}
|
|||
PKI_DIR=${SALT_ETC_DIR}/pki
|
||||
FORCE_OVERWRITE=${BS_FORCE_OVERWRITE:-$BS_FALSE}
|
||||
BS_GENTOO_USE_BINHOST=${BS_GENTOO_USE_BINHOST:-$BS_FALSE}
|
||||
BS_EPEL_REPO=${BS_EPEL_REPO:-epel}
|
||||
# __SIMPLIFY_VERSION is mostly used in Solaris based distributions
|
||||
__SIMPLIFY_VERSION=$BS_TRUE
|
||||
|
||||
|
@ -319,7 +320,7 @@ else
|
|||
fi
|
||||
|
||||
# Check installation type
|
||||
if [ "$ITYPE" != "stable" ] && [ "$ITYPE" != "daily" ] && [ "$ITYPE" != "git" ]; then
|
||||
if [ "$(echo $ITYPE | egrep '(stable|testing|daily|git)')" != "x" ]; then
|
||||
echoerror "Installation type \"$ITYPE\" is not known..."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -343,18 +344,21 @@ if [ "$#" -gt 0 ]; then
|
|||
echoerror "Too many arguments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# whoami alternative for SunOS
|
||||
if [ -f /usr/xpg4/bin/id ]; then
|
||||
whoami='/usr/xpg4/bin/id -un'
|
||||
else
|
||||
whoami='whoami'
|
||||
fi
|
||||
|
||||
# Root permissions are required to run this script
|
||||
if [ $(${whoami}) != "root" ]; then
|
||||
if [ "$(${whoami})" != "root" ]; then
|
||||
echoerror "Salt requires root privileges to install. Please re-run this script as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Let's discover how we're being called
|
||||
CALLER=$(echo `ps -a -o pid,args | grep $$ | grep -v grep | tr -s ' '` | cut -d ' ' -f 2)
|
||||
if [ "${CALLER}x" = "${0}x" ]; then
|
||||
CALLER="PIPED THROUGH"
|
||||
|
@ -876,6 +880,15 @@ if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $ITYPE = "daily" ]); then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Only RedHat based distros have testing support
|
||||
if [ ${ITYPE} = "testing" ]; then
|
||||
if [ "$(echo ${DISTRO_NAME_L} | egrep 'centos|red_hat|amazon')x" != "x" ]; then
|
||||
echoerror "${DISTRO_NAME} does not have testing packages support"
|
||||
exit 1
|
||||
fi
|
||||
BS_EPEL_REPO="epel-testing"
|
||||
fi
|
||||
|
||||
#--- FUNCTION ----------------------------------------------------------------
|
||||
# NAME: __function_defined
|
||||
# DESCRIPTION: Checks if a function is defined within this scripts scope
|
||||
|
@ -1599,10 +1612,10 @@ install_centos_stable_deps() {
|
|||
if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then
|
||||
yum -y install PyYAML python26-m2crypto m2crypto python26 \
|
||||
python26-crypto python26-msgpack python26-zmq \
|
||||
python26-jinja2 --enablerepo=epel || return 1
|
||||
python26-jinja2 --enablerepo=${BS_EPEL_REPO} || return 1
|
||||
else
|
||||
yum -y install PyYAML m2crypto python-crypto python-msgpack \
|
||||
python-zmq python-jinja2 --enablerepo=epel || return 1
|
||||
python-zmq python-jinja2 --enablerepo=${BS_EPEL_REPO} || return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
@ -1615,7 +1628,7 @@ install_centos_stable() {
|
|||
if [ $INSTALL_MASTER -eq $BS_TRUE ] || [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
||||
packages="${packages} salt-master"
|
||||
fi
|
||||
yum -y install ${packages} --enablerepo=epel || return 1
|
||||
yum -y install ${packages} --enablerepo=${BS_EPEL_REPO} || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -1635,7 +1648,7 @@ install_centos_stable_post() {
|
|||
|
||||
install_centos_git_deps() {
|
||||
install_centos_stable_deps || return 1
|
||||
yum -y install git --enablerepo=epel || return 1
|
||||
yum -y install git --enablerepo=${BS_EPEL_REPO} || return 1
|
||||
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
|
@ -1842,12 +1855,12 @@ install_amazon_linux_ami_deps() {
|
|||
rpm -Uvh --force http://mirrors.kernel.org/fedora-epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm || return 1
|
||||
yum -y update || return 1
|
||||
yum -y install PyYAML m2crypto python-crypto python-msgpack python-zmq \
|
||||
python-ordereddict python-jinja2 --enablerepo=epel || return 1
|
||||
python-ordereddict python-jinja2 --enablerepo=${BS_EPEL_REPO} || return 1
|
||||
}
|
||||
|
||||
install_amazon_linux_ami_git_deps() {
|
||||
install_amazon_linux_ami_deps || return 1
|
||||
yum -y install git --enablerepo=epel || return 1
|
||||
yum -y install git --enablerepo=${BS_EPEL_REPO} || return 1
|
||||
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
|
|
|
@ -294,6 +294,40 @@ class InstallationTestCase(BootstrapTestCase):
|
|||
1, (rc, out, err)
|
||||
)
|
||||
|
||||
def test_install_testing(self):
|
||||
args = []
|
||||
if requires_pip_based_installations():
|
||||
args.append('-P')
|
||||
|
||||
args.append('testing')
|
||||
|
||||
rc, out, err = self.run_script(
|
||||
args=args, timeout=15 * 60, stream_stds=True
|
||||
)
|
||||
if GRAINS['os_family'] != 'RedHat':
|
||||
self.assert_script_result(
|
||||
'Failed to install testing',
|
||||
0, (rc, out, err)
|
||||
)
|
||||
|
||||
# Try to get the versions report
|
||||
self.assert_script_result(
|
||||
'Failed to get the versions report (\'--versions-report\')',
|
||||
0,
|
||||
self.run_script(
|
||||
script=None,
|
||||
args=('salt-minion', '--versions-report'),
|
||||
timeout=15 * 60,
|
||||
stream_stds=True
|
||||
)
|
||||
)
|
||||
else:
|
||||
self.assert_script_result(
|
||||
'Although system is not RedHat based, we managed to install '
|
||||
'testing',
|
||||
1, (rc, out, err)
|
||||
)
|
||||
|
||||
def test_install_stable_piped_through_sh(self):
|
||||
args = 'cat {0} | sh '.format(BOOTSTRAP_SCRIPT_PATH).split()
|
||||
if requires_pip_based_installations():
|
||||
|
|
Loading…
Add table
Reference in a new issue