[shellcheck]
bears = ShellCheckBear
-#files = **/*.sh
+files = ./**/*.sh
[python]
bears = PyUnusedCodeBear
echo "Building $IMAGE_NAME from Dockerfile=$DOCKERFILE at $(date) ... "
docker build -t ${IMAGE_NAME} -f ${DOCKERFILE} \
+# noqa ShellCheckBear
--build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy .
if [ $? = 0 ] ; then
PROXIES=""
if [ -n "$http_proxy" ] ; then
+ # noqa ShellCheckBear
PROXIES="--env http_proxy=$http_proxy --env https_proxy=$https_proxy --env no_proxy=$no_proxy"
fi
- echo -e "\nDocker image $IMAGE_NAME built successfully.\n"
+ echo "Docker image $IMAGE_NAME built successfully."
docker images $IMAGE_NAME
- echo -e "\nYou can launch it with the following example command:\n"
- echo -e " docker run -it --rm $PROXIES $IMAGE_NAME bash\n"
+ echo "You can launch it with the following example command:"
+ echo " docker run -it --rm $PROXIES $IMAGE_NAME bash"
else
echo "An error occurred during the build of $IMAGE_NAME"
fi
# COMMAND="$1"
#fi
+# noqa ShellCheckBear
SERVICE_NODE_NAME="service-node"
# check to see that service-node is running first and get its IP from Docker
SERVICE_NODE_IP=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" service-node)
fi
SERV_HOST=$SERVICE_NODE_IP
docker run -dit --name ${NAME} --hostname ${NAME} \
+ # noqa ShellCheckBear
--env http_proxy=$http_proxy --env https_proxy=$https_proxy \
+ # noqa ShellCheckBear
--env no_proxy=$_no_proxy \
--env ODL_NETWORK=$ODL_NETWORK \
--env STACK_PASS=$STACK_PASS \
docker run -d -p 8500:8500 -h $_hostname --name $_container_name \
$_image -server -bootstrap
-export _consul_IP=$( docker inspect -f '{{.NetworkSettings.IPAddress}}' consul)
+_consul_IP=$( docker inspect -f '{{.NetworkSettings.IPAddress}}' consul)
+export _consul_IP
echo "Consul key-value server is now running at $_consul_IP:8500"
docker ps | grep $_container_name
#!/bin/bash
_hostname=consul
_container_name=$_hostname
-_image=progrium/consul
docker stop $_container_name
-Subproject commit e2a26e2629015b356f997b1bf4e4c8d6533ce3e5
+Subproject commit d090f21da61fec48470a32c35036eab78139b101
KARAF_SHELL_PORT=8101
# This could be done with public key crypto, but sshpass is easier
-if ! command -v sshpass &> /dev/null; then
+if ! command -v sshpass >/dev/null 2>&1 /dev/null; then
echo "Installing sshpass. It's used connecting non-interactively"
if ! sudo yum install -y sshpass; then
echo "Couldn't find sshpass pkg, trying to install EPEL"
# distribution to deploy on the nodes, or will download it, and it will
# trigger vagrant or docker to build the cluster.
+# noqa ShellCheckBear
SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT="$( cd "$SCRIPTS" && cd .. && pwd)"
-function setup_env {
- source $SCRIPTS/config.properties
+setup_env() {
+ . $SCRIPTS/config.properties
export NUM_OF_NODES=$NUM_OF_NODES
echo "Cluster will be deployed using $ODL_VERSION."
echo "The cluster will have $NUM_OF_NODES nodes."
}
-function dowload_odl {
+dowload_odl() {
if [ ! -d "$ROOT/opendaylight" ]; then
echo "Download OpenDaylight distribution"
mkdir opendaylight
fi
}
-function setup_odl {
+setup_odl() {
env_banner
cd $ROOT/opendaylight
# the custom_shard_config.txt located under /bin
}
-function spwan_vms {
+spwan_vms() {
env_banner
cd $ROOT
vagrant destroy -f
vagrant up
}
-function spwan_containers {
+spwan_containers() {
env_banner
# create docker network specific to ODL cluster
- if [ `docker network ls | grep -w odl-cluster-network | wc -l | xargs echo ` == 0 ]; then
+ if [ "`docker network ls | grep -w odl-cluster-network | wc -l | xargs echo `" = 0 ]; then
echo "Docker network for OpenDaylight don't exist - creating ..."
docker network create -o com.docker.network.bridge.enable_icc=true -o com.docker.network.bridge.enable_ip_masquerade=true --subnet 192.168.50.0/24 --gateway 192.168.50.1 odl-cluster-network
fi
# create all the containers
MAX=$NUM_OF_NODES
+ # noqa ShellCheckBear
for ((i=1; i<=MAX; i++))
do
export NODE_NUMBER=$i
done
}
-function prerequisites {
+prerequisites() {
cat <<EOF
################################################
## Setup environment ##
setup_odl
}
-function env_banner {
+env_banner() {
cat <<EOF
################################################
## Spawn cluster nodes ##
EOF
}
-function end_banner {
+end_banner() {
cat <<EOF
################################################
## Your environment is setup ##
usage
fi
-if [ $p == "docker" ]; then
+if [ $p = "docker" ]; then
prerequisites
spwan_containers
-elif [ $p == "vagrant" ]; then
+elif [ $p = "vagrant" ]; then
prerequisites
spwan_vms
else
# Shard configuration:
# see (configure-cluster-ipdetect.sh)[https://github.com/opendaylight/integration-distribution/blob/release/boron-sr2/distribution-karaf/src/main/assembly/bin/configure-cluster-ipdetect.sh]
+# noqa ShellCheckBear
SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-source $SCRIPTS/config.properties
+. $SCRIPTS/config.properties
-function install_packages {
+install_packages() {
# required if using Docker, else could be commented-out
sudo apt-get update -y
sudo apt-get -y install software-properties-common
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
}
-function start_odl {
+start_odl() {
cd $HOME/opendaylight
seed_nodes=""
# For the docker container, we have to let the container
# live else it will stop once the setup is ready
+# noqa ShellCheckBear
while [ 1 ];
do
sleep 10