@@ -140,7 +140,8 @@ function isset {
140140# backtrace level
141141function backtrace {
142142 local level=$1
143- local deep=$(( ${# BASH_SOURCE[@]} - 1 ))
143+ local deep
144+ deep=$(( ${# BASH_SOURCE[@]} - 1 ))
144145 echo " [Call Trace]"
145146 while [ $level -le $deep ]; do
146147 echo " ${BASH_SOURCE[$deep]} :${BASH_LINENO[$deep-1]} :${FUNCNAME[$deep-1]} "
@@ -477,7 +478,8 @@ function git_clone {
477478 local git_remote=$1
478479 local git_dest=$2
479480 local git_ref=$3
480- local orig_dir=$( pwd)
481+ local orig_dir
482+ orig_dir=$( pwd)
481483 local git_clone_flags=" "
482484
483485 RECLONE=$( trueorfalse False RECLONE)
@@ -641,7 +643,8 @@ function get_default_host_ip {
641643 host_ip=" "
642644 # Find the interface used for the default route
643645 host_ip_iface=${host_ip_iface:- $(ip -f $af route | awk ' /default/ {print $5}' | head -1)}
644- local host_ips=$( LC_ALL=C ip -f $af addr show ${host_ip_iface} | sed /temporary/d | awk /$af ' / {split($2,parts,"/"); print parts[1]}' )
646+ local host_ips
647+ host_ips=$( LC_ALL=C ip -f $af addr show ${host_ip_iface} | sed /temporary/d | awk /$af ' / {split($2,parts,"/"); print parts[1]}' )
645648 local ip
646649 for ip in $host_ips ; do
647650 # Attempt to filter out IP addresses that are part of the fixed and
@@ -690,7 +693,8 @@ function get_field {
690693# copy over a default policy.json and policy.d for projects
691694function install_default_policy {
692695 local project=$1
693- local project_uc=$( echo $1 | tr a-z A-Z)
696+ local project_uc
697+ project_uc=$( echo $1 | tr a-z A-Z)
694698 local conf_dir=" ${project_uc} _CONF_DIR"
695699 # eval conf dir to get the variable
696700 conf_dir=" ${! conf_dir} "
@@ -723,7 +727,8 @@ function policy_add {
723727
724728 # Add a terminating comma to policy lines without one
725729 # Remove the closing '}' and all lines following to the end-of-file
726- local tmpfile=$( mktemp)
730+ local tmpfile
731+ tmpfile=$( mktemp)
727732 uniq ${policy_file} | sed -e '
728733 s/]$/],/
729734 /^[}]/,$d
@@ -945,7 +950,8 @@ function get_or_create_endpoint {
945950 # scenarios currently that use the returned id. Ideally this behaviour
946951 # should be pushed out to the service setups and let them create the
947952 # endpoints they need.
948- local public_id=$( _get_or_create_endpoint_with_interface $1 public $3 $2 )
953+ local public_id
954+ public_id=$( _get_or_create_endpoint_with_interface $1 public $3 $2 )
949955 _get_or_create_endpoint_with_interface $1 admin $4 $2
950956 _get_or_create_endpoint_with_interface $1 internal $5 $2
951957
@@ -1065,7 +1071,8 @@ function get_packages {
10651071 xtrace=$( set +o | grep xtrace)
10661072 set +o xtrace
10671073 local services=$@
1068- local package_dir=$( _get_package_dir)
1074+ local package_dir
1075+ package_dir=$( _get_package_dir)
10691076 local file_to_parse=" "
10701077 local service=" "
10711078
@@ -1980,8 +1987,10 @@ function address_in_net {
19801987 local ip=$1
19811988 local range=$2
19821989 local masklen=${range#*/ }
1983- local network=$( maskip ${range%/* } $( cidr2netmask $masklen ) )
1984- local subnet=$( maskip $ip $( cidr2netmask $masklen ) )
1990+ local network
1991+ network=$( maskip ${range%/* } $( cidr2netmask $masklen ) )
1992+ local subnet
1993+ subnet=$( maskip $ip $( cidr2netmask $masklen ) )
19851994 [[ $network == $subnet ]]
19861995}
19871996
@@ -2033,7 +2042,8 @@ function export_proxy_variables {
20332042
20342043# Returns true if the directory is on a filesystem mounted via NFS.
20352044function is_nfs_directory {
2036- local mount_type=` stat -f -L -c %T $1 `
2045+ local mount_type
2046+ mount_type=` stat -f -L -c %T $1 `
20372047 test " $mount_type " == " nfs"
20382048}
20392049
@@ -2044,13 +2054,15 @@ function maskip {
20442054 local ip=$1
20452055 local mask=$2
20462056 local l=" ${ip% .* } " ; local r=" ${ip#* .} " ; local n=" ${mask% .* } " ; local m=" ${mask#* .} "
2047- local subnet=$(( ${ip%% .* } & ${mask%% .* } )) .$(( ${r%% .* } & ${m%% .* } )) .$(( ${l##* .} & ${n##* .} )) .$(( ${ip##* .} & ${mask##* .} ))
2057+ local subnet
2058+ subnet=$(( ${ip%% .* } & ${mask%% .* } )) .$(( ${r%% .* } & ${m%% .* } )) .$(( ${l##* .} & ${n##* .} )) .$(( ${ip##* .} & ${mask##* .} ))
20482059 echo $subnet
20492060}
20502061
20512062# Return the current python as "python<major>.<minor>"
20522063function python_version {
2053- local python_version=$( python -c ' import sys; print("%s.%s" % sys.version_info[0:2])' )
2064+ local python_version
2065+ python_version=$( python -c ' import sys; print("%s.%s" % sys.version_info[0:2])' )
20542066 echo " python${python_version} "
20552067}
20562068
0 commit comments