From 96504a4de02f13943c5b849e106fe71bc1e75bd5 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Tue, 7 Mar 2017 14:36:21 +0100 Subject: [PATCH] Use OrderedDict for partitions instead of simple dictionary The order of the partitions is important, it needs to be preserved. If using a simple dict, this is not happening. As a consequence, checks like 'primary partition being first' are failing because the dictionary sorts the partitions randomly. Switched to OrderedDict solved the problem, as it preserves the ordering it gets from the yaml blob. Change-Id: Icfa9bd95ffd0203d7c3f6af95de3a6f848c2a954 --- diskimage_builder/block_device/level1/partitioning.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/block_device/level1/partitioning.py b/diskimage_builder/block_device/level1/partitioning.py index 9fe9d82f..ea875b4e 100644 --- a/diskimage_builder/block_device/level1/partitioning.py +++ b/diskimage_builder/block_device/level1/partitioning.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +import collections from diskimage_builder.block_device.blockdevicesetupexception \ import BlockDeviceSetupException from diskimage_builder.block_device.level1.mbr import MBR @@ -109,7 +110,7 @@ class Partitioning(object): if 'partitions' not in config: self._config_error("Partitioning config needs 'partitions'") - self.partitions = {} + self.partitions = collections.OrderedDict() for part_cfg in config['partitions']: if 'name' not in part_cfg: self.config_error("Missing 'name' in partition config")