TT#37257 Fix unnecessary subshell call and remove 'shellcheck disable'

It was initially introduced in the commit:

> commit 7d422b7878
> Author: Victor Seva <vseva@sipwise.com>
> Date:   Fri Aug 22 17:03:39 2014 +0200
>
> MT#8763 check for .git before running the services
>
> On a multi directory config, the services depends on git. Check
> first if the git repository exists and warn about it

The subshell here was necessary to isolate 'cd $dir' call.
In the same time the "proper" bash way is to use pushd/popd.

For the history, 'shellcheck disable' was muting the warning:
> This only exits the subshell caused by the (..) group. [SC2106]

Change-Id: I3546fa9615858dbbc4c0f91d74de003e22837d55
changes/91/23491/3
Alexander Lutay 8 years ago
parent 4b71ba3ec6
commit 7fa3b63fcd

@ -132,13 +132,11 @@ TMPFILE="$(mktemp)"
log_debug "TMPFILE = $TMPFILE"
for dir in ${CONFIG_POOL} ; do
#shellcheck disable=SC2106
(
if ! [[ "${dir}" =~ ^/ ]] ; then
log_error "${dir} is not an absolute path"
continue
fi
cd "${dir}"
pushd "${dir}" >/dev/null
if [ ! -d .git ] ; then
log_info "$dir has no support of .services"
continue
@ -152,7 +150,7 @@ for dir in ${CONFIG_POOL} ; do
unifyer "${SERVICES_POOL_BASE}/${dir}/$(dirname "$file")/ngcpcfg.services"
fi
done
)
popd >/dev/null
done
if ! [ -s "$TMPFILE" ] ; then

Loading…
Cancel
Save