-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle colon-delimited environmentpath in config_version.sh
- Loading branch information
Showing
1 changed file
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
#!/bin/bash | ||
if [ -e $1/$2/.r10k-deploy.json ] | ||
ENVIRONMENTPATH=$1 | ||
# $ENVIRONMENTPATH may contain multiple colon-delimited locations. | ||
# We need to pick the first one that contains $ENVIRONMENT. | ||
IFS=":" | ||
for CANDIDATEPATH in ${ENVIRONMENTPATH}; do | ||
if [ -d "${CANDIDATEPATH}/${2}" ]; then | ||
ENVIRONMENTPATH=$CANDIDATEPATH | ||
break | ||
fi | ||
done | ||
|
||
if [ -e "${ENVIRONMENTPATH}/$2/.r10k-deploy.json" ] | ||
then | ||
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/code_manager_config_version.rb $1 $2 | ||
/opt/puppetlabs/puppet/bin/ruby "${ENVIRONMENTPATH}/$2/scripts/code_manager_config_version.rb" ${ENVIRONMENTPATH} $2 | ||
elif [ -e /opt/puppetlabs/server/pe_version ] | ||
then | ||
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2 | ||
/opt/puppetlabs/puppet/bin/ruby "${ENVIRONMENTPATH}/$2/scripts/config_version.rb" ${ENVIRONMENTPATH} $2 | ||
else | ||
/usr/bin/git --version > /dev/null 2>&1 && | ||
/usr/bin/git --git-dir $1/$2/.git rev-parse HEAD || | ||
/usr/bin/git --git-dir "${ENVIRONMENTPATH}/$2/.git" rev-parse HEAD || | ||
date +%s | ||
fi |