Ensure node-specific configuration is always used

Some settings where by-passed when using the keyword all.

There is still one setting which might be ignored when using the all
keyword:

   EXAREME_ROLE

   It is assumed the Swarm function is the same at the federation level,
   and this is used to compute the number of worker nodes, thus it is
   required to keep this information in synchronised.
This commit is contained in:
2018-01-19 09:43:12 +00:00
committed by ubuntu
parent 768f16b109
commit 1cc16b35d1
2 changed files with 28 additions and 9 deletions

View File

@@ -17,8 +17,6 @@
# DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
# USE OF THIS SOFTWARE.
. ./settings.sh
federation_nodes=""
federation_hosts=""
for h in $(docker node ls --format '{{ .Hostname }}')
@@ -28,6 +26,10 @@ do
done
usage() {
( # This is just in case the user wants to check the settings
. ./settings.sh
)
cat <<EOT
usage: $0 [-h|--help] (all|nodename [nodename ...])
-h, --help: show this message and exit
@@ -54,6 +56,8 @@ start_node() {
LDSM_HOST=$2
EXAREME_ROLE=$3
. ./settings.sh ${FEDERATION_NODE}
# Export the settings to the docker-compose files
export FEDERATION_NODE
@@ -104,17 +108,28 @@ start_nodes() {
for h in ${managers}
do
label=$(docker node inspect --format '{{ .Spec.Labels.name }}' ${h})
dbhost=$(docker node inspect --format '{{ .Status.Addr }}' ${h})
EXAREME_WORKERS_WAIT=$(echo "$workers" | wc -w)
start_node ${label} ${dbhost} manager
(
# Retrieve LDSM_HOST if it has been set manually.
SHOW_SETTINGS=false . ./settings.sh ${label}
test -z "${LDSM_HOST}" && \
LDSM_HOST=$(docker node inspect --format '{{ .Status.Addr }}' ${h})
EXAREME_WORKERS_WAIT=$(echo "$workers" | wc -w)
start_node ${label} ${LDSM_HOST} manager
)
done
# Then start all the worker nodes
for h in ${workers}
do
label=$(docker node inspect --format '{{ .Spec.Labels.name }}' ${h})
dbhost=$(docker node inspect --format '{{ .Status.Addr }}' ${h})
start_node ${label} ${dbhost} worker
(
# Retrieve LDSM_HOST if it has been set manually.
SHOW_SETTINGS=false . ./settings.sh ${label}
test -z "${LDSM_HOST}" && \
LDSM_HOST=$(docker node inspect --format '{{ .Status.Addr }}' ${h})
start_node ${label} ${LDSM_HOST} worker
)
done
}
@@ -128,6 +143,8 @@ start_one_node() {
label=$(docker node inspect --format '{{ .Spec.Labels.name }}' ${h})
if [ "x${label}" == "x${FEDERATION_NODE}" ];
then
# Retrieve LDSM_HOST, EXAREME_ROLE if they have been set manually.
SHOW_SETTINGS=false . ./settings.sh ${label}
test -z "${LDSM_HOST}" && \
LDSM_HOST=$(docker node inspect --format '{{ .Status.Addr }}' ${h})

View File

@@ -17,8 +17,6 @@
# DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
# USE OF THIS SOFTWARE.
. ./settings.sh
federation_nodes=""
federation_hosts=""
for h in $(docker node ls --format '{{ .Hostname }}')
@@ -28,6 +26,10 @@ do
done
usage() {
( # This is just in case the user wants to check the settings
. ./settings.sh
)
cat <<EOT
usage: $0 [-h|--help] (all|nodename [nodename ...])
-h, --help: show this message and exit