Prevent failure on 'copy_configdrive_to_disk.sh'

The script splits 'sfdisk' output wrongly in blank spaces leading to
failures when partition id is greater than 10, e.g.:
"/dev/sda10: start= ...".

This fix splits the output on ":" and trims trailing space when
partition id is less than 10, e.g.: "/dev/sda1 : start= ...".

Change-Id: I23f4b747fc0a86713cb912afc5d193398e6a597b
Closes-Bug: 1581699
This commit is contained in:
Ricardo Araújo Santos 2016-05-16 16:10:08 -03:00
parent e4e4355a63
commit a90ee859a2

@ -104,7 +104,7 @@ else
# Find partition we just created
# Dump all partitions, ignore empty ones, then get the last partition ID
ISO_PARTITION=`sfdisk --dump $DEVICE | grep -v ' 0,' | tail -n1 | awk '{print $1}'` || fail "finding ISO partition created on ${DEVICE}"
ISO_PARTITION=`sfdisk --dump $DEVICE | grep -v ' 0,' | tail -n1 | awk -F ':' '{print $1}' | sed -e 's/\s*$//'` || fail "finding ISO partition created on ${DEVICE}"
# Wait for udev to pick up the partition
udevadm settle --exit-if-exists=$ISO_PARTITION