Package: openstack-debian-images
Version: 1.1
Severity: normal
Tags: patch
Hi folks,
Spending some time to integrate the openstack builds on cdimage.d.o,
I'm getting errors at the end of the build (see later bug report for
that). Annoyingly, the build-openstack-debian-image script exits 0 on
failure, which makes it difficult for automated callers to know it's
failed.
Here's a trivial patch to fix that.
-- System Information:
Debian Release: 7.8
APT prefers stable
APT policy: (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/build-openstack-debian-image b/build-openstack-debian-image
index f6d4fd7..de55807 100755
--- a/build-openstack-debian-image
+++ b/build-openstack-debian-image
@@ -192,14 +192,16 @@ else
fi
cleanup(){
+ error=$?
[ ! -d "${MOUNT_DIR}" ] && return
echo
- echo "error, umounting $MOUNT_DIR"
+ echo "error $error, umounting $MOUNT_DIR"
chroot ${MOUNT_DIR} umount /proc || true
chroot ${MOUNT_DIR} umount /sys || true
umount ${MOUNT_DIR}
rmdir ${MOUNT_DIR}
kpartx -d ${AMI_NAME}
+ exit $error
}
trap "cleanup" EXIT TERM INT