Skip to content

Commit

Permalink
Merge pull request #149 from basho/jem-source-default-scripts
Browse files Browse the repository at this point in the history
Source default config files in env.sh
  • Loading branch information
jaredmorrow committed Jul 11, 2014
2 parents e60d55b + 0e23e27 commit 0077482
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions priv/base/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,14 @@ check_user_internal() {

# Function to su into correct user that is poorly named for historical
# reasons (excuses)
# This also serves as an entry point to most functions
check_user() {
check_user_internal

# This call must be before the su call, when the user is dropped
# optional config will be brought in if available
load_default_os_config

# do not su again if we are already the runner user
if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
# Escape any double quotes that might be in the command line
Expand All @@ -235,6 +240,18 @@ check_user() {
fi
}

# Function to load default config files based on OS
load_default_os_config() {
# Only run this if we already dropped to the runner user
if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" = "x$RUNNER_USER" ]); then
# Common config file on Debian-like systems
[ -r /etc/default/$RUNNER_SCRIPT ] && . /etc/default/$RUNNER_SCRIPT

# Common config file on RPM-like systems
[ -r /etc/sysconfig/$RUNNER_SCRIPT ] && . /etc/sysconfig/$RUNNER_SCRIPT
fi
}

# Function to validate the node is down
node_down_check() {
MUTE=`ping_node 2> /dev/null`
Expand Down

0 comments on commit 0077482

Please sign in to comment.