Skip to content

Commit

Permalink
adding quotes for directories with spaces
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Plock <chrisplo@cisco.com>

fixing docker run
  • Loading branch information
chrisplo committed Nov 7, 2017
1 parent 2eb4504 commit a973348
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
15 changes: 9 additions & 6 deletions install/ansible/install_swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ fi

echo "Starting the installer container"
image_name="contiv/install:__CONTIV_INSTALL_VERSION__"
install_mount="-v $(pwd)/install:/install:Z"
ansible_mount="-v $(pwd)/ansible:/ansible:Z"
config_mount="-v $src_conf_path:$container_conf_path:Z"
cache_mount="-v $(pwd)/contiv_cache:/var/contiv_cache:Z"
mounts="$install_mount $ansible_mount $cache_mount $config_mount"
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"
mounts[0]="-v"
mounts[1]="$(pwd)/install:/install:Z"
mounts[2]="-v"
mounts[3]="$(pwd)/ansible:/ansible:Z"
mounts[4]="-v"
mounts[5]="$src_conf_path:$container_conf_path:Z"
mounts[6]="-v"
mounts[7]="$(pwd)/contiv_cache:/var/contiv_cache:Z"
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"
16 changes: 8 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ v2plugin_version=${CONTIV_V2PLUGIN_VERSION}
# where everything is assembled, always start with a clean dir and clean it up
output_tmp_dir="$(mktemp -d)"
output_dir="${output_tmp_dir}/contiv-${CONTIV_INSTALLER_VERSION}"
mkdir -p ${output_dir}
trap 'rm -rf ${output_tmp_dir}' EXIT
mkdir -p "${output_dir}"
trap 'rm -rf "${output_tmp_dir}"' EXIT

release_dir=release
mkdir -p $release_dir
Expand All @@ -45,7 +45,7 @@ cp -rf scripts/generate-certificate.sh $output_dir/install
chmod +x $output_dir/install/genInventoryFile.py
chmod +x $output_dir/install/generate-certificate.sh

cp -a ${CONTIV_ARTIFACT_STAGING}/ansible ${output_dir}/
cp -a "${CONTIV_ARTIFACT_STAGING}/ansible" ${output_dir}/

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

env_file=$output_dir/install/ansible/env.json
sed -i.bak 's#__AUTH_PROXY_LOCAL_INSTALL__#true#g' "$env_file"
Expand Down
8 changes: 4 additions & 4 deletions scripts/download_ansible_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

set -euo pipefail

ANSIBLE_REPO_DIR=${CONTIV_ARTIFACT_STAGING}/ansible
ANSIBLE_REPO_DIR="${CONTIV_ARTIFACT_STAGING}/ansible"

rm -rf $ANSIBLE_REPO_DIR
rm -rf "$ANSIBLE_REPO_DIR"

mkdir -p $ANSIBLE_REPO_DIR $CONTIV_ARTIFACT_STAGING
mkdir -p "$ANSIBLE_REPO_DIR" "$CONTIV_ARTIFACT_STAGING"

echo downloading ${CONTIV_ANSIBLE_OWNER}/ansible commit: $CONTIV_ANSIBLE_COMMIT
curl --fail -sL https://api.github.com/repos/${CONTIV_ANSIBLE_OWNER}/ansible/tarball/$CONTIV_ANSIBLE_COMMIT \
| tar --strip-components 1 -C $ANSIBLE_REPO_DIR -z -x
| tar --strip-components 1 -C "$ANSIBLE_REPO_DIR" -z -x
8 changes: 4 additions & 4 deletions scripts/prepare_netplugin_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -euxo pipefail

: ${CONTIV_NETPLUGIN_TARBALL_NAME} # check if defined

mkdir -p $CONTIV_ARTIFACT_STAGING
mkdir -p "$CONTIV_ARTIFACT_STAGING"

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

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

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

0 comments on commit a973348

Please # to comment.