scripts: fix the scripts load-images.sh and save-images.sh in the case user provides invalid flags

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

Longhorn #1419

Signed-off-by: Phan Le <phan.le@rancher.com>
This commit is contained in:
Phan Le 2020-07-15 19:02:55 -07:00 committed by Sheng Yang
parent 312ea9d54d
commit c90ad4cf2b
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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