Add header guard to functions/functions-common

To avoid sourcing this twice and getting globals mixed up,
particularly when using multiple plugins, add a "header guard" that
ensures we only source it once.

In general I don't think functions/functions-common have been written
or considered to be idempotent.  I don't think going down that path is
going to be a long-term solution as it's easy to break.

Change-Id: Idca49eb996d2b7ff3779ec27ed672a2da7852590
Closes-Bug: #1469178
This commit is contained in:
Ian Wienand 2015-06-30 11:00:32 +10:00
parent 04c0f0be26
commit 4ffb454145
2 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,10 @@
# - ``GLANCE_HOSTPORT``
#
# ensure we don't re-source this in the same environment
[[ -z "$_DEVSTACK_FUNCTIONS" ]] || return 0
declare -r _DEVSTACK_FUNCTIONS=1
# Include the common functions
FUNC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
source ${FUNC_DIR}/functions-common

View File

@ -36,6 +36,10 @@
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# ensure we don't re-source this in the same environment
[[ -z "$_DEVSTACK_FUNCTIONS_COMMON" ]] || return 0
declare -r _DEVSTACK_FUNCTIONS_COMMON=1
# Global Config Variables
declare -A GITREPO
declare -A GITBRANCH