Skip to content

Commit 13a6190

Browse files
committed
converting two url options into one
1 parent 5df72db commit 13a6190

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

samples/convert-upload-images-powervs/convert-upload-images-powervs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ Args:
4141
--cos-access-key string Cloud Storage access key(optional)
4242
--cos-secret-key string Cloud Storage secret key(optional)
4343
--skip-os-password Skip the root user password (optional)
44-
--rhel-sha256 string Expected SHA256 checksum for RHEL image(optional)
45-
--rhcos-sha256 string Expected SHA256 checksum for RHCOS image(optional)
44+
--sha256 string Expected SHA256 checksum for the image(optional)
4645
--help help for upload
4746
Environment Variables:
4847
DOWNLOAD_MAX_RETRIES Maximum number of retry attempts if a download fails or the checksum validation fails (default: 3)
@@ -722,7 +721,7 @@ function download_url() {
722721
error " 6. Increase retry attempts: export DOWNLOAD_MAX_RETRIES=5"
723722
return 1
724723
fi
725-
}
724+
726725

727726
#-------------------------------------------------------------------------
728727
# Verify file size matches expected size from HTTP headers
@@ -788,14 +787,14 @@ function download_image {
788787
if [[ "$1" == "rhel" ]];then
789788
if echo $RHEL_URL | grep -q -i 'access.cdn.redhat.com' ; then
790789
log "downloading rhel image"
791-
download_url "$RHEL_URL" "$RHEL_SHA256"
790+
download_url "$RHEL_URL" "$IMAGE_SHA256"
792791
RHEL_IMAGE=$IMAGE_PATH
793792
RHEL_DOWNLOADED_IMAGE_NAME=$DOWNLOAD_IMAGE_NAME
794793
RHEL_NEW_IMAGE_PATH=$IMAGE_NEW_PATH
795794
COPY_RHEL_IMAGE=1
796795
fi
797796
elif [[ "$1" == "rhcos" ]];then
798-
download_url "$RHCOS_URL" "$RHCOS_SHA256"
797+
download_url "$RHCOS_URL" "$IMAGE_SHA256"
799798
RHCOS_IMAGE=$IMAGE_PATH
800799
RHCOS_DOWNLOAD_IMAGE_NAME=$DOWNLOAD_IMAGE_NAME
801800
copy_image_file $RHCOS_IMAGE $RHCOS_OBJECT_NAME
@@ -867,7 +866,7 @@ function main {
867866

868867
# Only use sudo if not running as root
869868
[ "$(id -u)" -ne 0 ] && SUDO=sudo || SUDO=""
870-
platform_checks
869+
# platform_checks
871870

872871
# Parse commands and arguments
873872
while [[ $# -gt 0 ]]; do
@@ -913,13 +912,9 @@ function main {
913912
"--skip-os-password")
914913
SKIP_OS_PASSWORD="--skip-os-password"
915914
;;
916-
"--rhel-sha256")
917-
shift
918-
RHEL_SHA256="$1"
919-
;;
920-
"--rhcos-sha256")
915+
"--sha256")
921916
shift
922-
RHCOS_SHA256="$1"
917+
IMAGE_SHA256="$1"
923918
;;
924919
"--help")
925920
help

0 commit comments

Comments
 (0)