Skip to content

Commit

Permalink
scripts: fix the scripts load-images.sh and save-images.sh in the cas…
Browse files Browse the repository at this point in the history
…e user provides invalid flags

When user provides an invalid flag, print out error message and
help menu instead of looping forever

Longhorn longhorn#1419

Signed-off-by: Phan Le <phan.le@rancher.com>
PhanLe1010 authored and yasker committed Jul 16, 2020
1 parent 312ea9d commit c90ad4c
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scripts/load-images.sh
Original file line number Diff line number Diff line change
@@ -24,6 +24,11 @@ while [[ $# -gt 0 ]]; do
help="true"
shift
;;
*)
echo "Error! invalid flag: ${key}"
help="true"
break
;;
esac
done

@@ -65,4 +70,4 @@ for i in $(cat ${list}); do
docker push ${reg}longhornio/${i}
;;
esac
done
done
7 changes: 6 additions & 1 deletion scripts/save-images.sh
Original file line number Diff line number Diff line change
@@ -19,6 +19,11 @@ while [[ $# -gt 0 ]]; do
help="true"
shift
;;
*)
echo "Error! invalid flag: ${key}"
help="true"
break
;;
esac
done

@@ -42,4 +47,4 @@ done

if [[ $images ]]; then
docker save $(cat ${list} | tr '\n' ' ') | gzip -c > ${images}
fi
fi

0 comments on commit c90ad4c

Please sign in to comment.