Skip to content

Commit

Permalink
Fixes for shellcheck
Browse files Browse the repository at this point in the history
- Quote a parameter
- Adjust how we check the returncode of two function calls to satifsy shellcheck
- Disable the warnings where we are explicitly relying on string splitting

Signed-off-by: Alex Brett <[email protected]>
  • Loading branch information
alexbrett committed Jul 16, 2024
1 parent 8b21881 commit 716607a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/xe-restore-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ for vdi_uuid in ${vdis}; do

if [ -e "${mnt}/.ctxs-metadata-backup" ]; then
${debug} echo "Found backup metadata on VDI: ${vdi_uuid}" >&2
matched_vdis+=( ${vdi_uuid} )
matched_vdis+=( "${vdi_uuid}" )
fi
else
${debug} echo "backup metadata not found" >&2
Expand All @@ -265,13 +265,11 @@ fi

vdi_uuid=${matched_vdis[0]}
xe vdi-param-set uuid="${vdi_uuid}" other-config:ctxs-pool-backup=true
createvbd
if [ $? -ne 0 ]; then
if ! createvbd; then
echo "Failure creating VBD for backup VDI ${vdi_uuid}" >&2
exit 1
fi
mountvbd
if [ $? -ne 0 ]; then
if ! mountvbd; then
echo "Failure mounting backup VDI ${vdi_uuid}" >&2
exit 1
fi
Expand Down Expand Up @@ -362,7 +360,9 @@ else
fi
shopt -s nullglob
for meta in *.vmmeta; do
# shellcheck disable=SC2086
echo xe vm-import filename="${meta}" sr-uuid="${sr_uuid}" --metadata --preserve${force_flag}${dry_run_flag}
# shellcheck disable=SC2086
"@OPTDIR@/bin/xe" vm-import filename="${full_dir}/${meta}" sr-uuid="${sr_uuid}" --metadata --preserve${force_flag}${dry_run_flag}
if [ $? -gt 0 ]; then
error_count=$(( $error_count + 1 ))
Expand Down

0 comments on commit 716607a

Please sign in to comment.