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
This commit is contained in:
parent
866a06f92d
commit
96504a4de0
@ -12,6 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import collections
|
||||||
from diskimage_builder.block_device.blockdevicesetupexception \
|
from diskimage_builder.block_device.blockdevicesetupexception \
|
||||||
import BlockDeviceSetupException
|
import BlockDeviceSetupException
|
||||||
from diskimage_builder.block_device.level1.mbr import MBR
|
from diskimage_builder.block_device.level1.mbr import MBR
|
||||||
@ -109,7 +110,7 @@ class Partitioning(object):
|
|||||||
if 'partitions' not in config:
|
if 'partitions' not in config:
|
||||||
self._config_error("Partitioning config needs 'partitions'")
|
self._config_error("Partitioning config needs 'partitions'")
|
||||||
|
|
||||||
self.partitions = {}
|
self.partitions = collections.OrderedDict()
|
||||||
for part_cfg in config['partitions']:
|
for part_cfg in config['partitions']:
|
||||||
if 'name' not in part_cfg:
|
if 'name' not in part_cfg:
|
||||||
self.config_error("Missing 'name' in partition config")
|
self.config_error("Missing 'name' in partition config")
|
||||||
|
Loading…
Reference in New Issue
Block a user