Make almost all the element scripts as e/u/pipefail
Following the latest dib-lint reporting, make sure almost all the scripts are enabling -e, -u, and pipefail. This eases the discovery of failing commands, and the usage of unset variables. There are few exceptions with flags not set: * elements/hadoop-hdp/install.d/40-install-hdp, set -e when installing HDP 2.0, it tries to install tez, which does not seem to exist in Hortonworks' repositories * elements/ssh/install.d/33-ssh, set -e the version of augtool (part of augeas 0.10) in older Ubuntu versions (like Precise, needed by the cloudera plugin) exits with wrong return values in autosave mode * elements/storm/install.d/60-storm, set -e It tries to change the permission of /etc/supervisord.conf, which does not seem to exist Change-Id: Ic1314639dfc6a66c48ca87b6820707a2b0cb1dbd Partial-Bug: #1435306
This commit is contained in:
parent
157dd805e6
commit
2fb2422da8
@ -3,5 +3,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
rm /etc/apt/apt.conf.d/01proxy
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
mkdir -p /etc/apt/apt.conf.d/
|
||||
touch /etc/apt/apt.conf.d/01proxy
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$UBUNTU_MIRROR" ]; then
|
||||
echo "You should specify parameter 'UBUNTU_MIRROR'"
|
||||
|
@ -3,5 +3,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
mv /opt/repos/* /etc/yum.repos.d/
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
mkdir -p /opt/repos
|
||||
mv /etc/yum.repos.d/* /opt/repos/
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$CENTOS_MIRROR" ]; then
|
||||
echo "You should specify parameter 'CENTOS_MIRROR'"
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages which
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "fedora" ]; then
|
||||
install-packages iptables-services
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "fedora" ]; then
|
||||
install-packages iptables-services
|
||||
|
@ -3,5 +3,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
mv /opt/repos/* /etc/yum.repos.d/
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
mkdir -p /opt/repos
|
||||
mv /etc/yum.repos.d/* /opt/repos
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$FEDORA_MIRROR" ]; then
|
||||
echo "You should specify parameter 'FEDORA_MIRROR'"
|
||||
|
@ -7,6 +7,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" != "ubuntu" ]; then
|
||||
echo "Distro $DISTRO_NAME not supported by CDH. Exiting."
|
||||
|
@ -6,6 +6,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
case "$DISTRO_NAME" in
|
||||
ubuntu )
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$JAVA_DOWNLOAD_URL" ]; then
|
||||
if [ -z "$JAVA_FILE" ]; then
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "ubuntu" ]; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget unzip
|
||||
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
for i in cloudera-scm-agent \
|
||||
cloudera-scm-server \
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
function add_repo_5_0_0 {
|
||||
case $DISTRO_NAME in
|
||||
|
@ -25,5 +25,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
|
||||
|
@ -23,6 +23,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget
|
||||
install-packages ntp
|
||||
|
@ -27,6 +27,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
function install_ganglia {
|
||||
# Install ganglia
|
||||
|
@ -29,5 +29,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
find /etc/yum.repos.d -name "*.repo" -type f | xargs sed "s/enabled=1/enabled=0/" -i
|
||||
|
@ -23,6 +23,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# ===== CLEANUP MISC =====
|
||||
rm -rf /var/cache/*
|
||||
|
@ -24,6 +24,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Turn off gmetad
|
||||
chkconfig gmetad off
|
||||
|
@ -24,6 +24,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Turn on ntp service
|
||||
chkconfig ntpd on
|
||||
|
@ -24,6 +24,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Turn off ambari-server service for the first boot of this image
|
||||
chkconfig ambari-server off
|
||||
|
@ -28,6 +28,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# This is only necessary for an HDP 2.x install
|
||||
if [[ $DIB_HDP_VERSION == "2.0" ]]; then
|
||||
|
@ -25,6 +25,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# create a new local yum repository definition that
|
||||
# includes:
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "START: installing MapR core dependencies"
|
||||
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "START: installing Scala"
|
||||
|
||||
|
@ -4,5 +4,6 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install -D -g root -o root -m 0644 $(dirname $0)/versions.py /tmp/versions.py
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "START: installing MapR core repository"
|
||||
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "START: installing MapR ecosystem repository"
|
||||
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "START: downloading ExtJS library"
|
||||
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "centos" -o "$DISTRO_NAME" = "rhel" ]; then
|
||||
sed '/^Defaults requiretty*/ s/^/#/' -i /etc/sudoers
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "ubuntu" ]; then
|
||||
apt-get update
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "MapR version ${DIB_MAPR_VERSION}"
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
function download_hadoop_package {
|
||||
echo "Hadoop version $DIB_HADOOP_VERSION will be injected into image. Starting the download"
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "${JAVA_DOWNLOAD_URL:-}" ]; then
|
||||
if [ -z "${JAVA_FILE:-}" ]; then
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget tar
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "${HIVE_DOWNLOAD_URL:-}" ]; then
|
||||
version_check=$(echo $HIVE_VERSION | sed -e '/[0-9]\.[0-9][0-9]\.[0-9]/d')
|
||||
|
@ -4,6 +4,7 @@ if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
unset DIB_JAVA_DISTRO
|
||||
unset JAVA_RC
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "fedora" ]; then
|
||||
install-packages community-mysql community-mysql-libs community-mysql-server mysql-connector-java
|
||||
|
@ -7,6 +7,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ "$DISTRO_NAME" = "ubuntu" ]; then
|
||||
if [ -e "/etc/init/mysql.conf" ]; then
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "Oozie setup"
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [[ "$DIB_HADOOP_VERSION" < "2.0.0" ]]; then
|
||||
if [ -z "${OOZIE_HADOOP_V1_DOWNLOAD_URL:-}" -a -z "${OOZIE_HADOOP_V1_FILE:-}" ]; then
|
||||
|
@ -3,7 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -e
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "Begin: installation of Java"
|
||||
|
||||
|
@ -3,5 +3,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages redhat-lsb
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$DIB_PASSWORD" ]; then
|
||||
echo "Error during setup password for root"
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "$SAHARA_ELEMENTS_COMMIT_ID" -o -z "$DIB_UTILS_COMMIT_ID" -o -z "$DIB_COMMIT_ID" ]; then
|
||||
echo "SAHARA_ELEMENTS_COMMIT_ID, DIB_UTILS_COMMIT_ID and DIB_COMMIT_ID must be specified, exiting"
|
||||
|
@ -5,6 +5,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget tar
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# We have to chown the Spark directories to make it usable for the default user
|
||||
# Unfortunately the Ubuntu user does not exists when DIB is creating the image
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "${SPARK_DOWNLOAD_URL:-}" -a -z "${DIB_HADOOP_VERSION:-}" ]; then
|
||||
echo -e "Neither DIB_HADOOP_VERSION nor SPARK_DOWNLOAD_URL are set. Impossible to install Spark.\nAborting"
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -u
|
||||
set -o pipefail
|
||||
echo "Begin: install and configure SSH"
|
||||
|
||||
# /etc/ssh/sshd_config is provided by openssh-server
|
||||
|
@ -5,6 +5,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget unzip build-essential uuid-dev git libtool autoconf pkg-config tar
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -z "${STORM_DOWNLOAD_URL:-}" -a -z "${DIB_STORM_VERSION:-}"]; then
|
||||
echo -e "Neither DIB_STORM_VERSION nor STORM_DOWNLOAD_URL are set. Impossible to install Storm.\nAborting"
|
||||
|
@ -3,6 +3,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget
|
||||
|
||||
|
@ -3,5 +3,7 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages -u
|
||||
|
@ -5,6 +5,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install-packages wget
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
sed -i -e 's,^exit 0$,[ -f /opt/zookeeper/firstboot.sh ] \&\& sh /opt/zookeeper/firstboot.sh; exit 0,' /etc/rc.local
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user