Skip to content

Commit a973348

Browse files
committed
adding quotes for directories with spaces
Signed-off-by: Chris Plock <[email protected]> fixing docker run
1 parent 2eb4504 commit a973348

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

install/ansible/install_swarm.sh

+9-6
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,12 @@ fi
162162

163163
echo "Starting the installer container"
164164
image_name="contiv/install:__CONTIV_INSTALL_VERSION__"
165-
install_mount="-v $(pwd)/install:/install:Z"
166-
ansible_mount="-v $(pwd)/ansible:/ansible:Z"
167-
config_mount="-v $src_conf_path:$container_conf_path:Z"
168-
cache_mount="-v $(pwd)/contiv_cache:/var/contiv_cache:Z"
169-
mounts="$install_mount $ansible_mount $cache_mount $config_mount"
170-
docker run --rm --net=host $mounts $image_name sh -c "./install/ansible/install.sh $netmaster_param -a \"$ans_opts\" $install_scheduler -m $contiv_network_mode -d $fwd_mode $aci_param $cluster_param $v2plugin_param"
165+
mounts[0]="-v"
166+
mounts[1]="$(pwd)/install:/install:Z"
167+
mounts[2]="-v"
168+
mounts[3]="$(pwd)/ansible:/ansible:Z"
169+
mounts[4]="-v"
170+
mounts[5]="$src_conf_path:$container_conf_path:Z"
171+
mounts[6]="-v"
172+
mounts[7]="$(pwd)/contiv_cache:/var/contiv_cache:Z"
173+
docker run --rm --net=host "${mounts[@]}" $image_name sh -c "./install/ansible/install.sh $netmaster_param -a \"$ans_opts\" $install_scheduler -m $contiv_network_mode -d $fwd_mode $aci_param $cluster_param $v2plugin_param"

scripts/build.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ v2plugin_version=${CONTIV_V2PLUGIN_VERSION}
2626
# where everything is assembled, always start with a clean dir and clean it up
2727
output_tmp_dir="$(mktemp -d)"
2828
output_dir="${output_tmp_dir}/contiv-${CONTIV_INSTALLER_VERSION}"
29-
mkdir -p ${output_dir}
30-
trap 'rm -rf ${output_tmp_dir}' EXIT
29+
mkdir -p "${output_dir}"
30+
trap 'rm -rf "${output_tmp_dir}"' EXIT
3131

3232
release_dir=release
3333
mkdir -p $release_dir
@@ -45,7 +45,7 @@ cp -rf scripts/generate-certificate.sh $output_dir/install
4545
chmod +x $output_dir/install/genInventoryFile.py
4646
chmod +x $output_dir/install/generate-certificate.sh
4747

48-
cp -a ${CONTIV_ARTIFACT_STAGING}/ansible ${output_dir}/
48+
cp -a "${CONTIV_ARTIFACT_STAGING}/ansible" ${output_dir}/
4949

5050
# Replace versions
5151
files=$(find $output_dir -type f -name "*.yaml" -or -name "*.sh" -or -name "*.json")
@@ -96,14 +96,14 @@ curl --fail -sL -o $binary_cache/ovs-switch.deb http://mirrors.kernel.org/ubuntu
9696
# Copy the netplugin release into the binary cache for "full" installer
9797
# Netplugin releases built locally based on a branch are named by their SHA,
9898
# but there is a symlink to point to the SHA named tarball by it's branch name
99-
plugin_tball=${CONTIV_ARTIFACT_STAGING}/$CONTIV_NETPLUGIN_TARBALL_NAME
99+
plugin_tball="${CONTIV_ARTIFACT_STAGING}/$CONTIV_NETPLUGIN_TARBALL_NAME"
100100
if [[ -L "${plugin_tball}" ]]; then
101101
# copy the link (so other processes can find the tarball) and the tarball
102-
target_plugin_tball=$(readlink ${plugin_tball})
103-
cp -a ${plugin_tball} ${binary_cache}/
104-
plugin_tball=${CONTIV_ARTIFACT_STAGING}/${target_plugin_tball}
102+
target_plugin_tball="$(readlink "${plugin_tball}")"
103+
cp -a "${plugin_tball}" "${binary_cache}/"
104+
plugin_tball="${CONTIV_ARTIFACT_STAGING}/${target_plugin_tball}"
105105
fi
106-
cp ${plugin_tball} ${binary_cache}/
106+
cp "${plugin_tball}" "${binary_cache}/"
107107

