Adopt DIB_DEBUG_TRACE for tracing in elements

Mimic commit 36b59c001c1643217449646b371df46d2cb11b91 in
diskimage-builder, by adopting the usage of $DIB_DEBUG_TRACE to check
whether enable tracing in scripts.

Unlike with the diskimage-builder commit, the default is to not enable
tracing even in the few scripts that used to unconditionally "set -x".

Enabling tracing can be done by either:
- passing -x to disk-image-create
- exporting DIB_DEBUG_TRACE=N, with N=0/1

Change-Id: I56ccd6753df31f7ddda641640cdb1985b2d9e856
Partial-Bug: #1435306
This commit is contained in:
Pino Toscano 2015-03-23 20:11:11 +01:00
parent 83f74cdc00
commit 55a21cd746
63 changed files with 255 additions and 13 deletions

View File

@ -1,3 +1,7 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
rm /etc/apt/apt.conf.d/01proxy

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
mkdir -p /etc/apt/apt.conf.d/
touch /etc/apt/apt.conf.d/01proxy
echo -e "Acquire::http { Proxy \"$UBUNTU_MIRROR\"; };" > /etc/apt/apt.conf.d/01proxy

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
if [ -z "$UBUNTU_MIRROR" ]; then
echo "You should specify parameter 'UBUNTU_MIRROR'"
exit 2

View File

