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

Commit

Permalink
Merge pull request #6269 from dobbymoodge/rhcsh_cart-hook_cleanup
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Oct 14, 2015
2 parents 4f35b71 + bb92573 commit dce7c14
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
#!/bin/bash -e
# Update the list of non-local haproxy status URLs meant to be used by the
# auto scaler.
source $OPENSHIFT_CARTRIDGE_SDK_BASH

# Parse the arguments to populate the status URLs list.
list=
kvargs=$(echo "${@:4}" | tr -d "\n" )
for arg in $kvargs; do
surl=$(echo "$arg" | cut -f 2 -d '=' | tr -d "'")
args=($(printf "%s\n" "${@:4}"))
for arg in "${args[@]}" ; do
# skip if it's not a k/v arg
[[ "${arg}" =~ '=' ]] || continue
# drop single-quotes
arg="${arg//\'/}"
# grab the 'value' bit
arg="${arg#*=}"
# Do not add an entry for the local gear.
if [[ ! $surl =~ $OPENSHIFT_GEAR_DNS ]]; then
if [ -z "$list" ]; then
list="$surl"
if [[ ! $arg =~ $OPENSHIFT_GEAR_DNS ]] ; then
if [[ -z "$list" ]] ; then
list="$arg"
else
list="$list\n$surl"
list="$list\n$arg"
fi
fi
done
Expand All @@ -27,4 +31,4 @@ if [[ -z $list ]]; then
else
# Update the file with the list of all non-local haproxy status URLs.
echo -e $list > $HAPROXY_STATUS_URLS_CONF
fi
fi
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/bin/bash

#!/bin/bash -e
# Exit on any errors
set -e

source $OPENSHIFT_CARTRIDGE_SDK_BASH

list=
kvargs=$(echo "${@:4}" | tr -d "\n" )
for arg in $kvargs; do
ip=$(echo "$arg" | cut -f 2 -d '=' | tr -d "'")
ip=$(echo "$ip" | sed "s/:/[/g")
args=($(printf "%s\n" "${@:4}"))
for arg in "${args[@]}" ; do
# skip if it's not a k/v arg
[[ "${arg}" =~ '=' ]] || continue
# drop single-quotes
arg="${arg//\'/}"
# grab the 'value' bit
arg="${arg#*=}"
# trim whitespace
ip="${arg/:/[}"
if [ -z "$list" ]; then
list="$ip]"
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/bin/bash
#!/bin/bash -e
# Exit on any errors

# Adds a gear to the haproxy configuration.

# Exit on any errors
set -e

list=
kvargs=$(echo "${@:4}" | tr -d "\n" )
for arg in $kvargs; do
ip=$(echo "$arg" | cut -f 2 -d '=' | tr -d "'")
ip=$(echo "$ip" | sed "s/:/[/g")
args=($(printf "%s\n" "${@:4}"))
for arg in "${args[@]}" ; do
# skip if it's not a k/v arg
[[ "${arg}" =~ '=' ]] || continue
# drop single-quotes
arg="${arg//\'/}"
# grab the 'value' bit
arg="${arg#*=}"
# trim whitespace
ip="${arg/:/[}"
if [ -z "$list" ]; then
list="$ip]"
else
Expand Down
8 changes: 4 additions & 4 deletions node/misc/bin/rhcsh
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ function welcome {
local usage=$(quota -w 2>/dev/null| grep '^.*/dev/' | awk '{printf "%3.1f", ($2 / $4 * 100)}')
if float_test "${usage:-0} > 90.0"
then
echo "Warning: Gear ${OPENSHIFT_GEAR_UUID} is using ${usage}% of disk quota"
echo 1>&2 "Warning: Gear ${OPENSHIFT_GEAR_UUID} is using ${usage}% of disk quota"
fi

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

Expand Down

0 comments on commit dce7c14

Please sign in to comment.