108108
env_file=$output_dir/install/ansible/env.json
109109
sed -i.bak 's#__AUTH_PROXY_LOCAL_INSTALL__#true#g' "$env_file"

scripts/download_ansible_repo.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
set -euo pipefail
44

5-
ANSIBLE_REPO_DIR=${CONTIV_ARTIFACT_STAGING}/ansible
5+
ANSIBLE_REPO_DIR="${CONTIV_ARTIFACT_STAGING}/ansible"
66

7-
rm -rf $ANSIBLE_REPO_DIR
7+
rm -rf "$ANSIBLE_REPO_DIR"
88

9-
mkdir -p $ANSIBLE_REPO_DIR $CONTIV_ARTIFACT_STAGING
9+
mkdir -p "$ANSIBLE_REPO_DIR" "$CONTIV_ARTIFACT_STAGING"
1010

1111
echo downloading ${CONTIV_ANSIBLE_OWNER}/ansible commit: $CONTIV_ANSIBLE_COMMIT
1212
curl --fail -sL https://api.github.com/repos/${CONTIV_ANSIBLE_OWNER}/ansible/tarball/$CONTIV_ANSIBLE_COMMIT \
13-
| tar --strip-components 1 -C $ANSIBLE_REPO_DIR -z -x
13+
| tar --strip-components 1 -C "$ANSIBLE_REPO_DIR" -z -x

scripts/prepare_netplugin_tarball.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set -euxo pipefail
1212

1313
: ${CONTIV_NETPLUGIN_TARBALL_NAME} # check if defined
1414

15-
mkdir -p $CONTIV_ARTIFACT_STAGING
15+
mkdir -p "$CONTIV_ARTIFACT_STAGING"
1616

1717
# check if installer is for a release version of netplugin
1818
if [ -z "${NETPLUGIN_BRANCH:-}" ]; then
@@ -21,7 +21,7 @@ if [ -z "${NETPLUGIN_BRANCH:-}" ]; then
2121
base_url=https://github.com/contiv/netplugin/releases/download
2222
netplugin_bundle_name=netplugin-$CONTIV_NETPLUGIN_VERSION.tar.bz2
2323
curl -sL ${base_url}/$CONTIV_NETPLUGIN_VERSION/$netplugin_bundle_name \
24-
-o ${CONTIV_ARTIFACT_STAGING}/$netplugin_bundle_name
24+
-o "${CONTIV_ARTIFACT_STAGING}/$netplugin_bundle_name"
2525
exit
2626
fi
2727

@@ -47,7 +47,7 @@ BUILD_VERSION=${NETPLUGIN_VERSION} make tar
4747

4848
# move the netplugin tarball to the staging directory for the installer
4949
mv netplugin-${NETPLUGIN_VERSION}.tar.bz2 \
50-
${CONTIV_ARTIFACT_STAGING}/
50+
"${CONTIV_ARTIFACT_STAGING}/"
5151
# create a link so other scripts can find the file without knowing the SHA
52-
cd ${CONTIV_ARTIFACT_STAGING}
52+
cd "${CONTIV_ARTIFACT_STAGING}"
5353
ln -sf netplugin-${NETPLUGIN_VERSION}.tar.bz2 $CONTIV_NETPLUGIN_TARBALL_NAME

0 commit comments

Comments
 (0)