Skip to content

Commit 55687e1

Browse files
committed
config_drive: ensure the search locations are ordered alphabetically
The internal Python implementation for the configured config drive search locations is not deterministic. Make it deterministic by using alphabetically sorted order. In this case, the search order becomes: - type: iso, vfat - location: cdrom, hdd, partition Change-Id: I622700c9408d3acee6d44eabfd73c662df7e7cfd Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
1 parent 2db34b4 commit 55687e1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cloudbaseinit/metadata/services/baseconfigdrive.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ def _preprocess_options(self):
6464
if self._searched_locations | CD_LOCATIONS != CD_LOCATIONS:
6565
raise exception.CloudbaseInitException(
6666
"Invalid Config Drive locations %s", self._searched_locations)
67+
# Note(avladu): sort the order of the searched locations
68+
# This is needed to be sure that the order is respected
69+
# See: https://github.com/cloudbase/cloudbase-init/issues/200
70+
self._searched_types = sorted(self._searched_types)
71+
self._searched_locations = sorted(self._searched_locations)
6772

6873
def load(self):
6974
super(BaseConfigDriveService, self).load()

0 commit comments

Comments
 (0)