Manage a pool of nodes for a distributed test infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fake-image-create 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. echo "*** fake-image-create: start"
  3. echo "arguments:"
  4. echo "----"
  5. echo $*
  6. echo "----"
  7. if [[ "${SHOULD_FAIL}" == 'true' ]]; then
  8. echo "Should fail is set, exiting with status 127"
  9. exit 127
  10. fi
  11. if [[ "${DIB_RELEASE}" != "21" ]]; then
  12. echo "DIB_RELEASE not set correctly"
  13. exit 1
  14. fi
  15. # test passing of real-life env-vars
  16. if [[ "${TMPDIR}" != "/opt/dib_tmp" ]]; then
  17. echo "TMPDIR not set"
  18. exit 1
  19. fi
  20. if [[ "${DIB_IMAGE_CACHE}" != "/opt/dib_cache" ]]; then
  21. echo "DIB_IMAGE_CACHE not set"
  22. exit 1
  23. fi
  24. if [[ "${DIB_CLOUD_IMAGES}" != "http://download.fedoraproject.org/pub/fedora/linux/releases/test/21-Beta/Cloud/Images/x86_64/" ]]; then
  25. echo "DIB_CLOUD_IMAGES not set"
  26. exit 1
  27. fi
  28. if [[ "${BASE_IMAGE_FILE}" != "Fedora-Cloud-Base-20141029-21_Beta.x86_64.qcow2" ]]; then
  29. echo "BASE_IMAGE_FILE not set"
  30. exit 1
  31. fi
  32. outfile=
  33. outtypes=("qcow2")
  34. TEMP=$(getopt -o xo:t: --long qemu-img-options:,no-tmpfs,checksum -- "$@")
  35. if [ $? -ne 0 ]; then
  36. echo "Invalid option"
  37. exit 1
  38. fi
  39. eval set -- "$TEMP"
  40. while true ; do
  41. case "$1" in
  42. --checksum)
  43. echo " -> set --checksum"; shift 1;;
  44. --no-tmpfs)
  45. echo " -> set --no-tmpfs"; shift 1;;
  46. --qemu-img-options)
  47. echo " -> qemu-img-options: $2"; shift 2;;
  48. -o) outfile=$2; shift 2;;
  49. -t) IFS="," read -a outtypes <<< "$2"; shift 2;;
  50. -x) echo " -> debugging enabled"; shift;;
  51. --) shift ; break ;;
  52. *) echo "Unknown option : $1"; exit 1;;
  53. esac
  54. done
  55. if [ -z "$outfile" ]; then
  56. echo "No output file specified."
  57. exit 1
  58. else
  59. for outtype in ${outtypes[@]} ; do
  60. echo "fake-data" > $outfile.$outtype
  61. echo "10da41d43d4bd6d67db763616c18b72f" > $outfile.$outtype.md5
  62. echo "0033e9d444953d11689b5fa6a6dba32bf901582f62b0825bc35f593190b1f7dc" > $outfile.$outtype.sha256
  63. done
  64. fi
  65. # Emulate manifest creation
  66. mkdir $outfile.d
  67. echo "*** fake-image-create: done"