@ -1,3 +1,7 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
mv /opt/repos/* /etc/yum.repos.d/

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
mkdir -p /opt/repos
mv /etc/yum.repos.d/* /opt/repos/
cat >> /etc/yum.repos.d/centos.repo <<EOF

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
if [ -z "$CENTOS_MIRROR" ]; then
echo "You should specify parameter 'CENTOS_MIRROR'"
exit 2

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages which
if which systemctl; then

View File

@ -1,5 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
distro=$(lsb_release -is)

View File

@ -1,5 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
distro=$(lsb_release -is)

View File

@ -1,3 +1,7 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
mv /opt/repos/* /etc/yum.repos.d/

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
mkdir -p /opt/repos
mv /etc/yum.repos.d/* /opt/repos
cat >> /etc/yum.repos.d/fedora.repo <<EOF

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
if [ -z "$FEDORA_MIRROR" ]; then
echo "You should specify parameter 'FEDORA_MIRROR'"
exit 2

View File

@ -4,6 +4,10 @@
# It does not do a full install of CDH, it installs the miminum needed to
# Spark to run correctly.
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
distro=$(lsb_release -is || :)
if [ "$distro" != "Ubuntu" ]; then
echo "Distro $distro not supported by CDH. Exiting."

View File

@ -3,6 +3,10 @@
# This script contains some fixes needed to have the Cloudera Ubuntu
# packages up and running
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
case "$distro" in
Ubuntu )
# pietro: small hack to fix install problems on ubuntu

View File

@ -1,4 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
if [ -z "$JAVA_DOWNLOAD_URL" ]; then

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
if [ $(lsb_release -is) = 'Ubuntu' ]; then
export DEBIAN_FRONTEND=noninteractive

View File

@ -1,5 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
install-packages wget unzip

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
for i in cloudera-scm-agent \
cloudera-scm-server \

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
distro=$(lsb_release -is)

View File

@ -21,4 +21,9 @@
# This setting is necessary to disable the routing rule that is otherwise injected into the image
# Routing rule prevents cloud-init from contacting meta data service on quantum
# See: https://bugzilla.redhat.com/show_bug.cgi?id=983611
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
echo "NOZEROCONF=yes" >> /etc/sysconfig/network

View File

@ -20,6 +20,9 @@
#
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget
install-packages ntp

View File

@ -24,6 +24,10 @@
# HDP.
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
function install_ganglia {
# Install ganglia
install-packages libganglia ganglia-gmond ganglia-gmond-modules-python ganglia-devel ganglia-gmetad ganglia-web

View File

@ -26,4 +26,8 @@
# in disconnected mode.
#
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
find /etc/yum.repos.d -name "*.repo" -type f | xargs sed "s/enabled=1/enabled=0/" -i

View File

@ -20,6 +20,10 @@
# has completed.
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# ===== CLEANUP MISC =====
rm -rf /var/cache/*

View File

@ -21,6 +21,10 @@
#
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# Turn off gmetad
chkconfig gmetad off

View File

@ -21,5 +21,9 @@
#
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# Turn on ntp service
chkconfig ntpd on

View File

@ -21,6 +21,10 @@
#
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# Turn off ambari-server service for the first boot of this image
chkconfig ambari-server off

View File

@ -25,6 +25,10 @@
# Ambari will configure the environment before the Hadoop
# cluster is started.
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# This is only necessary for an HDP 2.x install
if [[ $DIB_HDP_VERSION == "2.0" ]]; then
chkconfig hadoop-mapreduce-historyserver off

View File

@ -22,6 +22,10 @@
#
##########################################################
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# create a new local yum repository definition that
# includes:
# 1. HDP-Utils

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "START: installing MapR core dependencies"

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "START: installing Scala"

View File

@ -1,5 +1,8 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
install -D -g root -o root -m 0644 $(dirname $0)/versions.py /tmp/versions.py

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "START: installing MapR core repository"

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "START: installing MapR ecosystem repository"

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "START: downloading ExtJS library"

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "/etc/profile.d/java.sh" >> /etc/ssh/sshrc
chmod 775 /etc/profile.d/java.sh

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
DISTRO=$(lsb_release -is || :)

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
DISTRO=$(lsb_release -is || :)

View File

@ -1,6 +1,9 @@
#!/bin/bash
set -eux
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
echo "MapR version ${DIB_MAPR_VERSION}"

View File

@ -7,6 +7,10 @@
# HADOOP-9777 is resolved.
# https://issues.apache.org/jira/browse/HADOOP-9777
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
function download_hadoop_package {
echo "Hadoop version $DIB_HADOOP_VERSION will be injected into image. Starting the download"
install-packages wget

View File

@ -1,4 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
if [ -z "$JAVA_DOWNLOAD_URL" ]; then

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget tar
tmp_dir=/tmp/hive

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
if [ -z "$HIVE_DOWNLOAD_URL" ]; then
version_check=$(echo $HIVE_VERSION | sed -e '/[0-9]\.[0-9][0-9]\.[0-9]/d')
if [ ! -z $version_check ]; then

View File

@ -1,6 +1,9 @@
#!/bin/bash
echo "Begin: installation of Java"
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
distro=$(lsb_release -is || :)

View File

@ -1,7 +1,9 @@
#!/bin/sh
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
set -o xtrace
if [ $(lsb_release -is) = 'Fedora' ]; then
install-packages community-mysql community-mysql-libs community-mysql-server mysql-connector-java

View File

@ -4,6 +4,10 @@
# Service mysqld doesn't start on boot in Fedora and CentOS
# Delete config property 'bind-address' for remote mode (0.0.0.0)
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
if [ $(lsb_release -is) = 'Ubuntu' ]; then
if [ -e "/etc/init/mysql.conf" ]; then
sed -i "s/start on runlevel \[.*\]/start on never runlevel [2345]/g" /etc/init/mysql.conf

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
echo "Oozie setup"
install-packages zip unzip tar wget

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget
ln -s /usr/share/java/mysql-connector-java.jar /opt/oozie/libtools/mysql.jar

View File

@ -1,4 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
if [[ "$DIB_HADOOP_VERSION" < "2.0.0" ]]; then

View File

@ -1,5 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -e
echo "Installing OpenJDK"

View File

@ -1,3 +1,7 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages redhat-lsb

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
if [ -z "$DIB_PASSWORD" ]; then
echo "Error during setup password for root"
exit 1

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
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"
exit 3

View File

@ -2,6 +2,10 @@
# This script installs Spark
# More documentation in the README.md file
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget tar
tmp_dir=/tmp/spark

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
# 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
# and we need to execute this code the first time the VM boots.

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
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"
exit 1

View File

@ -1,5 +1,8 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
echo "Begin: install and configure SSH"
# /etc/ssh/sshd_config is provided by openssh-server

View File

@ -2,6 +2,10 @@
# This script installs storm and its dependencies
# More documentation on the README.md file
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget unzip build-essential uuid-dev git libtool autoconf pkg-config tar
tmp_dir=/tmp

View File

@ -1,4 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
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"
exit 1

View File

@ -1,5 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget
HDFS_LIB_DIR=${DIB_HDFS_LIB_DIR:-"/usr/share/hadoop/lib"}

View File

@ -1,2 +1,7 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages -u

View File

@ -2,6 +2,10 @@
# This scrip installs zookeeper
# More documentation on the README.md file
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
install-packages wget
echo "Downloading Zookeeper"

View File

@ -4,6 +4,10 @@
# Unfortunately the Ubuntu user does not exists when DIB is creating the image
# and we need to execute this code the first time the VM boots.
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
sed -i -e 's,^exit 0$,[ -f /opt/zookeeper/firstboot.sh ] \&\& sh /opt/zookeeper/firstboot.sh; exit 0,' /etc/rc.local
cat >> /opt/zookeeper/firstboot.sh <<EOF