There appear to be multiple forms if AMI archive directory structures
in common use. Add the one used by the tty-linux so we can get rid of
the special case for it to support UPLOAD_LEGACY_TTY
(new):
image-name/aki-tty/image
image-name/ami-tty/image
image-name/ari-tty/image
and
(existing):
image-name/*.img
image-name/*.initrd
image-name/*.vmlinuz
Change-Id: Ia7d88d53760f571c6a488c3139049502b484d33e
| ... | ... |
@@ -1637,17 +1637,8 @@ if is_service_enabled g-reg; then |
| 1637 | 1637 |
TOKEN=`curl -s -d "{\"auth\":{\"passwordCredentials\": {\"username\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\"}, \"tenantName\": \"$ADMIN_TENANT\"}}" -H "Content-type: application/json" http://$HOST_IP:5000/v2.0/tokens | python -c "import sys; import json; tok = json.loads(sys.stdin.read()); print tok['access']['token']['id'];"`
|
| 1638 | 1638 |
|
| 1639 | 1639 |
# Option to upload legacy ami-tty, which works with xenserver |
| 1640 |
- if [ $UPLOAD_LEGACY_TTY ]; then |
|
| 1641 |
- if [ ! -f $FILES/tty.tgz ]; then |
|
| 1642 |
- wget -c http://images.ansolabs.com/tty.tgz -O $FILES/tty.tgz |
|
| 1643 |
- fi |
|
| 1644 |
- |
|
| 1645 |
- tar -zxf $FILES/tty.tgz -C $FILES/images |
|
| 1646 |
- RVAL=`glance add --silent-upload -A $TOKEN name="tty-kernel" is_public=true container_format=aki disk_format=aki < $FILES/images/aki-tty/image` |
|
| 1647 |
- KERNEL_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "` |
|
| 1648 |
- RVAL=`glance add --silent-upload -A $TOKEN name="tty-ramdisk" is_public=true container_format=ari disk_format=ari < $FILES/images/ari-tty/image` |
|
| 1649 |
- RAMDISK_ID=`echo $RVAL | cut -d":" -f2 | tr -d " "` |
|
| 1650 |
- glance add -A $TOKEN name="tty" is_public=true container_format=ami disk_format=ami kernel_id=$KERNEL_ID ramdisk_id=$RAMDISK_ID < $FILES/images/ami-tty/image |
|
| 1640 |
+ if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then |
|
| 1641 |
+ IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}http://images.ansolabs.com/tty.tgz"
|
|
| 1651 | 1642 |
fi |
| 1652 | 1643 |
|
| 1653 | 1644 |
for image_url in ${IMAGE_URLS//,/ }; do
|
| ... | ... |
@@ -1669,14 +1660,15 @@ if is_service_enabled g-reg; then |
| 1669 | 1669 |
rm -Rf "$xdir"; |
| 1670 | 1670 |
mkdir "$xdir" |
| 1671 | 1671 |
tar -zxf $FILES/$IMAGE_FNAME -C "$xdir" |
| 1672 |
- KERNEL=$(for f in "$xdir/"*-vmlinuz*; do |
|
| 1672 |
+ KERNEL=$(for f in "$xdir/"*-vmlinuz* "$xdir/"aki-*/image; do |
|
| 1673 | 1673 |
[ -f "$f" ] && echo "$f" && break; done; true) |
| 1674 |
- RAMDISK=$(for f in "$xdir/"*-initrd*; do |
|
| 1674 |
+ RAMDISK=$(for f in "$xdir/"*-initrd* "$xdir/"ari-*/image; do |
|
| 1675 | 1675 |
[ -f "$f" ] && echo "$f" && break; done; true) |
| 1676 |
- IMAGE=$(for f in "$xdir/"*.img; do |
|
| 1676 |
+ IMAGE=$(for f in "$xdir/"*.img "$xdir/"ami-*/image; do |
|
| 1677 | 1677 |
[ -f "$f" ] && echo "$f" && break; done; true) |
| 1678 |
- [ -n "$IMAGE_NAME" ] |
|
| 1679 |
- IMAGE_NAME=$(basename "$IMAGE" ".img") |
|
| 1678 |
+ if [[ -z "$IMAGE_NAME" ]]; then |
|
| 1679 |
+ IMAGE_NAME=$(basename "$IMAGE" ".img") |
|
| 1680 |
+ fi |
|
| 1680 | 1681 |
;; |
| 1681 | 1682 |
*.img) |
| 1682 | 1683 |
IMAGE="$FILES/$IMAGE_FNAME"; |