Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit dce7c14

Browse files
author
OpenShift Bot
committed
Merge pull request #6269 from dobbymoodge/rhcsh_cart-hook_cleanup
Merged by openshift-bot
2 parents 4f35b71 + bb92573 commit dce7c14

File tree

4 files changed

+40
-30
lines changed

4 files changed

+40
-30
lines changed
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
#!/bin/bash -e
22
# Update the list of non-local haproxy status URLs meant to be used by the
33
# auto scaler.
4-
source $OPENSHIFT_CARTRIDGE_SDK_BASH
54

65
# Parse the arguments to populate the status URLs list.
76
list=
8-
kvargs=$(echo "${@:4}" | tr -d "\n" )
9-
for arg in $kvargs; do
10-
surl=$(echo "$arg" | cut -f 2 -d '=' | tr -d "'")
7+
args=($(printf "%s\n" "${@:4}"))
8+
for arg in "${args[@]}" ; do
9+
# skip if it's not a k/v arg
10+
[[ "${arg}" =~ '=' ]] || continue
11+
# drop single-quotes
12+
arg="${arg//\'/}"
13+
# grab the 'value' bit
14+
arg="${arg#*=}"
1115
# Do not add an entry for the local gear.
12-
if [[ ! $surl =~ $OPENSHIFT_GEAR_DNS ]]; then
13-
if [ -z "$list" ]; then
14-
list="$surl"
16+
if [[ ! $arg =~ $OPENSHIFT_GEAR_DNS ]] ; then
17+
if [[ -z "$list" ]] ; then
18+
list="$arg"
1519
else
16-
list="$list\n$surl"
20+
list="$list\n$arg"
1721
fi
1822
fi
1923
done
@@ -27,4 +31,4 @@ if [[ -z $list ]]; then
2731
else
2832
# Update the file with the list of all non-local haproxy status URLs.
2933
echo -e $list > $HAPROXY_STATUS_URLS_CONF
30-
fi
34+
fi

cartridges/openshift-origin-cartridge-jbosseap/hooks/set-jboss-cluster

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
#!/bin/bash
2-
1+
#!/bin/bash -e
32
# Exit on any errors
4-
set -e
5-
6-
source $OPENSHIFT_CARTRIDGE_SDK_BASH
73

84
list=
9-
kvargs=$(echo "${@:4}" | tr -d "\n" )
10-
for arg in $kvargs; do
11-
ip=$(echo "$arg" | cut -f 2 -d '=' | tr -d "'")
12-
ip=$(echo "$ip" | sed "s/:/[/g")
5+
args=($(printf "%s\n" "${@:4}"))
6+
for arg in "${args[@]}" ; do
7+
# skip if it's not a k/v arg
8+
[[ "${arg}" =~ '=' ]] || continue
9+
# drop single-quotes
10+
arg="${arg//\'/}"
11+
# grab the 'value' bit
12+
arg="${arg#*=}"
13+
# trim whitespace
14+
ip="${arg/:/[}"
1315
if [ -z "$list" ]; then
1416
list="$ip]"
1517
else

cartridges/openshift-origin-cartridge-jbosseap/hooks/set-jboss-remoting

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
#!/bin/bash
1+
#!/bin/bash -e
2+
# Exit on any errors
23

34
# Adds a gear to the haproxy configuration.
45

5-
# Exit on any errors
6-
set -e
7-
86
list=
9-
kvargs=$(echo "${@:4}" | tr -d "\n" )
10-
for arg in $kvargs; do
11-
ip=$(echo "$arg" | cut -f 2 -d '=' | tr -d "'")
12-
ip=$(echo "$ip" | sed "s/:/[/g")
7+
args=($(printf "%s\n" "${@:4}"))
8+
for arg in "${args[@]}" ; do
9+
# skip if it's not a k/v arg
10+
[[ "${arg}" =~ '=' ]] || continue
11+
# drop single-quotes
12+
arg="${arg//\'/}"
13+
# grab the 'value' bit
14+
arg="${arg#*=}"
15+
# trim whitespace
16+
ip="${arg/:/[}"
1317
if [ -z "$list" ]; then
1418
list="$ip]"
1519
else

node/misc/bin/rhcsh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,19 @@ function welcome {
8888
local usage=$(quota -w 2>/dev/null| grep '^.*/dev/' | awk '{printf "%3.1f", ($2 / $4 * 100)}')
8989
if float_test "${usage:-0} > 90.0"
9090
then
91-
echo "Warning: Gear ${OPENSHIFT_GEAR_UUID} is using ${usage}% of disk quota"
91+
echo 1>&2 "Warning: Gear ${OPENSHIFT_GEAR_UUID} is using ${usage}% of disk quota"
9292
fi
9393

9494
local usage=$(quota -w 2>/dev/null| grep '^.*/dev/' | awk '{printf "%3.1f", ($5 / $7 * 100)}')
9595
if float_test "${usage:-0} > 90.0"
9696
then
97-
echo "Warning: Gear ${OPENSHIFT_GEAR_UUID} is using ${usage}% of inodes allowed"
97+
echo 1>&2 "Warning: Gear ${OPENSHIFT_GEAR_UUID} is using ${usage}% of inodes allowed"
9898
fi
9999
else
100-
echo "Your application is out of disk space; please run \"rhc app-tidy $OPENSHIFT_APP_NAME\"" 1>&2
100+
echo 1>&2 "Your application is out of disk space; please run \"rhc app-tidy $OPENSHIFT_APP_NAME\""
101101
fi
102102
else
103-
echo "Command \"quota\" not found for app $OPENSHIFT_APP_NAME, please check the node hosting this app"
103+
echo 1>&2 "Command \"quota\" not found for app $OPENSHIFT_APP_NAME, please check the node hosting this app"
104104
fi
105105
}
106106

0 commit comments

Comments
 (0)