From 1e560b182f3d6380d6c2a10d01361f00b5f2b73f Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Tue, 7 Mar 2017 14:39:49 -0800 Subject: [PATCH] devstack: Make sentry _IRONIC_DEVSTACK_LIB a global variable Make the sentry variable _IRONIC_DEVSTACK_LIB a global variable so that it will work as expected. When variables use the 'declare' directive, it is by default a local variable. While other variables have global scope. For example: declare -A AN_ARRAY # local in scope foo=1 # global in scope declare -A -g SPAM # global in scope because of -g This causes errors to occur as some of the variables will be local only and others will be global. The issue that can occur is that when sourcing devstack/lib/ironic a second time the sentry _IRONIC_DEVSTACK_LIB will not be set but all the other variables from devstack/lib/ironic will already have been set as they are by default global variables. And the purpose of _IRONIC_DEVSTACK_LIB is to prevent the file from being sourced twice. Change-Id: I24b6ebb89f3d950d39b0665346b4c17bf05d0a0b --- devstack/lib/ironic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index eb2dff5626..c45b3876cc 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -22,7 +22,7 @@ # ensure we don't re-source this in the same environment [[ -z "$_IRONIC_DEVSTACK_LIB" ]] || return 0 -declare -r _IRONIC_DEVSTACK_LIB=1 +declare -r -g _IRONIC_DEVSTACK_LIB=1 # Save xtrace and pipefail settings _XTRACE_IRONIC=$(set +o | grep xtrace)